Hi
First of all i made 3 files: login.htm,redirect.php,hhqpics.php
login.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Login</title>
</head>
<body><br><br><br><br>
<center>
<table width="300" cellspacing="1" border="1"><form method="post" action="redirect.php">
<tr><td bgcolor="darkblue"><center><font color="white">Please use your HHQPics username to log in</font></center></td></tr>
<tr><td><center><input type="text" name="member_name"></center></td></tr>
<tr><td><center><input type="submit" value="Log in"></center></td></tr>
</form></table>
</center>
</body>
</html>
redirect.php
<?php
$db = mysql_connect('localhost','user','pass') or die ("connexion error");
mysql_select_db('databasename',$db) or die ("error connection to database");
$res = mysql_query("SELECT * FROM inv_members WHERE name='$member_name'");
$exist = mysql_num_rows($res);
if(!$exist) {
echo "<center>You must create an account at <a href=http://www.bla.com/>HHQPics</a></center>";
header('location: index.php');
}
else {
//*******************************
//Username exist!
//*******************************
session_start();
session_register("member_name");
header('location: hhqpics.php');
}
mysql_close()
?>
hhqpics.php
<?php
session_start();
if ( !session_is_registered("member_name") ) {
//*********************
//not logged in
//*********************
echo "<center>You must create an account at <a href=http://www.bla.com/>HHQPics</a></center>";
header('location: index.php');
}
else {
include("list.php");
}
?>
I assume that the mysql part is working fine because i can reach the hhqpics.php page without problems. But once im at the hhqpics.php page it returns the "not logged in" part which means that there's something wrong with the session registration