|
|
if (isset($_POST["Submit"]))
{
if(isset($_POST["id_cod"])){
$sql = "select * from chk_std WHERE id_cod='$id_cod' ";
//echo "$sql";
$re = run($sql,$connect);
if(rows($re) < 1){
//alert ("รหัสนักศึกษา ไม่มีในฐานข้อมูล");
//gotopage("register.php");
}
}
if(isset($_POST["user"])){
$sql = "select * from member WHERE user='$user' ";
$re = run($sql,$connect);
if(rows($re) > 0){
alert ("Username มีคนให้แล้ว");
gotopage("register.php");
}
}
if(isset($_POST["id_cod"])){
$sql = "select * from member WHERE id_cod='$id_cod' ";
$re = run($sql,$connect);
/*if(rows($re) > 0){
alert ("รหัสนักศึกษานี้ได้สมัครสมาชิกแล้ว กรุณาติดต่อผู้ดูแลระบบ");
gotopage("index.php");
}*/
}
//echo "$birthday";
//2009-10-02
$year1 = substr($birthday,2,2);
$mount1 = substr($birthday,5,2);
$day1 = substr($birthday,8,2);
$passID = $day1.$mount1.$year1;
//พาสแบบนี้ไม่เอานะ
//echo "$day1.$mount1.$year1";
if($picture){
$picture=$_FILES['picture']['tmp_name'];
$picture_name=$_FILES['picture']['name'];
$type=strtolower(end(explode('.',$picture_name)));
if($type =='jpeg' || $type =='gif' || $type =='jpg'){
//echo"$picture_name $type ";
copy($picture,"pictures/userImg/$picture_name");//คัดลอกรูปภาพไปยังโฟนเดอร์ที่เราตั้งไว้//
//บันทึกข้อมูลทั้งหมดลงฐานข้อมูล//
}
$sql="INSERT INTO member
(id_mem,user,pass,id_cod,name_mem,lastname,nickname,birthday,sex,house_number,mhoo,soy,road,tumbol,amper,province,code,byear,arg,patient_job,addass,province2,mo,email,tel,status,pop,patient_job2,addass2,province3,mo2,patient_job3,addass3,province4,mo3,pic)
VALUES('','$user','$passWrd','$id_cod','$firstname','$lastname','$nickname','$birthday','$sex','$house_number','$mhoo','$soy','$road','$tumbol','$amper','$province','$code','$byear','$arg','$patient_job','$addass','$province2','$mo','$email','$tel','$status','$pop','$patient_job2','$addass2','$province3','$mo2','$patient_job3','$addass3','$province4','$mo3','$picture_name') ";
//echo "$sql";
$re = run($sql,$connect);
alert ("บันทึกข้อมูลเรียบร้อยแล้ว");
gotopage("chk_log.php");
}
}//enn if picture
?>
|
|
|
|