$act = trim(compile_str($_REQUEST['act'])); switch ($act) { case 'login': $userName = trim(compile_str($_REQUEST['userName'])); $md5Password = trim($_REQUEST['pwd']); userLogin($userName, $md5Password); break; case 'SMS': $mobileNum = trim(compile_str($_REQUEST['userName'])); generateSMS($mobileNum); break; case 'register': $mobileNum = trim(compile_str($_REQUEST['userName'])); $SMS = trim(compile_str($_REQUEST['SMS'])); $md5Password = trim($_REQUEST['pwd']); userRegister($mobileNum, $SMS, $md5Password); break; case 'send_find_pwd_SMS': generateSMS('', 'send_find_pwd_SMS'); break; case 'check_find_pwd_SMS': $mobile_phone = trim(compile_str($_REQUEST['mobile_phone'])); $SMS = trim(compile_str($_REQUEST['SMS'])); $md5Password = trim($_REQUEST['pwd']); $rtVal = check_find_pwd_SMS($mobile_phone, $SMS, $md5Password); if (SYSTEM_ERROR == $rtVal) { die(urldecode(json_encode(array('error' => '系统错误')))); } elseif (MOBILE_PHONE_ERROR == $rtVal) { die(urldecode(json_encode(array('error' => '手机号码有误')))); } elseif (SMS_ERROR == $rtVal) { die(urldecode(json_encode(array('error' => '验证码错误'))));
$a = explode(" ", stringDecode($_POST["code"])); for ($i = 0; $i < count($a); $i++) { if ($a[$i] == "") { unset($a[$i]); } } $a = array_values($a); $res = intval($a[0]); if ($a[1] == "+") { $res += intval($a[2]); } elseif ($a[1] == "-") { $res -= intval($a[2]); } else { $res *= intval($a[2]); } $res = userRegister($_POST["username"], $_POST["password1"], $_POST["password2"], $_POST["email1"], $_POST["email2"], $_POST["captcha_res"], $res, $_POST["nickname"]); handleErrors($res); } if (isset($_GET["reply"])) { $user = userGetLoggedIn(); $res = postCreate($_POST["topic"], $user["id"], $_POST["message"]); handleErrors($res); header("location: index.php?topic_id=" . $_POST["topic"]); } if (isset($_GET["newtopic"])) { $user = userGetLoggedIn(); if (isset($_POST["parent"])) { $parent = $_POST["parent"]; } else { $parent = -1; }
<meta name="viewport" content="width=device-width, initial-scale=1"> <!-- General Custom Style --> <link href="default.css" rel="stylesheet"> <!-- login Style --> <link href="login.css" rel="stylesheet"> <?php require_once 'utils.php'; ?> <?php checkPermission(0); ?> <?php list($registerSuccess, $errno) = userRegister(); ?> </head> <body> <?php addNavBar(); ?> <div class="container"> <div id="content"> <?php if (!$registerSuccess) { //el registro falló if ($errno == -1) { //No hay nada extraño, no traté de registrar
<?php //Sets the links for all of the nav bar. Accounts is not included because accounts is added later. $PageListName = array("HOME", "PRODUCTS", "TUTORIALS", "ABOUT US"); $PageURL = array("index.php", "products.php?filter=none", "tutorial.php", "aboutUs.php"); //Displays all of the links in the Nav bar except the account and shopping cart. for ($i = 0; $i < count($PageListName); $i++) { echo "<a href='" . $PageURL[$i] . "'>" . $PageListName[$i] . "</a>"; } if (isDatabaseConnected()) { if (isset($_POST['accountLogIn'])) { userLogIn($link); //Tries to log the user in. Location: PHPScipts/formSubmits.php } else { if (isset($_POST['accountRegister'])) { //Checks to see if the user is registering. userRegister($link); //Tries to register the user. Location: PHPScripts/formSubmits.php } } } if (isLoggedIn()) { //Checks to see if the user is currently logged in. Location: PHPScripts/helperFunctions.php //Displays the Account button so the user can go to their account. echo "<a href='userAccount.php'>ACCOUNT</a>"; } else { //If there is no user signed in. Display the Sign In button so they can sign in. echo "<span id='accountOpener'>SIGN IN</span>"; } ?> </div>
<body> <?php require_once 'includes/functions.php'; $message = ''; if (isset($_POST['submit'])) { $password = $_POST['password']; $password2 = $_POST['password2']; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $username = $_POST['username']; $company = $_POST['company']; $email = $_POST['email']; if ($password == $password2) { userRegister($first_name, $last_name, $username, $email, $password); } else { $message = 'Passwords do not match.'; } } ?> <div class="container"> <nav class="navbar navbar-default"> <div class="container-fluid"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span>