我正在尝试使标题重定向,它就像 2 天前一样工作,我不知道我做了什么来打破它。它现在只是重新加载页面但启动会话。
这是代码,
<?php
if(isset($_SESSION['id']))
{
header("Location: home.php");
}
require_once 'global.php';
?>
<head>
<title>BookWizard - Join Now!</title>
<meta charset="utf-8" />
<meta name="description" content="FORMETER jQuery plugin" />
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Marmelad">
<link rel="stylesheet" href="/_secure/stylesheets/style.css" />
<link rel="stylesheet" href="css/formeter.1.0.css" />
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js">
</script><![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script src="javascript/formeter.1.0.min.js"></script>
<script>
$(function(){
$('#percentage').formProgress({
'speed' : 800,
'style' : 'green',
'bubble' : true,
'selector' : '.recommended'
});
});
</script>
</head>
<body>
<header>
<a class="logo" href="index.html"><!-- --></a>
</header>
<div id="wrapper">
<div class="clear"></div>
<div id="container">
<div id="registercontainerno">
<img src="images/logo.png" class="frontpagelogo">
<div class="meter" style="position:absolute; margin-left: 50px; margin-top: 20px;">
<div id="percentage" data-percent=""></div>
</div>
<br><br><br><br>
<h2 class="paragraphf">BookWizard Information</h2>
<?php
if(isset($_POST['password']))
{
$firstname = mysql_real_escape_string($_POST['firstname']);
$email = mysql_real_escape_string($_POST['email']);
$username = mysql_real_escape_string($_POST['username']);
$password = ($_POST['password']);
$lastname = mysql_real_escape_string($_POST['lastname']);
if(mysql_num_rows(mysql_query("SELECT * FROM users WHERE username='$username'")) == 0) {
mysql_query("INSERT INTO users (firstname, email, avatar, password, username, lastname)
VALUES ('$firstname', '$email', 'http://book-wizard.net/images/default.png',
'$password', '$username', '$lastname')");
$_SESSION['id'] = $username;
Header('Location: home.php');
}
else {
echo "Error, Please try again later.";
die();
}
}
?>
<form method="post">
<img src="/images/regi.jpg" align="right" style="margin-top: -100px; margin-right:
10px; border-radius: 5px;">
<p class="paragraphf">
<label>Username</label>
<input type="text" name="username" class="recommended" />
</p>
<p class="paragraphf">
<label>Password</label>
<input type="password" name="password" class="recommended" />
<h2 class="paragraphf">Personal Information</h2>
<p class="paragraphf">
<label>First name</label>
<input type="text" name="firstname" class="recommended" />
</p>
<p class="paragraphf">
<label>Last name</label>
<input type="text" name="lastname" class="recommended" />
</p>
<h2 class="paragraphf">Contact Information</h2>
<p class="paragraphf">
<label>Email Address</label>
<input type="text" name="email" class="recommended" />
<p class="input_bg">
<input type="submit" value="SIGN UP" class="buttonr blue"><a href="index.php"
class="buttonr orange">CANCEL</a>
<br><br>
</p>
</form>
<div class="clear"></div>
</div> <!-- END container -->
</div> <!-- END wrapper -->
</body>
</html>
在 global.php 中它确实有一个 session_start();... 不确定问题:S