require('../'.DIR_INCLUDE.'data.php');
$tb="t_member";
mysql_select_db($db) or die("เลือกฐานข้อมูลไม่ได้");
$sql = "select * from $tb where studentid ='$username'";
$dbquery = mysql_query($sql);
$num_rows = mysql_num_rows($dbquery);
if(!$num_rows){
mysql_select_db($db) or die("เลือกฐานข้อมูลไม่ได้");
$insert_table = mysql_query("INSERT INTO $tb (studentid,password,status,studentnumber,classid,first,firstname,lastname,email,telephone,address,datesave,ipaddress) values ('$username','$password1','Y','$code','$classroom','$pre','$firstname','$lastname','$email','$telephone','$address','$date','$ip')") or die ("Can't insert data to table.");
mkdir("../file/".$username, 0777);
header("refresh: 0; url=../index.php?C=login&P=main");
}