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 |
||||
include './functions.php'; |
||||
|
||||
$hash = $_REQUEST['hash']; |
||||
$tableId = $_REQUEST['tableId']; |
||||
$hash = $_GET['hash']; |
||||
$tableId = $_GET['tableId']; |
||||
|
||||
|
||||
if(!isset($hash) || !isset($tableId)) die(); |
||||
if(!isset($hash) || !isset($tableId) || strlen($hash)<60 || strlen($tableId)<60) die(); |
||||
|
||||
|
||||
|
||||
$cnn = db__connect(); |
||||
|
||||
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 |
||||
)); |
||||
|
||||
echo '<script>alert("加入成功!");window.location.href="../"</script>'; |
||||
$data = getFinalData($cnn, $tableId); |
||||
|
||||
if(!db__rowNum($cnn, "user", "user", $hash, "table", $tableId)){ |
||||
$itemId = hash('sha256', time().$hash.$tableId.rand(222,999)); |
||||
|
||||
db__pushData($cnn, "account", array( |
||||
"id" => $itemId, |
||||
"table" => $tableId, |
||||
"user" => $hash, |
||||
"type" => 'placeholde', |
||||
"state" => '0', |
||||
"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