Hi - I wonder if anbody can help me or point me the right direction?
I have created a database in MySQL which contains a list of registered customers i.e Firstname, Lastname, Username & password.
I have also created a login script which the customer can enter their username & password and if correct they get a successful login page.
Does anybody know how to make it so that each customer are redirected to their own private page?
This is my current php code:-
<?php $username = $POST['username'];
$password = $POST['password'];
$self = $SERVER['PHP_SELF'];
$referer = $SERVER['HTTP_REFERER'];
if( ( !$username ) or ( !$password ) )
{ header( "Location:$referer" ); exit(); }
$conn = @mysql_connect( "localhost", "devin", "password" )
or die ( "Could not connect" );
$rs = @mysql_select_db( "my_database", $conn )
or die( "Could not select database" );
$sql="select * from users where user_name=\"$username\"
and password = password( \"$password\" )";
$rs = mysql_query( $sql, $conn )
or die( "Could not execute query" );
$num = mysql_numrows( $rs );
if( $num != 0 )
{ $msg = "Welcome $username - your log-in succeeded!"; }
else
{ header( "Location:$referer" ); exit(); }
?>
<html> <head><title>Log-In Authenticated</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
}
body {
background-color: #FFFFFF;
margin-left: 1cm;
margin-right: 0cm;
}
-->
</style></head>
<body> <?php echo( $msg ); ?> </body> </html>