Ingen info i sessions
Login.php<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form2" method="post" action="login-test.php">
<font size="1" face="Verdana, Arial, Helvetica, sans-serif"><span class="font"><b><br>
</b>Bruger<b><br>
<input name="brugernavn" type="text" id="brugernavn" style="font-size:10px; " size="20" >
<br>
</b>Password <b><br>
<input name="password" type="password" id="password" style="font-size:10px; " size="20" >
<br>
<br>
<input name="Submit" type="submit" id="Submit" value="Login">
</b> </span></font>
</form>
</body>
</html>
Login-test.php
<?
session_start();
mysql_connect("..", "", "");
mysql_select_db("");
if(!isset($_POST['Submit'])) {
echo "Du skal komme fra login.php";
}else{
$resultat = mysql_query("SELECT id FROM bruger WHERE Brugernavn =
'$brugernavn' AND Password = '$password'");
$number = mysql_num_rows($resultat);
if($number == 1) {
$get_id = mysql_fetch_array($resultat);
$q = mysql_query ("SELECT * FROM bruger WHERE id='".$get_id['id']."'");
$time = time();
while ($r = mysql_fetch_array($q)) {
$_SESSION['id'] = $r[id];
$_SESSION['login'] = 1;
$_SESSION['Brugernavn'] = $r[brugernavn];
$_SESSION['Password'] = $r[password];
$_SESSION['rang'] = $r[rang];
$_SESSION['tid'] = $tid;
}
}
if ($_SESSION['rang'] == 'admin') {
mysql_query("UPDATE bruger SET online = online + 1 WHERE id='".$get_id['id']."'");
header("Location: admin.php");
}
if ($_SESSION['rang'] == 'bruger') {
mysql_query("UPDATE bruger SET online = online + 1 WHERE id='".$get_id['id']."'");
header("Location: bruger.php");
} else { echo"De indtastede oplysninger er ikke korrekte";
}
}
?>
admin.php
<?
session_start();
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
Jeg er Admin <? echo 'jeg er admin'; ?> <a href="Logud%20-%20Lavet%20af%20Kristian.php">logud</a>
<?
mysql_connect("..", "", "");
mysql_select_db("");
$q = mysql_query("SELECT * FROM bruger WHERE id = '".$_SESSION['id']."'") or die (mysql_error());
while ($r = mysql_fetch_array($q)) {
?>
<br>
Rang: <? echo "$r[rang]"; ?> <br>
<br>
<br>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="20%" id="AutoNumber3">
<tr>
<td width="100%" bgcolor="#CCCCCC"><font face="Verdana" size="1">Brugerens
Nick box</font></td>
</tr>
<tr>
<td width="100%"><font face="Verdana" size="1"> <br>
Rediger bruger<br>
Send post<br>
Indbakke<br>
Udbakke <br>
<br>
Min link database<br>
Tilføj fil<br>
Tilføj forum indlæg<br>
Tilføj Nyhed</font></td>
</tr>
</table>
<br>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="157" id="AutoNumber1">
<tr>
<td width="155" bgcolor="#CCCCCC"> <p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" size="1">
Online venner/Homies</font></td>
</tr>
<tr>
<td width="155"><font face="Verdana" size="1" color="#666666">Martin
: 123.412.1.2<br>
Thomas : 321.53.2.1<br>
Jens : 451.463.7.9<br>
Kurt : 25.43.123.1</font></td>
</tr>
</table>
<p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" size="1"> </font></p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="157" id="AutoNumber2">
<tr>
<td width="155" bgcolor="#CCCCCC"> <p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" size="1">
Personlig statistik</font></td>
</tr>
<tr>
<td width="155"><font face="Verdana" size="1">Online tid: <font color="#666666">1400
min</font><br>
Gange online<font color="#666666">: </font><? echo $r[online]; ?><br>
Total send post<font color="#666666">: 12</font><br>
Forum indlæg<font color="#666666">: 3</font><br>
Forum svar<font color="#666666">: 5<br>
</font>Points<font color="#666666">: 500</font><br>
Profil visninger<font color="#666666">: 18<br>
</font>filer tilføjet<font color="#666666">: 2<br>
</font>Artikler<font color="#666666"> </font>skrevet<font color="#666666">:
1<br>
</font>Antal nyheder<font color="#666666">: 5</font></font></td>
</tr>
</table>
<br>
<font face="Verdana" size="1"><? } ?></font>
</body>
</html>
vis jeg logger ind virker sesions ikke første gang vis så jeg trykker tilbage og fremad igen så virker det jeg tror at det har noget med at gøre at den ikke gemmer noget første gang eller noget i den stil