Session problemer
Hej.Jeg har et problem med mit login system, for det kan sagtens logge ind med brugernavn og kodeord, men i det du går videre til en ny side bliver alle sessioner dræbt af en mærkelig årsag.
Har i en idé til hvad det kan være?
..............................index.php...............................
<?
session_start();
?>
<html>
<head>
<meta http-equiv="Content-Language" content="da">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Famwall - Familiens planlaegger</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<div align="center">
<table border="1" width="800" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" bordercolor="#FFFFFF">
<tr>
<td class="top1"></td>
<td class="top2"></td>
<td class="top3">Famwall</b></td>
</tr>
<tr>
<td class="information1"></td>
<td class="information2"></td>
<td class="information3"></td>
</tr>
<tr>
<td class="midt1"></td>
<td class="midt2">
<b>Navigation</b><br>
- <a href="?side=forside">Forside</a><br>
- <a href="?side=information">Information</a><br>
- <a href="?side=funktioner">Funktioner</a><br>
- <a href="?side=kontakt">Kontakt</a><br>
<br>
<b>Brugermenu</b><br>
<?
if(!$_SESSION['famwall001']){
echo "- <a href=?side=logon>Logon</a><br>";
echo "- <a href=?side=logon_opretbruger>Opret bruger</a><br>";
echo "- <a href=?side=logon_glemtkodeord>Glemt kodeord</a><br><br><br>";
}
else {
echo "menu for bruger<br>";
echo "- <a href=logon_logud.php>Log ud</a><br><br><br>";
}
?>
</td>
<td class="midt3">
<?php
if(isset($_GET['side']))
{
$page = $_GET['side'].".php";
if(file_exists($page))
{
include($page);
}
else
{
include('sidefejl.php');
}
}
else
{
include('forside.php');
}
?>
</td>
</tr>
<tr>
<td class="bund1"></td>
<td class="bund2">FamWall - Familiens planlægger</td>
<td class="bund3"></td>
</tr>
</table>
</div>
<body>
</body>
</html>
..............................Logon.php...........................
<?
session_start();
include('sql.php');
$loginnavn = $_POST['loginnavn'];
$pass = $_POST['pass'];
if($_SESSION['famwall001'])
{
include('logon_menu.php');
}
else if($loginnavn)
{
$query=mysql_query("SELECT * from famwall_profil WHERE username='$loginnavn' AND password='$pass'") or die(mysql_error());
if(mysql_num_rows($query)>0)
{
$row = mysql_fetch_array($query);
$_SESSION['famwall001']=$row['username'];
$_SESSION['fornavn']=$row['fornavn'];
$_SESSION['efternavn']=$row['efternavn'];
mysql_query("UPDATE famwall_profil SET lastOnline = NOW() WHERE username='" . $_SESSION['brugernavn'] . "'");
mysql_query("UPDATE famwall_profil SET logantal = logantal + 1 WHERE username='" . $_SESSION['brugernavn'] . "'");
include('logon_menu.php');
}
else {
echo "<script>alert('Forkert brugernavn eller adgangskode!'); </script>";
?>
<form method=post action=>
<input class="logon_felt" type="text" name="loginnavn" value='Brugernavn' onfocus="if(this.value=='Brugernavn')this.value='';" onblur="if(this.value=='')this.value='Brugernavn';" size="25"><br>
<input class="logon_felt" type="password" name="pass" value='Password' onfocus="if(this.value=='Password')this.value='';" onblur="if(this.value=='')this.value='Password';" size="25"><br>
<input class="logon_knap" type="submit" value="Login"> <button class="logon_knap" onclick="window.location.href='?side=logon_kodeord'">Glemt kodeord</button>
</form>
<?
}
}
else
{
?>
<form method=post action=>
<input class="logon_felt" type="text" name="loginnavn" value='Brugernavn' onfocus="if(this.value=='Brugernavn')this.value='';" onblur="if(this.value=='')this.value='Brugernavn';" size="25"><br>
<input class="logon_felt" type="password" name="pass" value='Password' onfocus="if(this.value=='Password')this.value='';" onblur="if(this.value=='')this.value='Password';" size="25"><br>
<input class="logon_knap" type="submit" value="Login"> <button class="logon_knap" onclick="window.location.href='?side=logon_kodeord'">Glemt kodeord</button>
</form>
<?
}
?>