-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadduser.php
66 lines (59 loc) · 1.55 KB
/
adduser.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
$host="localhost";
$user="root";
$password="";
$con=mysqli_connect($host,$user,$password);
$db=mysqli_select_db($con,"aau");
$fnm=$_POST["txtfname"];
$mnm=$_POST["txtmname"];
$snm=$_POST["txtsname"];
$catg=$_POST["cmbtype"];
$reg=$_POST["txtreg"];
$col=$_POST["txtcoll"];
$email=$_POST["txtemail"];
$bdt=$_POST["txtdob"];
$unm=$_POST["txtuname"];
$pwd=$_POST["txtpass"];
$cnfpwd=$_POST["txtcpass"];
$mno=$_POST["txtmob"];
$max=9999999999;
$min=1000000000;
if($mno>=$min && $mno<=$max)
{}else{header("Location: newuser.php?msg=0");
die();}
$emailB = filter_var($email, FILTER_SANITIZE_EMAIL);
if (filter_var($emailB, FILTER_VALIDATE_EMAIL) === false || $emailB != $email)
{header("Location: newuser.php?msg=14");
die();
}
if($catg=="admin"){$reg="$mno";}
/* if (!(checkdate($bdt)))
{
header("Location: newuser.php?err=1");
die();
} */
if ($cnfpwd!=$pwd)
{
header("Location: newuser.php?err=2");
die();
}
//$bdt=$y."-".$m."-".$d;
$qry="insert into user (fname,mname,sname,utype,regno,cname,email,dob,uname,pass,mono) values ('$fnm','$mnm','$snm','$catg','$reg','$col','$email','$bdt','$unm','$pwd','$mno')";
if (mysqli_query($con,$qry))
{
$last_id = mysqli_insert_id($con);
echo"$catg";
if($catg=="STUDENT"){
$q="CREATE TABLE $last_id$unm(id integer PRIMARY KEY AUTO_INCREMENT,sid integer,sname varchar(200),eid integer UNIQUE,ename varchar(200),mark varchar(50))";
echo"$q";
mysqli_query($con,$q);
}
header("Location: myhome.php?msg=1");
die();
}
else
{
header("Location: newuser.php?err=1");
die();
}
?>