mirror of https://github.com/IoTcat/cp-acc.git
master
parent
c8d65409f3
commit
2c7d6bc3c4
4 changed files with 143 additions and 43 deletions
@ -1,24 +1,49 @@ |
|||||||
<?php |
<?php |
||||||
include './functions.php'; |
include './functions.php'; |
||||||
|
|
||||||
$hash = $_REQUEST['hash']; |
$hash = $_GET['hash']; |
||||||
$tableId = $_REQUEST['tableId']; |
$tableId = $_GET['tableId']; |
||||||
|
|
||||||
|
|
||||||
if(!isset($hash) || !isset($tableId)) die(); |
if(!isset($hash) || !isset($tableId) || strlen($hash)<60 || strlen($tableId)<60) die(); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$cnn = db__connect(); |
$cnn = db__connect(); |
||||||
|
$data = getFinalData($cnn, $tableId); |
||||||
db__pushData($cnn, "user", array( |
|
||||||
"user" => $hash, |
if(!db__rowNum($cnn, "user", "user", $hash, "table", $tableId)){ |
||||||
"table" => $tableId, |
$itemId = hash('sha256', time().$hash.$tableId.rand(222,999)); |
||||||
"state" => '1', |
|
||||||
"created_at" => date("Y-m-d H:i:s", time()) |
db__pushData($cnn, "account", array( |
||||||
), array( |
"id" => $itemId, |
||||||
"user" => $hash, |
"table" => $tableId, |
||||||
"table" => $tableId |
"user" => $hash, |
||||||
)); |
"type" => 'placeholde', |
||||||
|
"state" => '0', |
||||||
echo '<script>alert("加入成功!");window.location.href="../"</script>'; |
"value" => $data['average'], |
||||||
|
"created_at" => date("Y-m-d H:i:s", time()) |
||||||
|
)); |
||||||
|
db__pushData($cnn, "user", array( |
||||||
|
"user" => $hash, |
||||||
|
"table" => $tableId, |
||||||
|
"state" => '1', |
||||||
|
"created_at" => date("Y-m-d H:i:s", time()) |
||||||
|
)); |
||||||
|
}else{ |
||||||
|
db__pushData($cnn, "user", array( |
||||||
|
"user" => $hash, |
||||||
|
"table" => $tableId, |
||||||
|
"state" => '1', |
||||||
|
"created_at" => date("Y-m-d H:i:s", time()) |
||||||
|
), array( |
||||||
|
"user" => $hash, |
||||||
|
"table" => $tableId |
||||||
|
)); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
setcookie("tableId", $tableId, time()+3600*12*60*365, "/"); |
||||||
|
|
||||||
|
|
||||||
|
echo '<script>alert("加入成功!");window.location.href="../"</script>'; |
||||||
|
Loading…
Reference in new issue