It's a website for reviews and rating for Universities and College courses that people can share their opinions, suggestions, pros and cons etc, and rate it so others can decide which one to attend.
It's almost ready but when i uploaded it to my host (http://www.oryzhon.com) the website went retarded for some reason.
In the register, it's not "POSTING" (method="post") the username, name and email of the user, just the password.
Can't seem to find the error :O But it should be easy since I had a error (jacko helped me) that i was asking for an ID instead of a NAME property of the input -.- .
Here's the code:
Code: Select all
if(isset($_SESSION["USER"]))
{
//User already logged on (lol noob trying to edit the url)
echo "<h2>Já tens uma conta registada.</h2>";
}
else if(isset($_POST["register"]))
{
//Register
//Protect string is: /*
function ProtectString($string)
{
$string = trim(strip_tags(mysql_real_escape_string($string)));
return $string;
} */
$username = ProtectString($_POST["user"]);
$nome = ProtectString($_POST["nome"]);
$password = Encrypt(ProtectString($_POST["password"]));
$email = ProtectString($_POST["email"]);
Debug($username); //this outputs nothing
Debug($nome); //this outputs nothing
Debug($password); //this outputs encrypted password not sure if encrypted nothing lol
Debug($email); //this outputs nothing
$checkUsername = $db->Execute("SELECT id FROM users WHERE username=?", $username);
//$tempUser = mysql_query("SELECT id FROM users WHERE username='$username'");
if($checkUsername->EOF)
{
$checkEmail = $db->Execute("SELECT * FROM users WHERE email=?", $email);
//$tempEmail = mysql_query("SELECT id FROM users WHERE email='$email'");
if($checkEmail->EOF)
{
$db->Execute("INSERT INTO `users`(`username`, `password`, `nome`, `email`) VALUES (?, ?, ?, ?)", $username, $password, $nome, $email);
//account created
}
else
{
//theres a user with same email
}
$checkEmail->EOF;
}
else
{
//user with same username
}
$checkUsername->Close();
}
else
{
?>
<form method="POST" action="register.php">
<p class="label">Username</p>
<input class="register" type="text" name="user">
<p class="label">Name</p>
<input class="register" type="text" name="name">
<p class="label">Password</p>
<input class="register" type="password" name="password">
<p class="label">Email</p>
<input class="register" type="text" name="email">
<br>
<input type="submit" class="button" name="register">
</form>
<?php
}