Ok, so l am new to php ... sort of, now l have managed to throw this together:
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("test_database", $con);
if(isset($_POST['Login']))
{
if($_POST['username']!='' && $_POST['password']!='')
{
//Use the input username and password and check against 'users' table
$query = mysql_query('SELECT ID, username, Active FROM persons WHERE username = "'.mysql_real_escape_string($_POST['username']).'" AND password = "'.mysql_real_escape_string(md5($_POST['password'])).'"');
if(mysql_num_rows($query) == 1)
{
$row = mysql_fetch_assoc($query);
if($row['Active'] == 1)
{
$_SESSION['user_id'] = $row['ID'];
$_SESSION['logged_in'] = TRUE;
header("Location: members.php");
}
else {
$error = 'Your membership was not activated. Please open the email that we sent and click on the activation link';
}
}
else {
$error = 'Login failed !';
}
}
else {
$error = 'Please enter both your username and password to access your account';
}
}
?>
mmm, this didn't work, still displays a white page, due to my script it should open the file members.php if it logged in successfully shouldn't it? before it was adding extra stuff into my url bar too, what you have done has gotten rid of that, so that is good l guess...
Added a picture of the wampserver screen db, click image for larger view...