Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once('header.php');
- require_once('inc/inc_user.php');
- require_once("inc/inc_context.php");
- if (Context::IsLogged())
- {
- header("HTTP/1.1 301 Moved Permanently");
- header("Location: taikhoan.php");
- }
- // Logout
- if(isset($_GET["act"]))
- {
- $refer_url = 'index.php';
- if(isset($_GET["refer"]))
- {
- $refer_url = $_GET["refer"];
- }
- if($_GET["act"] == "logout"){
- Context::Destroy();
- header("HTTP/1.1 301 Moved Permanently");
- header("Location: $refer_url");
- }
- }
- if(isset($_POST["btnDangNhap"]))
- {
- $username = $_POST['txtUsername'];
- $password = $_POST['txtPassword'];
- $u = new User(-1, $username, $password, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, '', 0, 0);
- if($u->Login() == true)
- {
- $_SESSION["IsLogin"] = 1; // đã đăng nhập
- date_default_timezone_set('Asia/Ho_Chi_Minh');
- $_SESSION["Login_Time"] = date('Y-m-d H:i:s');
- $_SESSION["Login_IP"] = getIP();
- $_SESSION["CurrentUser"] = (array)User::GetInfo($username);
- $refer_url = 'taikhoan.php';
- if(isset($_GET["refer"]))
- {
- $refer_url = $_GET["refer"];
- }
- header("HTTP/1.1 301 Moved Permanently");
- header("Location: $refer_url");
- }
- else
- {
- echo "<script type='text/javascript'>alert('Đăng nhập thất bại!');</script>";
- }
- }
- ?>
- <div id="sidebar" class="fleft">
- <div id="box-login" class="box-1">
- <div>
- <div class="fleft"><span class="text-1">Account</span></div>
- <div class="fright">
- <a href="dangky.php" class="link-1 text-1">Register</a>
- <span class="link-1"> | </span>
- <a href="" class="link-1 text-1">Forgot password</a>
- </div>
- <div class="clearfix"></div>
- </div>
- <form method="POST" action="" accept-charset="UTF-8" id="frmLogin" name="frmLogin">
- <div class="m-t-small">
- <input type="text" name="txtUsername" id="txtUsername" class="input-1" placeholder="Account" maxlength="32">
- </div>
- <div class="m-t-small">
- <input type="password" name="txtPassword" id="txtPassword" class="input-1" placeholder="password">
- </div>
- <div class="m-t-small">
- <div class="fright">
- <button type="submit" name="btnDangNhap" class="btn-1">Login</button>
- </div>
- <div class="clearfix"></div>
- </div>
- </form>
- </div>
- <div class="social">
- <a href="" class="google fleft"></a>
- <a href="" class="facebook fright"></a>
- <div class="clearfix"></div>
- </div>
- </div>
- <div id="content-container" class="fright">
- <div class="campaign-registry"></div>
- </div>
- <div class="clearfix"></div>
- <?php
- include_once('footer.php');
Add Comment
Please, Sign In to add comment