-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess.php
executable file
·53 lines (45 loc) · 1.16 KB
/
process.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
<?php
include 'db_connect.php';
$email=$_POST['email'];
$query="SELECT * FROM user WHERE Email='".$email."'";
$result = mysqli_query($con,$query);
if (!$result)
{
die('Errorvdvfd: ' . mysqli_error());
}
else
{ $array=mysqli_fetch_array($result,MYSQL_NUM);
// echo $array;
if(!$array)
{
$sql="INSERT INTO user (password,Name,Email,Age,Department,Phone_No)
VALUES
('$_POST[password]','$_POST[name]','$_POST[email]','$_POST[age]','$_POST[dept]','$_POST[phone_no]')";
if (!mysqli_query($con,$sql))
{
die('Errorfrefer: ' . mysqli_error());
}
$email=$_POST['email'];
$query="SELECT * FROM user WHERE Email='".$email."'";
$result = mysqli_query($con,$query);
if (!$result)
{
die('Erroraaaaaaaaa: ' . mysqli_error());
}
$array=mysqli_fetch_array($result,MYSQL_NUM);
if($array)
{
$post_data = array('id' => $array[1],'presence'=>0);
echo json_encode($post_data);
}
else
die("error".mysqli_error());
}
else
{
$post_data = array('id' => $array[1],'presence' => 1);
echo json_encode($post_data);
}
}
mysqli_close($con);
?>