1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- if (!session_id()) {
- session_start();
- }
- $no_visible_elements = true; // hide all details before login
- require_once("config.php");
- include('header.php');
- #
- $userName = !empty($_POST['userName']) ? trim($_POST['userName']) : "";
- $password = !empty($_POST['userPwd']) ? trim($_POST['userPwd']) : "";
- define("ALERT_MSG", "<div class=\"alert alert-info\">请输入账号和密码</div>");
- define("ALERT_ERROR", "<div class=\"alert alert-danger\">用户名或密码错误</div>");
- $isNoLogin = (!isset($_SESSION["isLogin"]) || $_SESSION["isLogin"] == false);
- $alertInfo = ALERT_MSG;
- if (!$isNoLogin) {
- echo "<script type=\"text/javascript\">top.location=\"./login.php\";</script>";
- exit();
- } else if ($isNoLogin && !empty($userName) && !empty($password)) {
- if ($password != GM_PWD || !$userName == GM_USER) {
- $alertInfo = ALERT_ERROR;
- } else {
- $_SESSION["isLogin"] = true;
- $_SESSION["GM_USER"] = $userName;
- echo "<script type=\"text/javascript\">top.location=\"./index.php\";</script>";
- exit();
- }
- } else {
- $alertInfo = ALERT_MSG;
- }
- ?>
- <div class="row">
- <div class="col-md-12 center login-header">
- <h2>抽奖活动管理后台</h2>
- </div>
- <!--/span-->
- </div>
- <!--/row-->
- <div class="row">
- <div class="well col-md-5 center login-box">
- <?php echo $alertInfo; ?>
- <form class="form-horizontal" action="login.php" method="post" onSubmit="return notEmpty('userName,userPwd', '用户名不能为空, 密码不能为空');">
- <fieldset>
- <div class="input-group input-group-lg">
- <span class="input-group-addon">
- <i class="glyphicon glyphicon-user black"></i>
- </span>
- <input type="text" name="userName" id="userName" class="form-control" placeholder="用户名">
- </div>
- <div class="clearfix"></div><br>
- <div class="input-group input-group-lg">
- <span class="input-group-addon">
- <i class="glyphicon glyphicon-lock black"></i>
- </span>
- <input type="password" name="userPwd" id="userPwd" class="form-control" placeholder="密码">
- </div>
- <div class="clearfix"></div>
- <p class="center col-md-5">
- <button type="submit" class="btn btn-primary">登陆</button>
- </p>
- </fieldset>
- </form>
- </div>
- <!--/span-->
- </div>
- <!--/row-->
- <script type="text/javascript" charset="utf-8">
- function notEmpty(nameList, testList) {
- var name_arr = nameList.split(',');
- var test_arr = testList.split(',');
- for (var i = 0; i < name_arr.length; i++) {
- var value_input = document.getElementById(name_arr[i]).value;
- var alert_test = test_arr[i];
- if (value_input.length <= 0) {
- alert(alert_test);
- return false;
- }
- }
- }
- </script>
- <?php require('footer.php'); ?>
|