require_once 'inc/inc.php'; require_once 'func/func_reg.php'; $requestClientName = "peterlee"; $requestClientPwd = "zxcqwe13LLo46462QQdssd99*63"; if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_POST['clientName'] == $requestClientName && $_POST['clientPwd'] == $requestClientPwd) { if (isset($_POST['player_id'])) { $uid = $_POST['player_id']; $pwd = $_POST['pwd']; $playerInfo = get_player_info($db, $uid); if (empty($playerInfo)) { unset($arr_input); $arr_input['player_id'] = $uid; $arr_input['picture_url'] = md5($pwd); //$arr_input['player_name'] = $userName; if (count(add_player($db, $arr_input)) > 0) { $jsonResult = '{' . '"player_id": ' . '"' . $uid . '"' . '}'; echo $jsonResult; } } else { if (md5($pwd) == $playerInfo['picture_url']) { $jsonResult = '{' . '"player_id": ' . '"' . $uid . '"' . '}'; echo $jsonResult; } else { $errmsg = '"login fail"'; $jsonResult = '{' . '"error": ' . $errmsg . '}'; echo $jsonResult; } } } }
function read($file) { $f_contents = file($file); $line = $f_contents[array_rand($f_contents)]; $data = $line; return str_replace("\n", "", $data); } function add_player($filename, $filecontent) { //shell_exec("echo 'null' > people/$filename.txt"); $file = fopen($filename, "w"); write($filecontent, $filename); } $filename = 'people/' . $cookieID . '.txt'; $filecontent = "Name: " . $you . " (ID: " . $cookieID . ")\nVampires killed: " . $tot; add_player($filename, $filecontent); $act = $_GET['action']; if ($act == 'stab') { $verbs = shell_exec('shuf -n 1 stabs.txt'); $dies = shell_exec('shuf -n 1 dies.txt'); write($you . " " . read('stabs.txt') . " the vampire. The vampire " . read('dies.txt') . "! Total vampires slain by " . $you . ": " . $tot); } if ($act == 'login') { write($you . " just logged in."); } if ($act == 'logout') { write($you . " logged out. Bye bye!"); } if ($act == 'spawn') { spawnVampire(); }
user_login(); break; case 'add_event': add_event(); break; case 'add_event_desc': add_event_desc(); break; case 'fetch_all_tournament': fetch_all_tournament(); break; case 'add_team': add_team(); break; case 'add_player': add_player(); break; case 'add_tour_settings': add_tour_settings(); break; case 'fetch_single_tournament': fetch_single_tournament(); break; case 'update_tournament_details': update_tournament_details(); break; } function pay_authorize() { $curl = curl_init(); $url = "http://localhost/laravel_api/pay_authorize";