-
Notifications
You must be signed in to change notification settings - Fork 0
/
regvalidation.php
58 lines (37 loc) · 838 Bytes
/
regvalidation.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
<?php
include 'config.php';
session_start();
$con= mysqli_connect("$db_host","$db_user","$db_pass");
mysqli_select_db($con,"$db_name");
// if($con)
// {
// echo "connection succesful";
// }
// else
// {
// echo "connection failed";
// }
$username= $_POST['username'];
$pass = $_POST['psw'];
$email= $_POST['email'];
$q1= " select * from user where username = '$username'";
$res = mysqli_query($con,$q1);
$nor = mysqli_num_rows($res);
if($nor >= 1)
{ session_destroy();
session_start();
$_SESSION['regstatus']=1;
header('location:register.php');
}
else
{
$q2= "insert into user (username, password, userMail) values ('$username' , '$pass' , '$email')";
session_destroy();
session_start();
$_SESSION['regstatus'] = 2;
$res2 = mysqli_query($con,$q2);
header('location:index.php');
?>
<?php
}
?>