5tarl0rd

Current Path : /home/tiporg/www/manage/
Upload File :
Current File : /home/tiporg/www/manage/edit_product.php

<?php 

include("classes/access_user_class.php"); 

//include_once("texteditor/fckeditor.php");

//include_once("thumbnail.class.php");



$page_protect = new Access_user;

// $page_protect->login_page = "login.php"; 

$page_protect->access_page(); 



if (isset($_GET['action']) && $_GET['action'] == "log_out") {

	$page_protect->log_out(); // the method to log off

}



$quy = "select * from tbl_products where pro_id = '".$_REQUEST['id']."'";

$resut = mysql_query($quy);

$rew = mysql_fetch_array($resut);

 

 



	if(isset($_REQUEST['Submit']))

	{

			if ($_FILES["userfile"]["name"] == "")

		  	{

		  		$img = $_REQUEST['pdfdb'];

		  	}

			else

			{

				$target_path = "../uploads/";

				$target_path = $target_path.time()."_".$_FILES['userfile']['name']; 

				$img =  time()."_".$_FILES['userfile']['name']; 

				move_uploaded_file($_FILES['userfile']['tmp_name'], $target_path);

			}

			

			  

			$string = "update tbl_products set 

			title= '".addslashes($_REQUEST['title'])."', 

			pdf='".$img."', 

			dated='".time()."',

			status = '1' where pro_id='".$_REQUEST['id']."'"; 

			mysql_query($string) or die(mysql_error());

			$msg="Product has been updated successfully";

			header("location:products.php?mess=$msg");

	}



?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Control Panel</title>

<link rel="stylesheet" type="text/css" href="js/calendar.css">

<script type="text/javascript" src="js/calendar.js?random=20060118"></script>

<script type="text/javascript" src="js/validator.js"></script>

<link href="css/main.css" rel="stylesheet" type="text/css" />

</head>



<body>

 



<?php include("includes/header.php");?>



<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">



  <tr>

    <td rowspan="3" align="left" background="images/white_left_bar.gif"></td>

    <td align="center"></td>

    <td width="1%" rowspan="3" align="right" background="images/white_right_bar.gif">&nbsp;</td>

  </tr>

  <tr>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td width="99%"><table width="98%" border="0" align="center" cellpadding="2" cellspacing="2">

      <tr>

        <td width="20%" valign="top"><?php require_once("includes/left_column.php");?></td>

        <td width="80%" valign="top"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="2" bordercolor="#cccccc" class="tableBorder">

          <tr>

            <td align="center"colspan="2" bgcolor="#EFEFEF" class="boldText">Edit Product </td>

          </tr>

          <tr>

            <td colspan="2" align="left" valign="top" background="#F6F6F6" class="errorText">			</td>

          </tr>

          <tr>

            <td colspan="2" align="left" valign="top"><form  method="post" enctype="multipart/form-data"  name="addpages" id="addpages">

						 

						<table width="100%" border="0" align="right" cellpadding="2" cellspacing="2">

                          <tr>

                            <td width="100%" colspan="2" align="right"><a href="products.php">Go Back</a></td>

                          </tr>

                          <tr>

                            <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">

                              <tr>

                                <td width="21%">&nbsp;</td>

                                <td width="79%">&nbsp;</td>

                              </tr>

                              



							  <tr>

                                <td class="mainText">title : </td>

                                <td>

								<input type="text" name="title" id="title" value="<?php echo stripslashes($rew['title']); ?>" />								</td>

                              </tr>

                              <tr>

                                <td class="mainText">&nbsp;</td>

                                <td>&nbsp;</td>

                              </tr>

							  <tr>

                                <td class="mainText">image : </td>

                                <td><input name="userfile" type="file" id="userfile" /></td>

                              </tr>

                              <tr>

                                <td class="mainText">&nbsp;</td>

                                <td><?php echo $rew['pdf'];?>

								<input type="hidden" name="pdfdb" id="pdfdb" value="<?php echo $rew['pdf']; ?>" />								</td>

                              </tr>

                              

                              <tr>

                                <td>&nbsp;</td>

                                <td>&nbsp;</td>

                              </tr>

                            </table></td>

                          </tr> 

				          <tr>

                            <td colspan="2" align="center" valign="top" class="mainText">                            </td>

                          </tr>

                          <tr >

                          <td colspan="2" align="center" class="label"><input name="id" type="hidden" id="id" value="<?php echo $rew['pro_id']; ?>" />

						  <input type="submit" name="Submit" value="Submit">

						  </td>

                          </tr>

                    </table>

						</form></td>

          </tr>

        </table></td>

      </tr>

    </table>    </td>

  </tr>

  <tr>

    <td ><img src="images/white_left_bottom_corner.gif" width="9" height="9" /></td>

    <td width="99%" background="images/white_bottom_bar.gif"><img src="images/white_bottom_bar.gif" width="4" height="9" /></td>

    <td width="1%"><img src="images/white_right_bottom_corner.gif" width="9" height="9" /></td>

  </tr>

</table>

</body>

<script language="javascript">

	  /*  var valid = new Validator("addpages");

		valid.addValidation("txtOrder","req", "Please enter order");

		valid.addValidation("txtName","req", "Please enter name");*/

		

	

</script>

</html>


5tarL0rd By 5tarl0rd Being Anonymous