-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.php
More file actions
35 lines (27 loc) · 751 Bytes
/
check.php
File metadata and controls
35 lines (27 loc) · 751 Bytes
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
<?php
$con=mysql_connect("localhost","root","","dmn");
if (!$con)
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysql_select_db('dmn');
if(isset($_POST['phone'])){
$phone = $_POST['phone'];
$id=array();
$iquery="INSERT INTO `user` (`phone`) VALUES('".mysql_real_escape_string($phone)."')";
if(!mysql_query($iquery)){
$id[]=0;
}else{
$select="SELECT `id` FROM `user` WHERE `phone`='".$phone."';";
$result = mysql_query($select,$con) or die('Errant query: '.$select);
if(mysql_num_rows($result)) {
while($post = mysql_fetch_assoc($result)) {
$id[]= $post;
}
}else{$id[]=0;}
}
header('Content-type: application/json');
echo json_encode(array('id'=>$id));
}
@mysql_close($con);
?>