Heb een script om van login naar stats te gaan genaamd start.php

maar als ik hem upload en probeer te gebruken komt er een fout te staan:
Sesion has expired

<?php include("header.php"); ?>

<font size=5 color=red>MAIN</font><br>

<?php
Print "<br>Welcome back, $stats[user]!";
?>
<br><br>New Players: <a href='help.php'>Learn the Basics!</a><br><br>Location of your Knock Out Link:
<?php
Print "<br><input type=text size=47 value=http://ghetto.woelmuis.nl/page.php?x=$stats[id]>";
?>

<br><div class="tiny">Knock out your friends for money!</div><br>
<?php
if ($_stat[trap] == 'on') {
print "<table class='darkbox'><tr><td align='center'>Your knock out link is currently <b>set</b>. You can <u>only</u> knock out your friends when your link is set.</a><br><br><a href='start.php?action=trapoff'><font color='#CC0000'>Click here to disarm your link.</font></a></td></tr></table>";
}
if ($_stat[trap] == 'off') {
print "<table class='darkbox'><tr><td align='center'>Your knock out link is currently <b>not set</b>. You can <u>only</u> knock out your friends when your link is set.</a><br><br><a href='start.php?action=trapon'><font color='#CC0000'>Click here to set your link.</font></a></td></tr></table>";
}
?>

<?php
if ($_action == trapon) {
print "<b><font color=yellow>Now you can knock out your friends!</font></B><br><br>";
mysql_query("update players set trap='on' where id=$stat[id]");
}
if ($_action == trapoff) {
print "<b>You turned <b>off</b> your link</B><br><br>";
mysql_query("update players set trap='off' where id=$stat[id]");
}
?>

<br><font color="#ffffff"><b><font size="+1"><a href=help.php>Learn How To Play</a></font></b></font></p>

<?php include("footer.php"); ?>
Zet eerst maar even code tags, dit is namelijk best wel irritant
Een paar dingen:
Wat staat er in header.php? en in footer.php? Ik zie hier namelijk niks met sessies staan.

En waar komen je variabelen (zoals $_action $_stap ) vandaan?

Verder is de manier waarop je met query's werkt niet aan te raden.
<?php
if ($_action == trapoff) {
print "<b>You turned <b>off</b> your link</B><br><br>";
mysql_query("update players set trap='off' where id=$stat[id]");
}?>
Wat gebeurt er als de query fout gaat?
Waar wordt gecontroleerd wat $stat[id] is? (ik gok trouwens op $stat['id'])
En haal je variabelen buiten uit je string.
<?php
if ($_action == trapoff && is_numeric($stat['id') ) { //we controleren meteen of id wel numeric is. Ik gok erop dat het bij jou namelijk een getal is
$r_result = mysql_query("update players set trap='off' where id=".$stat['id']);
if( $r_result ){
print "<b>You turned <b>off</b> your link</B><br><br>";
}else{
print '<b>Helaas er is wat fout gegaan.</b><br><br>';
}
}
?>
Dit is opzich wat basis (het kan nog uitgebreider, er wordt bijvoorbeeld niet gecontroleerd hoeveel regels er gewijzigd zijn. En een limit in je query kan ook handig zijn)

Reageren