<?php
include ("dbConfig.php");
if ( $_GET["op"] == "reg" )
{
$bInputFlag = false;
foreach ( $_POST as $field )
{
if ($field == "")
{
$bInputFlag = false;
}
else
{
$bInputFlag = true;
}
}
if ($bInputFlag == false)
{
die( "Problem with your registration info. "
."Please go back and try again.");
}
$q = "INSERT INTO `TABLENAME` (`name`,`password`,`email`) "
."VALUES ('".$_POST["name"]."', "
."PASSWORD('".$_POST["password"]."'), "
."'".$_POST["email"]."')";
$r = mysql_query($q);
if ( !mysql_insert_id() )
{
die("Error: User not added to database.");
}
else
{
Header("Location: register.php?op=thanks");
}
}
elseif ( $_GET["op"] == "thanks" )
{
echo "<h2>Success!</h2>";
echo "Thank you for registering, you should be able to login now.<br>";
echo "<a href='login.php'>Login</a>";
}
else
{
echo '<form action="?op=reg" method="POST" accept-charset="UTF-8">';
echo 'Username:<br><font color="red">*</font><input class="InputForm" type="text" name="name" id="name"><br>';
echo '<br>';
echo 'Email:<br><font color="red">*</font><input class="InputForm" type="text" name="email" id="email"><br>';
echo '<br>';
echo 'Password:<br><font color="red">*</font><input class="InputForm" type="password" name="password" id="password"><br>';
echo '<br>';
echo '<input type="checkbox" name="tick"><font color="gray" size="3"> I agree to the Terms of Use<br>';
echo '<br>';
echo '<button type="submit" name="submit" class="InputButton" value="Submit">Submit</button>';
echo '</form>';
}
?>
Hi, thanks for that login, it works great but now that's changed is there anything in this code that I need to change that they both function with each other because at the moment when I register and try to login it won't let me. Thanks again for the help.