urlto("index.php"); } if (isset($_POST['pw'])) { $pw = $_POST['pw']; } else { urlto("index.php"); } //check data if (!valid_username($un)) { urlto("index.php?msg=2"); } if (!valid_password($pw)) { urlto("index.php?msg=2"); } $con = mysql_connectEx(); $sql = "SELECT * FROM `motal_users` WHERE `username`='" . $un . "'"; echo $sql . "<hr>"; $result = mysql_query($sql); $row = @mysql_fetch_array($result); if (isset($row['username'])) { //check hashed data $pw = sha1($un . $pw); if ($pw == $row['password']) { $_SESSION['uid'] = $row['id']; urlto("main.php"); } else { urlto("index.php?msg=3"); } } else { urlto("index.php?msg=3"); }
goto FAIL_REPOST; } //check if username used $con = mysql_connectEx(); $sql = "SELECT * FROM `motal_users` WHERE `username`='" . $un . "'"; echo $sql . "<hr>"; $result = mysql_query($sql); if (!$result) { die("result1 failed."); } $row = @mysql_fetch_array($result); if (isset($row['username'])) { $error_id = 3; goto FAIL_REPOST; } //password hash $pw = sha1($un . $pw); //insert data and quit $sql = "insert into motal_users(username,password,nickname)values('{$un}','{$pw}','{$nn}')"; mysql_query($sql); mysql_close($con); urlto("index.php?msg=1"); //fail re-post FAIL_REPOST: echo "<form name=\"repost\" method=\"POST\" action=\"register.php?msg=" . $error_id . "\">"; echo "<input type=\"hidden\" name=\"nn\" value=\"" . $nn . "\">"; echo "<input type=\"hidden\" name=\"un\" value=\"" . $un . "\">"; echo "</form>"; echo "<script type=\"text/javascript\">"; echo "document.repost.submit();"; echo "</script>";
<?php include "_header.php"; if (isset($_SESSION['uid'])) { urlto("main.php"); } ?> <head> <title>Enjoy the world<?php echo $html_title_tail; ?> </title> <style type="text/css"> @import url(CSSreset.css); @import url(interface.css); </style> </head> <body style="background-image:url(img/bg.gif);"> <center> <div id="login"> <form align="center" method="POST" action="index_action.php"> <span class="formused">帳號:</span><input class="formtext" name="un" type="text" size="12"><br> <br> <span class="formused">密碼:</span><input class="formtext" name="pw" type="password" size="12"><br> <br> <input class="formbutton" type="submit" value="登入"> </form> </div> <div style="padding:10px 0px 0px 0px;"> <a href="register.php">註冊帳號</a> <a href="">忘記密碼</a> </div> <div class="systemmsg">
/** * 静态资源 * * @param string $target * * @return string */ function assets($target) { return urlto('/assets/') . ltrim($target, '/'); }
<?php include "_header.php"; if (!isset($_SESSION['uid'])) { urlto("index.php"); } ?> <head> <title>Game Lord<?php echo $html_title_tail; ?> </title> <style type="text/css"> @import url(CSSreset.css); @import url(game.css); div{padding:5px 0px 10px 0px;} .square{padding:20px 20px 20px 20px; background-color:#ffffe0; border:black 2px ridge;} td{padding:6px 9px 6px 9px;} </style> </head> <body style="background-image:url(img/bg2.gif);"> <div id="topMenu" align="right"> Hi!<?php if (isset($_SESSION)) { echo $_SESSION['uid'] . "(logout,center)"; } ?> </div> <div id="mainMenu" align="center"> <span class="square">status</span>