<?php
//Register 1.0.1
include("function.php");
$con = connect();
$num = 0;//Not neccesary at point Extra to add things later, or double check.
if (isset($_POST['submit']))
{
if($_POST['username'] !== '' && $_POST['password1'] !== '' && $_POST['password2'] !== '')
{
//all var are here
if($_POST['password1'] == $_POST['password2'])
{
$username = safe($_POST['username']);
$password = safe($_POST['password1']);
$password = password($password);
$query = mysql_query("SELECT * FROM user WHERE username = '$username'");
$edie = mysql_affected_rows($query);
if ($edie = 0)
{
$query = mysql_query("INSERT INTO user (username, password) VALUES ('$username', '$password')") or exit("Failure to insert!");
header("Location: home.php");
}
else
{
}
}
else
{
// Password not equal
}
}
else
{
// not all var are here but submit
}
}
// Continue to HTML
?>
<HTML>
<form action="register.php" method="post">
Username:<input type="text" name="username">
<br>
Password:<input type="password" name="password1">
<br>
Password Check:<input type="password" name="password2">
<br>
<input type="submit" name="submit" value="Register!">
</HTML>
I did this over and over, but I have to go, and haven't done PHP in about 9 months, so I will be able to reply when I am back.(7 EST)
Thank you.