 |
|
<?
$id_edit=$_POST[id_edit];
$TFS_ID=$_POST[TFS_ID];
$F_Name=$_POST[F_Name];
$L_Name=$_POST[L_Name];
$Sex=$_POST[Sex];
$Address=$_POST[Address];
$Telephone=$_POST[Telephone];
$Mobile=$_POST[Mobile];
$Email=$_POST[Email];
$Location=$_POST[Location];
$Username=$_POST[Username];
$Password=$_POST[Password];
$Permission_Level=$_POST[Permission_Level];
$Date_Record=$_POST[Date_Record];
$Last_Update=date("Y-m-d");
$Update_Time=date("H:i:s");
$chkdel=$_POST['chkdel'];
$Photo=$_FILES['Photo']['tmp_name'];
$Photo_name=$_FILES['Photo']['name'];
$Photo_size=$_FILES['Photo']['size'];
$Photo_type=$_FILES['Photo']['type'];
if ($TFS_ID=="" or $F_Name==""or $L_Name=="" or $Sex=="" or $Address=="" or $Telephone=="" or $Mobile=="" or $Email=="" or $Location=="0" or $Username=="" or $Password=="" or $Permission_Level=="0" ) {
permission_menu($sess_level);
echo "ERROR : กรุณากรอกข้อมูลให้ครบด้วยครับ";
exit();
}
if (!checkemail($Email)) {
permission_menu($sess_level);
echo "<font class='eng'>ERROR :</font><font class='thai'> รูปแบบอีเมลที่กรอกไม่ถูกต้องนะครับ <br>ตรวจสอบเครื่องหมาย @ และ . ของ Email ด้วยนะครับ</font>";
exit();
}
if ($chkdel=="1") {
$sql="update tb_tfs set Photo='' where ID ='$id_edit' ";
mysql_db_query($dbname,$sql);
unlink("photo/$Photo_del");
}
if ($Photo) {
$ext = strtolower(end(explode('.', $Photo_name)));
if ($ext == "jpg" or $ext == "jpeg" or $ext=="gif" or $ext=="png") {
$filename=$id_edit.".".$ext;
copy($Photo,"photo/$filename");
$sql="update tb_tfs set Photo='$filename' where ID='$id_edit' ";
mysql_db_query($dbname,$sql);
}
}
$sql="update tb_tfs set TFS_ID='$TFS_ID' , F_Name='$F_Name' , L_Name='$L_Name' , Sex='$Sex' , Address='$Address' , Telephone='$Telephone' , Mobile='$Mobile' , Email='$Email' , Location='$Location' , Username='$Username' , Password='$Password' , Permission_Level='$Permission_Level' , Date_Record='$Date_Record' , Last_Update='$Last_Update' , Update_Time='$Update_Time' where ID='$id_edit' ";
$result=mysql_db_query($dbname,$sql);
if ($result) {
echo"ทำการแก้ไขข้อมูล TFS เรียบร้อยแล้วครับ";
echo"<meta http-equiv='refresh' content='2; url=index.php'>";
exit();
} else {
echo "<h3>ไม่สามารถแก้ไขข้อมูลได้</h3>";
echo"<meta http-equiv='refresh' content='2; url=index.php'>";
}
mysql_close();
?>
อันนี้เป็น script ทั้งหมดครับ
|
 |
 |
 |
 |
Date :
2011-06-07 21:56:37 |
By :
Nut_M |
|
 |
 |
 |
 |
|
|
 |