I have made a successful registration system that inputs data into the database (phpmyadmin).
Now i am trying to tackle another major problem the login system. I have 2 parts of it done. Part 1 = the database to code link Part 2 = the form.
What I need is code to pull the data from the data base and authenticate it and either transfer to a home.php page or go back to the login page with an echo "Sorry your Log-in information is incorrect". I have tried this many times and all have failed miserably. Any code you can give me to login would be much appreciated. So the code i have now is just 2 parts not the third and I am hoping some one on here can help me through making this login page.
Here is my code so far:
<?
$db_selected = mysql_select_db('XXXXXX', $link);
$host="XXXX";
$db_user="XXXXX";
$db_password="XXXXXX";
$database="XXXXXXX";
$link = mysql_connect($host,$db_user,$db_password);
$link = mysql_connect($host,$db_user,$db_password);
if (!$link) {
die('Not connected : ' . mysql_error());
}
$db_selected = mysql_select_db($database, $link);
if (!$db_selected) {
die ('Can\'t use the DB : ' . mysql_error());
}
if (!$link) {
die('Could not connect: ' . mysql_error());
}
else
{
echo "Mysql Connected Successfully";
}
?>
<font color="red">
<h1>Log-In</h1>
<p>Please Enter your details below to Log-in</p>
<form method="post" action="home.php" name="loginform" id="loginform">
<fieldset>
<label for="username">Username:</label><input type="text" name="username" id="username" /><br />
<label for="password">Password:</label><input type="password" name="password" id="password" /><br />
<input type="submit" name="login" id="login" value="Log-In" />
</fieldset>
</form>
</font>
</div>
</HTML>