Documents
Resources
Learning Center
Upload
Plans & pricing Sign in
Sign Out

php

VIEWS: 9 PAGES: 10

									<?php
include("lib/database.php");
$myCnn = new database();
include "check.php"; // Authentication
session_start();
$strstatus="";
$sssss="";
$sssss1="";
$sssss2="";
$on_id = $_REQUEST['on_id'];

//echo $catid;
if(isset($_REQUEST['Submit'])){

                 $cat_id = $_REQUEST['cat_id'];
                 $name = $_REQUEST['name'];
                 $location_id = $_REQUEST['location_id'];
                 $size = $_REQUEST['size'];
                 $price = $_REQUEST['price'];
                 $attributes = $_REQUEST['attributes'];
                 $floor_plan = $_REQUEST['floor_plan'];
                 $facing = $_REQUEST['facing'];
                 $compic= $_REQUEST['compic'];
                 $compic1= $_REQUEST['compic1'];
                 $compic2= $_REQUEST['compic2'];
                // $product_typeid=$_REQUEST['product_typeid'];

                if($compic==1){

                      $uploaddir = 'projects/on_going/';
                      $sssss = (basename($_FILES['rimg']['name']));
                      $uploadfile = $uploaddir.basename($_FILES['rimg']['name']);
                      if(move_uploaded_file($_FILES['rimg']['tmp_name'],
$uploadfile))
                      {
                        $strstatus="up";
                      }else{
                         $strstatus="Not uploaded";
                       }
                       echo $strstatus;


                $query="UPDATE on_going SET cat_id='$cat_id', name='$name',
img='$sssss', location_id='$location_id', size='$size', price='$price',
attributes='$attributes', location_map='$sssss1', floor_plan='$floor_plan',
specification='$sssss2', facing='$facing' WHERE on_id='$on_id'; ";
                $result= mysql_query($query) or die(mysql_error());

               }elseif ($compic==0){
               $query="UPDATE on_going SET cat_id='$cat_id', name='$name',
location_id='$location_id', size='$size', price='$price', attributes='$attributes',
location_map='$sssss1', floor_plan='$floor_plan', specification='$sssss2', facing='$facing'
WHERE on_id='$on_id'; ";
               $result= mysql_query($query) or die(mysql_error());

                }
                    if($result){
                            echo
"<script>window.location='manage_ongoing2.php'</script>";
                    } else{
                            $mes = mysql_error();
                    }
       }


if($compic1==1){

                       $uploaddir = 'projects/on_map/';
                       $sssss1 = (basename($_FILES['rmap']['name']));
                       $uploadfile = $uploaddir.basename($_FILES['rmap']['name']);
                       if(move_uploaded_file($_FILES['rmap']['tmp_name'],
$uploadfile))
                       {
                         $strstatus="up";
                       }else{
                          $strstatus="Not uploaded";
                        }
                        echo $strstatus;


                $query="UPDATE on_going SET cat_id='$cat_id', name='$name',
img='$sssss', location_id='$location_id', size='$size', price='$price',
attributes='$attributes', location_map='$sssss1', floor_plan='$floor_plan',
specification='$sssss2', facing='$facing' WHERE on_id='$on_id'; ";
                $result= mysql_query($query) or die(mysql_error());

               }elseif ($compic1==0){
               $query="UPDATE on_going SET cat_id='$cat_id', name='$name',
location_id='$location_id', size='$size', price='$price', attributes='$attributes',
floor_plan='$floor_plan', specification='$sssss2', facing='$facing' WHERE
on_id='$on_id'; ";
               $result= mysql_query($query) or die(mysql_error());
               }
                    if($result){
                            echo
"<script>window.location='manage_ongoing2.php'</script>";
                    } else{
                            $mes = mysql_error();
                    }
       }


if($compic2==1){

                    $uploaddir = 'projects/on_specification/';
                    $sssss2 = (basename($_FILES['rspecification']['name']));
                    $uploadfile =
$uploaddir.basename($_FILES['rspecification']['name']);
                    if(move_uploaded_file($_FILES['rspecification']['tmp_name'],
$uploadfile))
                    {
                      $strstatus="up";
                    }else{
                       $strstatus="Not uploaded";
                     }
                     echo $strstatus;


                $query="UPDATE on_going SET cat_id='$cat_id', name='$name',
img='$sssss', location_id='$location_id', size='$size', price='$price',
attributes='$attributes', location_map='$sssss1', floor_plan='$floor_plan',
specification='$sssss2', facing='$facing' WHERE on_id='$on_id'; ";
                $result= mysql_query($query) or die(mysql_error());

               }elseif ($compic1==0){
               $query="UPDATE on_going SET cat_id='$cat_id', name='$name',
location_id='$location_id', size='$size', price='$price', attributes='$attributes',
floor_plan='$floor_plan', facing='$facing' WHERE on_id='$on_id'; ";
               $result= mysql_query($query) or die(mysql_error());

               }
                    if($result){
                            echo
"<script>window.location='manage_ongoing2.php'</script>";
                    } else{
                            $mes = mysql_error();
                    }
       }



        $ongoingquery = mysql_query("SELECT * FROM on_going WHERE
on_id='$on_id'");
        $ongoingrow = mysql_fetch_row($ongoingquery);
        $cat_id = $ongoingrow[2];
        $name = $ongoingrow[3];
        $place = $ongoingrow[3];
        $location = $ongoingrow[4];
        $size = $ongoingrow[5];
        $date = $ongoingrow[6];
        $attributes = $ongoingrow[7];
        $price = $ongoingrow[8];
   $strimagename = $ongoingrow[2];
//}

?>
<HTML><HEAD>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Vista Interior Limited</title>

<link rel="stylesheet" href="css/stylesheet.css" type="text/css">
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0>

<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
 <TBODY>
 <TR bgColor=#ffffff>
  <TD colSpan=3 height=5></TD></TR>
 <TBODY>
 <TR>
  <TD height=41 width=43><IMG alt="" height=41 src="images/inner_01.gif"
width=43></TD>
  <TD align=left background=images/top_line.jpg height=41 vAlign=center
  width="100%">&nbsp;</TD>
  <TD height=41 width=37><IMG alt="" height=41
   src="images/inner_03.gif" width=37></TD>
 </TR>
 <TR>
  <TD background=images/left_line.jpg height=2 width=43>&nbsp;</TD>
  <TD align=middle height=2 vAlign=top width="90%">
   <TABLE border=0 cellPadding=0 cellSpacing=2 height="100%" width="100%">
    <TR>
      <TD align=right colSpan=2 vAlign=center><table width="100%" border="0"
cellspacing="0" cellpadding="0">
        <tr>
         <td width="82%">&nbsp;</td>
         <td width="10%"><a href="admin.php"><img src="images/home.gif"
width="72" height="22" border="0"></a></td>
         <td width="8%"><a href="logout.php"><img border="0"
src="images/logout.jpg" width="77" height="18"></a></td>
        </tr>
      </table> </TD>
     </TR>
     <TBODY>
     <TR align="center" valign="middle">
      <TD align=left width="50%" height="20"><FONT color=#666666
        face=Verdana size=1> Welcome
        <?php echo $_SESSION['name'];?>
        </FONT></TD>
      <td width="50%" align="right" height="20"><font color="#666666"
face="Verdana" size=1>Date :
        <?php echo date("M d,Y");?>
        </font></td>
     </TR>
     <TR>
      <TD align=middle colSpan=2
   vAlign=center>
        <table width="100%" border="0" cellspacing="1" cellpadding="2"
bgcolor="D95407">
         <tr>
           <td align="center" bgcolor="#FFFFFF"><table width="100%" border="0"
cellspacing="0" cellpadding="0">
            <tr>
             <td rowspan="3"><img src="images/space.gif" width="5" height="1"></td>
             <td><img src="images/space.gif" width="1" height="5"></td>
             <td rowspan="3"><img src="images/space.gif" width="5" height="1"></td>
            </tr>
            <tr>
             <td width="100%" align="left" valign="top"><table width="100%"
border="0" cellspacing="0" cellpadding="0">
               <tr>
                <td width="200" align="left" valign="top"><?php include
"button.php";?></td>
                <td width="5" align="left" valign="top">&nbsp;</td>
                <td width="941" align="left" valign="top" class="title"><table
width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                  <td height="25" align="left" valign="middle" bgcolor="#D4D4D4"
class="title">Edit Subcategory</td>
                 </tr>
                 <tr>
                  <td><form action="" method="post" enctype="multipart/form-data"
name="form1">
                    <table width="100%" border="0" cellspacing="2" cellpadding="2">
                     <tr>
                      <td colspan="3" align="center" valign="middle"
class="fieldtext"><font color="#006600"><?php echo $mes;?></font></td>
                      </tr>
                     <?php
                                                             //$product_type =
$_REQUEST['product_type'];
                                                              $query=$myCnn-
>query("SELECT * FROM category");?>
                     <tr>
                      <td class="fieldtext">Edit Project Category: </td>
                      <td colspan="2"><select name="cat_id" id="cat_id">
                       <?php

                             while($sresult=$myCnn->fetch_object($query))
                             { ?>
                     <option value='<?php echo $sresult->cat_id ?>'<?php if($sresult-
>cat_id==$cat_id) echo "selected";?> ><?php echo $sresult->cat_name?></option>
                     <?php

           }?>
                     </select></td>
                    </tr>
                    <tr>
                     <td width="14%" class="fieldtext">Edit Project Name:</td>
                     <td colspan="2"><input name="name" type="text" class="fieldtext"
id="name" value="<?php echo $ongoingrow[3];?>" size="30"></td>
                    </tr>
                    <tr>
                     <td><span class="fieldtext">Edit Project Image:</span></td>
                     <td width="35%"><input name="compic" type="radio"
class="text11" style="border:none;" onClick="rimg.style.visibility='hidden';" value="0"
checked>
                       <span class="fieldtext">Keep Existing </span><br>
          <input name="compic" type="radio" class="text11" style="border:none;"
onClick="rimg.style.visibility='visible';" value="1">
          <span class="fieldtext">Keep New </span><br>
          <label>
          <input name="rimg" type="file" id="rimg" style="visibility:hidden;">
          </label></td>
                      <td width="51%" align="center" valign="top"><table width="50%"
border="1" cellpadding="0" cellspacing="0" bordercolor="#66CCCC" style="border-
collapse:collapse;">
            <tr>
             <td align="center"><?php
                        if($strimagename1!="")
                        OutputThumbnail1("projects/on_going/$strimagename1", 100);
?></td>
            </tr>
         </table>
                        <span class="fieldtext"> Existing Project Image </span><br></td>
                     </tr>
                     <tr>
                      <?php
                                                             //$product_type =
$_REQUEST['product_type'];
                                                              $query=$myCnn-
>query("SELECT * FROM location");?>
                                                               <td><span
class="fieldtext">Edit Location:</span></td>
                      <td colspan="2"><select name="location_id" id="location_id">
                        <?php

                              while($sresult=$myCnn->fetch_object($query))
                              { ?>
                       <option value='<?php echo $sresult->location_id ?>'<?php
if($sresult->location_id==$location_id) echo "selected";?> ><?php echo $sresult-
>location?></option>
                       <?php

           }?>
                    </select></td>
                   </tr>
                   <tr>
                    <td><span class="fieldtext">Edit Size:</span></td>
                    <td colspan="2"><input name="size" type="text" class="fieldtext"
id="size" value="<?php echo $ongoingrow[6];?>" size="30"></td>
                   </tr>
                   <tr>
                    <td><span class="fieldtext">Edit Price:</span></td>
                    <td colspan="2"><input name="price" type="text" class="fieldtext"
id="price" value="<?php echo $ongoingrow[7];?>" size="30" /></td>
                   </tr>
                   <tr>
                    <td><span class="fieldtext">Edit Attributes:</span></td>
                      <td colspan="2"><textarea name="attributes" cols="30" rows="3"
id="attributes" ><?php echo $ongoingrow[8];?></textarea></td>
                     </tr>
                     <tr>
                      <td><span class="fieldtext">Edit Location Map:</span></td>
                      <td><input name="compic1" type="radio" class="text11"
style="border:none;" onClick="rmap.style.visibility='hidden';" value="0" checked>
                        <span class="fieldtext">Keep Existing </span><br>
          <input name="compic1" type="radio" class="text11" style="border:none;"
onClick="rmap.style.visibility='visible';" value="1">
          <span class="fieldtext">Keep New </span><br>
          <label>
          <input name="rmap" type="file" id="rmap" style="visibility:hidden;">
          </label></td>
                      <td width="51%" align="center" valign="top"><table width="50%"
border="1" cellpadding="0" cellspacing="0" bordercolor="#66CCCC" style="border-
collapse:collapse;">
            <tr>
             <td align="center"><?php
                        if($strimagename2!="")
                        OutputThumbnail1("projects/on_map/$strimagename2", 100);
?></td>
            </tr>
         </table>
                        <span class="fieldtext"> Existing Location Map </span><br></td>
                     </tr>
                     <tr>
                      <td><span class="fieldtext">Edit Floor Plan:</span></td>
                      <td colspan="2"><input name="floor_plan" type="text"
class="fieldtext" id="floor_plan" value="<?php echo $ongoingrow[10];?>"
size="30"></td>
                     </tr>
                     <tr>
                      <td><span class="fieldtext">Edit Terms &amp;
Specification:</span></td>
                      <td colspan="2"><input name="compic2" type="radio"
class="text11" style="border:none;" onClick="rimg.style.visibility='hidden';" value="0"
checked>
                        <span class="fieldtext">Keep Existing </span><br>
          <input name="compic2" type="radio" class="text11" style="border:none;"
onClick="rspecification.style.visibility='visible';" value="1">
          <span class="fieldtext">Keep New </span><br>
          <label>
          <input name="rspecification" type="file" id="rspecification"
style="visibility:hidden;">
          </label></td>
                      </tr>
                      <tr>
                        <td><span class="fieldtext">Edit Facing:</span></td>
                        <td colspan="2"><input name="facing" type="text"
class="fieldtext" id="facing" value="<?php echo $ongoingrow[12];?>" size="30"></td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td colspan="2"><input name="Submit" type="submit"
class="submit" id="Submit" value="Submit">                          </td>
                      </tr>
                     </table>
                                     </form>
                   </td>
                  </tr>
                </table></td>
               </tr>
             </table></td>
            </tr>
            <tr>
             <td><img src="images/space.gif" width="1" height="5"></td>

               </tr>
           </table></td>
          </tr>
        </table>
       </TD>
     </TR>
     </TBODY>
    </TABLE>
   </TD>
   <TD background=images/right_line.jpg height=2 width=37>&nbsp;</TD>
  </TR>
  <TR>
   <TD height=26 width=43><IMG alt="" height=26
    src="images/inner_07.gif" width=43></TD>
   <TD background=images/bottom_line.jpg height=26 width="100%"></TD>
   <TD height=26 width=37><IMG alt="" height=26
    src="images/inner_09.gif" width=37></TD>
  </TR>
  </TABLE>
  <?php include "footer.php";?></BODY></HTML>
  <?php
function OutputThumbnail1($strimagename1, $size)
{
        if (file_exists($strimagename1))
       {
              $size1 = GetImageSize($strimagename1);
              $hie = $size1[1];
              $wid = $size1[0];
              if($wid>$size)
              {
                     $multiplier=$size/$wid;
                     $wid = $wid*$multiplier;
                     $hie = $hie*$multiplier;
              }
              echo "<img width='$wid' height='$hie' src='$strimagename1' border='0'>";
       }
}
?>


<?php
function OutputThumbnail1($strimagename2, $size)
{
       if (file_exists($strimagename2))
       {
                $size1 = GetImageSize($strimagename2);
                $hie = $size1[1];
                $wid = $size1[0];
                if($wid>$size)
                {
                        $multiplier=$size/$wid;
                        $wid = $wid*$multiplier;
                        $hie = $hie*$multiplier;
                }
                echo "<img width='$wid' height='$hie' src='$strimagename2' border='0'>";
       }
}
?>

								
To top