-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
35 lines (29 loc) · 1.13 KB
/
signup.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
<?php
if(isset($_POST["sub"]))
{
//check password and confirm
if($_POST["pw"] == $_POST["con"])
{
$con=new mysqli("localhost","root","","orders");
//check email existence
$st = $con->prepare("select * from users where email=?");
$st->bind_param("s", $_POST["em"]);
$st->execute();
$rs = $st->get_result();
//E-Mail validation
if($rs->num_rows > 0)
echo '<script>alert("E-Mail already exist");</script>';
else{
//Signup process
$st = $con->prepare("insert into users values(?,?,?,?)");
$st->bind_param("ssss", $_POST["em"],$_POST["pw"],
$_POST["nm"],$_POST["ph"]);
$st->execute();
$_SESSION["user"] = $_POST["em"];
echo '<script>window.location="index.php";</script>';
}
}
else
echo '<script>alert("Password Not Match");</script>';
}
?>