Anyone willing to help please go here:
http://www.mc0.cjb.net/login.html
I created a test accnt. User: test
Pass: test
Here is code for the validation page that is called when you hit the submit button:
validate.php
Code: Select all
<?php
session_start();
$db_user = 'dbuser';
$db_pass = 'dbpass';
$user_id = $_POSTї'user_id'];
$password = $_POSTї'password'];
$connection = mysql_connect('localhost', $db_user, $db_pass) or die(mysql_error());
mysql_select_db('mc0', $connection) or die(mysql_error());
$query = "select * from vUsers
where user_id='$user_id' AND password='$password'";
$result = mysql_query($query, $connection) or die('error making query');
$affected_rows = mysql_num_rows($result);
if ($affected_rows == 1) {
print '<html><head><meta http-equiv="refresh" content="1;url=test.php"><title>VALIDATED</title></head><body bgcolor="black" text="999999"><center>Succesfully Logged In</center></body></html>';
session_register('username');
$_SESSIONї'username'] = $user_id;
}
else
{
print '<html><head><meta http-equiv="refresh" content="2;url=login.html"><title>NOT VALIDATED</title></head><body bgcolor="black" text="999999"><center>Failed To Log In</center></body></html>';
}
?>but the problem I think occurs when you try to go to a page that has code in it that checks to see if you are validated. When you correctly login with the username test, and pass test, you go to test.php where this file is included to check to see if user is validated:
<?php require_once("check_user.php");?>
Code for check_user.php:
Code: Select all
session_start();
if(empty($_SESSIONї'username']))
{
die('<html><body bgcolor="black" text="999999"><div align="center">It appears that
you have not logged in. Please do so by going to the <a href="login.html">Login Page</a>.<br>
If you feel that you have recieved this message by error please email me at<br>
f0cc@charter.net .</div></body></html>');
}
?>