This doesn't seem to be working. I have the session start on the index.php page.
Header.php is included on index.php. It is supposed to show the login form IF but, it always shows the login form. Even though the sessions exsist.
Because the header page is included, I tried the if thing with "session_start()" being there and NOT being there.
Taken from header.php ±
<?
if ($_SESSION['username'])
{
?>
<?php
$link = mysql_connect("localhost", "zingbats", "my pwl")
or die("Could not connect");
mysql_select_db("tycooneden_com") or die("Could not select database");
$query = "SELECT * FROM phpbb_users WHERE username = '$_SESSION[username]' AND WHERE user_password = md5('$_SESSION[password]')";
$result = mysql_query($query) or die("Query failed");
$foo=mysql_fetch_array($result);
/* Start the clan defining */
$user_points=$foo['user_points'];
mysql_close($link);
?>
<tr>
<td width="100%" bgcolor="#C0C0C0">
Welcome $_SESSION['username'], you have £$user_points, get spending and earning!</td>
</tr>
<?
}
else
{
?>
<tr>
<td width="100%" bgcolor="#C0C0C0">
<form method="POST" action="index.php">
<div align="left">
<table border="0" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" width="53%" id="AutoNumber5">
<tr>
<td width="17%"><b><i><font size="4" color="#333333">Login:</font></i></b><font color="#333333"><b> </b></font><font size="4" color="#333333"> </font></td>
<td width="15%"><font color="#333333"><b> User:</b></font></td>
<td width="19%"><input type="text" name="username" size="20"></td>
<td width="17%"><font size="4" color="#333333"> Password:</font></td>
<td width="16%"><input type="password" name="password" size="20"></td>
<td width="16%"><input type="submit" value="Login" name="B1"></td>
</tr>
</form>
</table>
</div>
</td>
</tr>
</table>
</center>
</div>
<?
}
?>
At the top of index.php:
<?php
session_start();
header("Cache-control: private");
$name = $_POST['username'];
session_register('username');
$_SESSION['username'] = $nope;
$secondname = $_POST['password'];
session_register('password');
$_SESSION['password'] = $noper;
?>