-
Notifications
You must be signed in to change notification settings - Fork 2
/
signuph.php
46 lines (35 loc) · 1.52 KB
/
signuph.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
<?php
session_start();
include 'dbh.php';
//ini_set('max_execution_time', 300); //setting the maximum execution time for mail sending
$response="";
$obtainID=0;//user id initialization
if($_POST['name']!="" && $_POST['email']!="" && $_POST['pwd']!="" && $_POST['phone'] && $_POST['e_phone_1'] && $_POST['e_phone_2'] && $_POST['e_email_1'] && $_POST['e_email_2']){
$name=mysqli_real_escape_string($conn,$_POST['name']);
$email=mysqli_real_escape_string($conn,$_POST['email']);
$pwd=mysqli_real_escape_string($conn,$_POST['pwd']);
$phone=mysqli_real_escape_string($conn,$_POST['phone']);
$e_phone_1=mysqli_real_escape_string($conn,$_POST['e_phone_1']);
$e_phone_2=mysqli_real_escape_string($conn,$_POST['e_phone_2']);
$e_email_1=mysqli_real_escape_string($conn,$_POST['e_email_1']);
$e_email_2=mysqli_real_escape_string($conn,$_POST['e_email_2']);
$stmt= $conn->prepare("SELECT email FROM memberstable WHERE email=?");
$stmt-> bind_param("s",$EMAIL);
$EMAIL=$email;
$stmt->execute();
$result1=$stmt->get_result();
if($row=mysqli_fetch_assoc($result1)){
$response="signup email error";
}
else{
$sql="INSERT INTO memberstable (name, email, pwd, user_phone, e_phone_1, e_phone_2, e_email_1, e_email_2) VALUES ('$name','$email','$pwd','$phone','$e_phone_1','$e_phone_2','$e_email_1','$e_email_2')";
$result=mysqli_query($conn,$sql);
$obtainID=mysqli_insert_id($conn);
$_SESSION['id']=$obtainID;
$response=$obtainID;
}
}
else{
$response="not all filled";
}
echo $response;