I’m having trouble getting my page to redirect. The are three things that could be wrong, I’m using the parameters wrong (redirecting to the same page, just with a different parameter), variables in the header function, or syntax error.
Here is the PHP code in “regvalid.php” (focus on the header functions).
<?php
require("includes/connect.php");
require("includes/redirect.php");
$resultUser = mysql_query("SELECT COUNT(*) FROM `sq_users` WHERE `Username` = "$_POST[user]"");
if ($resultUser > 1) header("Location:http://bsatroop878.org");
$resultEmail = mysql_query("SELECT COUNT(*) FROM `sq_users` WHERE `Email`= '$_POST[email]'");
if ($_POST['email'] >= 1) header("Location: '$root' . '$email_use'");
$passwd = $_POST[password1];
$passenc = md5($passwd);
$verifyBase = microtime();
$verify = md5($verifyBase);
$resultVerify = mysql_query("SELECT COUNT(*) FROM `sq_users` WHERE `Vaild` = '$verify'");
while ($resultVerify >= 1){
$verifyBase = microtime();
$verify = md5($verifyBase);
$resultVerify = mysql_query("SELECT COUNT(*) FROM `sq_users` WHERE `Vaild` = '$verify'");
}
$sql = "INSERT INTO `sq_users` (`Username`, `Passwd`, `Email`, `Valid`)
VALUES
('$_POST[user]', '$passenc', '$_POST[email]', '$verify')";
if(!mysql_query($sql,$con))
{
die('Error:' . mysql_error());
}
mysql_close($con);
header("Location: '$root' . '$no_error'");
?>
Here is the “redirect.php” code.
<?php
##Place all of you redirects in this file
#Change this variable to the root of you site. Ex. http://bsatroop878.org/, http://localhost/social/
#Make sure you end with a trailing slash
$root = "http://localhost/social/";
#File directs
$no_error = "regvalid.php?no_error=1";
$email_use = "regvalid.php?email_use=1";
$name_use = "regvalid.php?name_exists=1";
?>
Here is the HTML of “regvaild.php”.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Social Quests - Uh-oh!</title>
<link rel="stylesheet" type="text/css" href="css/docs.css" />
<link rel="shortcut icon" href="images/favicon.ico"/>
</head>
<body class="twoColLiqLtHdr">
<?php
if (isset($_GET['name_exists'])) {
require("includes/registration/username.php");
}
if (isset($_GET['email_use'])) {
require("includes/registration/email.php");
}
if (isset($_GET['no_error'])) {
require("includes/registration/no_error.php");
}
?>
</body>
</html>
I may have put to much information, but if you need more, just say so.
Thanks for the help!