-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3.1.fac_signup_code.php
45 lines (41 loc) · 1.32 KB
/
3.1.fac_signup_code.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
<?php
$server_name = "localhost";
$user_name = "root";
$password = "";
$db = "project";
$conn = mysqli_connect($server_name, $user_name, $password, $db);
if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
if (isset($_POST['uname']))
{
$uname = trim($_POST['uname']);
$fid = trim($_POST['fid']);
$email = trim($_POST['email']);
$pass = trim($_POST['pass']);
$query = " SELECT Fid FROM fac_details WHERE Fid = '$fid' ";
$result = mysqli_query( $conn, $query);
$row= mysqli_num_rows($result);
if( ($row) == 0 )
{
$sql = " INSERT INTO fac_details values('$uname','$fid','$email','$pass')";
if(mysqli_query($conn,$sql))
{
echo ("<script LANGUAGE='JavaScript'>
window.alert('Succesfully registered!!!!!! Redirecting to Login Page....');
window.location.href='2.fac_login.php';
</script>"
);
}
}
else
{
echo ("<script LANGUAGE='JavaScript'>
window.alert('ID already exists');
window.location.href='3.fac_signup.php';
</script>"
);
}
}
?>