| Server IP : 61.19.30.66 / Your IP : 216.73.216.15 Web Server : Apache/2.2.22 (Ubuntu) System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 User : www-data ( 33) PHP Version : 5.3.10-1ubuntu3.48 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/cooperative/sell/ |
Upload File : |
<?
ob_start();
session_start();
if($_SESSION["adminlogin"]=="")
{
header('location:index.php');
exit();
}
//============ Start Session และทำการเรียก Function ติดต่อฐานข้อมูล
require_once('../connect/connect.php');
require_once('../connect/function.php');
//=========== กรณีลบรายการสินค้า
if($_GET["Action"]=="Delete")
{
//=========== ลบข้อมูล
$sql_del= "delete from product where ProductID='".$_GET["ProductID"]."'";
$dbquery_del = mysql_query($sql_del);
//=========== ลบรูปเล็กและรูปใหญ่
@unlink("../picture/$_GET[file1]");
@unlink("../picture/$_GET[file2]");
echo"<script language='JavaScript'>";
echo"alert('ลบข้อมูลเรียบร้อยแล้ว');";
echo"window.location='product.php';";
echo"</script>";
}
?>
<html>
<title>..:: ระบบจัดการฐานข้อมูล ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../css/styles.css" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<div align="center"><br>
<table cellspacing=1 cellpadding=4 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td width="100%" bgcolor="#FFFFFF"> <div align="center"></div>
<table cellspacing=1 cellpadding=4 width="100%" border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td width="35%" bgcolor="#FFFFFF"> <div align="left"><b><img src="../image/allrowto.gif" width="11" height="11" align="absbottom">
รายการสินค้า</b></div></td>
<td width="22%" align=middle bgcolor="#FFFFFF"> <div align="left">
</div></td>
<td width="43%" bgcolor="#FFFFFF"> <div align="right"><a href="head.php">กลับไปหน้าหลัก</a></div></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
</div>
<form name="frm<?=$i;?>" method="post" action="<?=$_SERVER['PHP_SELF'];?>" enctype="multipart/form-data">
<table width="68%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="58%">หมวดหมู่
<select name="menu1" class="txtbox" onChange="MM_jumpMenu('parent',this,0)">
<option value="<?=$_SERVER['PHP_SELF'];?>">ทั้งหมด</option>
<?
//=========== แสดงหมวดหมู่
$sql_group = "select * from category order by CatID asc";
$dbquery_group = mysql_query($sql_group);
$num_rows_group = mysql_num_rows($dbquery_group);
while ($result = mysql_fetch_array($dbquery_group))
{
if($_GET["CatID"] == $result["CatID"])
{
$sel="selected";
}
else
{
$sel="";
}
?>
<option value="<?=$_SERVER['PHP_SELF'];?>?CatID=<?=$result["CatID"];?>" <?=$sel;?>><?=$result["CategoryName"];?></option>
<?
}
?>
</select></td>
<td width="42%"><div align="right"><img src="../image/edit_icon.gif" width="15" height="15">
<a href="addproduct.php">เพิ่มสินค้าใหม</a>่ </div></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<table cellspacing=1 cellpadding=3 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td bgcolor="#FFFFFF"><div align="center">ลำัดัับ</div></td>
<td bgcolor="#FFFFFF"><div align="center">รหัสสินค้า</div></td>
<td bgcolor="#FFFFFF">ชื่อสินค้า</td>
<td bgcolor="#FFFFFF"><div align="center">สต็อก</div></td>
<td bgcolor="#FFFFFF"><div align="center">สินค้าใหม่</div></td>
<td bgcolor="#FFFFFF"><div align="center">สินค้าโปรโมชั่น</div></td>
<td bgcolor="#FFFFFF"><div align="center">ราคา</div></td>
<td bgcolor="#FFFFFF"><div align="center">แก้ไข</div></td>
<td bgcolor="#FFFFFF"><div align="center">ลบ</div></td>
</tr>
<?
//=========== แสดงสินค้า
$condition="";
if($_GET["CatID"] <> "")
{
$condition="and CatID='$_GET[CatID]' ";
}
$i=0;
//=========== ทำการ query เพื่อเลือกรายการสินค้า
$sql_product = "select * from product where 1 $condition order by ProductID asc";
$dbquery_product = mysql_query($sql_product);
$num_rows_product = mysql_num_rows($dbquery_product);
while ($result= mysql_fetch_array($dbquery_product))
{
$i++;
?>
<tr bgcolor=#e5e5e5>
<td width="28" bgcolor="#FFFFFF"> <div align="center">
<?=$i;?>
</div></td>
<td width="66" bgcolor="#FFFFFF"><div align="center">
<?=$result["ProductCode"];?>
</div></td>
<td width="176" bgcolor="#FFFFFF">
<?=$result["ProductName"];?>
</td>
<td width="62" bgcolor="#FFFFFF">
<div align="center">
<?
$resultCheck=select("category","where 1=1 and CatID='$result[CatID]'");
if($result["Stock"] <= $resultCheck["CheckStock"])
{
echo "<font color=red><strong>$result[Stock]</strong></font>";
}
else
{
echo "<font color=black>$result[Stock]</font>";
}
?>
</div></td>
<td width="64" bgcolor="#FFFFFF"><div align="center">
<?
if($result["New"]=="Yes")
{
echo "<img src=\"../image/true.png\" width=\"12\" height=\"12\" title=\"เปิดใช้งาน\">";
}
else
{
echo "<img src=\"../image/false.png\" width=\"12\" height=\"12\" title=\"ปิดชั่วคราว\">";
}
?>
</div></td>
<td width="76" bgcolor="#FFFFFF"><div align="center">
<?
if($result["Promotion"]=="Yes")
{
echo "<img src=\"../image/true.png\" width=\"12\" height=\"12\" title=\"เปิดใช้งาน\">";
}
else
{
echo "<img src=\"../image/false.png\" width=\"12\" height=\"12\" title=\"ปิดชั่วคราว\">";
}
?>
</div></td>
<td width="71" bgcolor="#FFFFFF"> <div align="right">
<?=number_format($result["Price"], 2,'.',',');?>
</div></td>
<script language="JavaScript">
function Conf<?=$result["ProductID"]; ?>(object) {
if (confirm("ยืนยันการลบ [ <?=$result["ProductName"]; ?> ] ") ==true) {
return true;
}
return false;
}
</script>
<td width="32" bgcolor="#FFFFFF"><div align="center"><a href="editproduct.php?ProductID=<?=$result["ProductID"];?>"><img src="../image/edit_icon.gif" width="15" height="15" border="0"></a></div></td>
<td width="36" bgcolor="#FFFFFF"><div align="center"><a href="<?=$_SERVER['PHP_SELF'];?>?Action=Delete&ProductID=<?=$result["ProductID"];?>&file1=<?=$result["PictureSmall"];?>&file2=<?=$result["PictureBig"];?>" onClick="return Conf<?=$result["ProductID"]; ?>(this)"><img src="../image/delete.gif" width="16" height="16" border="0"></a></div></td>
</tr>
<?
}
?>
</tbody>
</table>
<table cellspacing=0 cellpadding=4 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td width="100%" bgcolor="#FFFFFF"> <div align="center"></div>
<table cellspacing=1 cellpadding=4 width="100%" border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td width="35%" bgcolor="#FFFFFF"> <div align="left"></div></td>
<td width="22%" align=middle bgcolor="#FFFFFF"> <div align="left">
</div></td>
<td width="43%" bgcolor="#FFFFFF"> <div align="right"><a href="head.php">กลับไปหน้าหลัก</a></div></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
</form>