[英]Blank page after submit
I've been busy creating a login script, only problem is i get a blank page after submitting the login form. 我一直在忙于创建登录脚本,唯一的问题是提交登录表单后我得到了空白页。 I'm using a Template System.
我正在使用模板系统。
Some codes, 一些代码
login.tpl: login.tpl:
<div class="container">
<form class="form-login" action="/customer/login/submit" method="post">
<h2 class="form-login-heading">$site_name Customer Panel</h2>
<div class="login-wrap">
<input type="text" name="loginusername" class="form-control" placeholder="Username" autofocus>
<input type="password" name="loginpassword" class="form-control" placeholder="Password">
<button class="btn btn-lg btn-login btn-block" type="submit" name="login">Log in</button>
<center>
<div class="registration">
Don't got an account yet?
<a class="" href="$site_url/customer/register">
Create an account
</a>
</div>
</center>
</div>
</form>
Submit.php: Submit.php:
<?php
if (!isset($_POST['loginusername'], $_POST['loginpassword']))
{
Site::Stop('/customer/login');
}
$Error = Users::Login($_POST['loginusername'], $_POST['loginpassword']);
if (isset($_SESSION['username']))
{
Site::Stop('/customer/dashboard');
}
$_SESSION['login_error'] = $Error;
Site::Stop('/customer/login');
?>
login.php: login.php中:
$this->Define('LoginError', '');
if (isset($_SESSION['login_error']))
{
$errors = Array(
1 => 'This username does not exist.',
2 => 'Your password is incorrect.');
if ($_SESSION['login_error'] == 3)
{
$errors[3] = ' Your '.$_SESSION['ban']['bantype'].' is banned.
Reason: '.$_SESSION['ban']['reason'].'.
Your ban expires on: '.date('d-m-y H:i:s', $_SESSION['ban']['expire']);
unset($_SESSION['ban']);
}
$this->Define('LoginError', '<div class="well well-danger">'.$errors[$_SESSION['login_error']].'</div>');
unset($_SESSION['login_error']);
}
$this->LoadTpl('Login');
Maps.php Maps.php
<?php
$this->Map('/customer/login', 'Login.php');
$this->Map('/customer/register', 'Register.php');
$this->Map('/customer/register/submit', 'RegSubmit.php');
if (Users::$Session === false)
{
$this->Map('/customer/login/submit', 'Submit.php');
}
else
{
$this->Map('/customer/logout', 'Logout.php');
}
?>
确保会话已从php文件顶部的session_start()开始。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.