Hello, I'm new here but mainly registered because of my PHP registration script I written isn't working...
I'm new to PHP by the way. When I press submit on the form, it just goes back to the form again...
Below is my script.
<?php
/* PHP Registeration Script, Allowing new Accounts to be Registered
* Written By: freezicx
* Year Written: 2011
* Last PHP Update: 2011
*/
include("config.php");
$username = strip_tags($_POST['username']);
$password = md5(strip_tags($_POST['password']));
$vpassword = md5(strip_tags($_POST['vpassword']));
$email = strip_tags($_POST['email']);
$user_ip = $_SERVER['REMOTE_ADDR'];
$reg_date = date("d-m-Y");
if(isset($_POST['register']))
{
{
if (!$username || !$password || !$email || !$vpassword)
{
echo "You must fill out all fields.";
} else {
}
$dupe1 = mysql_num_rows(mysql_query("select * from users where user='$username'"));
if ($dupe1 > 0)
{
echo "Sorry, that Username is already in use.";
} else {
}
$dupe2 = mysql_num_rows(mysql_query("select * from users where email='$email'"));
if ($dupe2 > 0)
{
echo "Sorry, that Email is in use.";
} else {
}
if ($password != $vpassword)
{
echo "Your Passwords do not match.";
} else {
}
mysql_query("insert into users (username, email, password, user_ip, reg_date)
values('$username','$email','$password','$user_ip','$reg_date')")or die("Error adding account information into database.");
echo 'You are registered successfully, you may now <a href="index2.php">login to your account</a>.';
}}
?>
<html>
<head>
<title>LevelZ - Register an Account</title>
</head>
<body>
<form action="register.php" method="post" name="register">
<table>
<tr><td>Username:</td><td><input type="text" name="username"></td></tr>
<tr><td>Email:</td><td><input type="text" name="email"></td></tr>
<tr><td>Password:</td><td><input type="password" name="password"></td></tr>
<tr><td>Verify Password:</td><td><input type="password" name="vpassword"></td></tr>
<tr><td colspan=2 align=center><input type="submit" id="register" value="Join!"></td></tr>
</table>
</form>
</body>
</html>
As I'm new to PHP, I can't see the error....
Thanks in advance any way!