But there seems to be something wrong in my code because no matter what the user enters for password, the results of [if ($checkpasswordresult != $pw)] always occur.
Any help is appreciated!
Code: Select all
<?php
$con = mysql_connect("**","***","***");
mysql_select_db("mydatabase") or die( "Problems connecting to the database...");
$user = $_POST["user"];
$pw = $_POST["pw"];
$email = $_POST["email"];
//check username
$checkusername = mysql_query("SELECT user FROM mydatabase WHERE user = '$user'");
$numuserrows=mysql_num_rows($checkusername);
if ($numuserrows==0)
{
echo "Sorry, we can't find that username. Be sure you typed it correctly.";
die;
}
//check password
$checkpassword = mysql_query("SELECT pw FROM mydatabase WHERE user = '$user'");
$checkpasswordresult = mysql_fetch_object($checkpassword);
if ($checkpasswordresult != $pw)
{
echo "Password wrong.";
die;
}Code: Select all
and