I’m making a registration form and I want to set a web page up a certain way depending on the action (i.e User name in use, E-mail in use, registration successful). Does anyone have any tips on how to do that. I know the header function won’t work because it’s not the first thing on the page.
<?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://localhost/social/eregister.php");
$resultEmail = mysql_query("SELECT COUNT(*) FROM `sq_users` WHERE `Email`= "$_POST[email]"");
if ($_POST['email'] == $resultEmail) header("Location:http://localhost/social/eregister.php");
$passwd = $_POST[password1];
$passenc = md5($passwd);
$verifyBase = microtime();
$verify = md5($verifyBase);
$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);
?>
For an example of what I’m talking about, go to Facebook and log in. Don’t use your correct password. You’ll see that it takes you to “login.php” with a parameter “?login_attempt=1”. When you take the parameter away, the page shows up differently. I want something like that, but I don’t know how to do the parameters. Thanks for the help (PS: I’m a beginner at PHP).