<?
session_start();
include("../Connections/conn.php");
mysql_select_db($dbname);
//$signup = date("j/n/").(date("Y")+543);
$id_stu=$_POST[id_stu];
$name=$_POST[name];
$lastname=$_POST[lastname];
$date=$_POST[d];
$month=$_POST[m];
$yearday=$_POST[y];
$sql="select id_stu from student where id_stu='$id_stu'";
$result=mysql_query($sql);
$numrow=mysql_num_rows($result);
if($numrow==0){
echo"<h2><center><font color=blue>คุณไม่ใช่ศิษย์เก่าค่ะ แต่ถ้าคุณเป็นศิษย์เก่าจริงๆๆ<br> และต้องการใช้งาน กรุณาติดต่อกับ ผู้ดูแลระบบค่ะ</font></center></h2>";
echo"<hr>";
echo"<meta http-equiv='refresh' content='4; url=../index.php'>";
exit();
}
include("user.php");
copy($_FILES[photo][tmp_name],'photo/'.$_FILES[photo][name]);
$image=$_FILES[photo][name];
$sql="select * from member order by id desc";
$sql1="select * from user order by id desc";
$result=mysql_query($sql);
$result=mysql_query($sql1);
$dbarr = mysql_fetch_row($result);
$result=mysql_query("insert into member(id,id_stu,id_card,name,lastname,d,m,y,age,sex,address,district,pro,zip,tel,image,course,id_branch,attend,graduate,status_work,username) values ('','$id_stu','$txtID','$name','$lastname','$d','$m','$yearday','$age','$sex','$address','$district','$pro','$zip','$tel','$image','$c','$id_branch','$attend','$graduate','$r1','$user_name')") or die ("ERROR member");
$result=mysql_query("insert into user(id,username,password,status,email) values ('','$user_name','$pwd_name1','member','$email')") or die ("ERROR user");
if ($r1== "ทำงาน"){
$result=mysql_query("insert into workplace (id,id_stu,workplace,location,add1,dis,prov,zip,tel,salary) values ('','$id_stu','$workplace','$location','$add1','$pp','$prov1','$z1','$tell','$salary')") or die ("Err 1");
}else if ($r1== "ศึกษาต่อ"){
$result=mysql_query("insert into education (id,id_stu,education,course,branch) values ('','$id_stu','$edu','$course','$branch')") or die ("Err 2");
}else if ($r1== "ทำงานและศึกษาต่อ"){
$result=mysql_query("insert into learnwork (id,id_stu,work1,location1,add3,provin,z,tele,salar,educ,bra) values ('','$id_stu','$work1','$lo','$as','$provin','$zip11','$tel11','$sal','$ed','$br')") or die ("Err 3");
}
if($result){
$login_true=$user_name;
session_register("login_true");
echo"<h2><center>ขอบคุณสำหรับการลงทะเบียน<br>กรุณารอสักครู่เพื่อเข้าสู่ระบบ</center><h2>";
echo"<hr>";
echo"<meta http-equiv='refresh' content='3; url=../index.php'>";
}
?>
$result=mysql_query("insert into member(id,id_stu,id_card,name,lastname,d,m,y,age,sex,address,district,pro,zip,tel,image,course,id_branch,attend,graduate,status_work,username) values ('','$id_stu','$txtID','$name','$lastname','$d','$m','$yearday','$age','$sex','$address','$district','$pro','$zip','$tel','$image','$c','$id_branch','$attend','$graduate','$r1','$user_name')") or die ("ERROR member");