-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsql.php
38 lines (38 loc) · 1.01 KB
/
sql.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
<?php
header('Content-Type:text/html; charset=utf-8');
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("expires:0");
$mysqli=new MySQLi("127.0.0.1","root","@@##qqaa8520","3dy1_db",3306);
$mysqli->query("set names utf8");
if(isset($_GET['qishu']) && isset($_GET['hm']) && isset($_GET['tablename'])){
$time=date("Y/m/d H:i:s");
$qishu=$_GET['qishu'];
$hm=$_GET['hm'];
$tablename=$_GET['tablename'];
$sql="select id from $tablename where qishu='".$qishu."'";
$tquery = $mysqli->query($sql);
$tcou = $mysqli->affected_rows;
$hms=explode(',',$hm);
if($tcou==0){
$sql = "insert into $tablename (qishu,datetime,ok";
for($i=1;$i<=count($hms);$i++){
$sql.=',ball_'.$i;
}
$sql.=") values('".$qishu."','".$time."','0'";
for($i=1;$i<=count($hms);$i++){
$sql.=",'".$hms[$i-1]."'";
}
$sql.=')';
$result=$mysqli->query($sql);
if($result===false){
echo 'fail';
}else{
echo 'success';
}
}else{
echo 'already_exist';
}
}else{
echo '格式有误';
}