Als ik het onderstaande script in mijn source zet dan wordt opeens het rechter menu met de databasegegevens (zoals health, geld, naam, etc.) niet meer geladen (niet getoond), ga ik naar een ander script dan is alles opeens weer terug.
Weet iemand wellicht wat er in dit script voor zorgt dat dit gebeurt want ik zie niet echt iets vreemds (op de onduidelijke opbouw na dan
PHP
<?
$sql = mysql_query("SELECT * FROM `users` where `login`='$data->login'");
$data = mysql_fetch_assoc($sql);
?>
<div id="contentbar_main">
<div id="notice_container"></div>
<div id="cbs"><div class="cb">
<h1>Detective</h1><p></p>
<table width='90%' cellpadding='0' cellspacing='0'>
<td width=40% valign=top>
<table width='90%' cellpadding='2' cellspacing='1'>
<?php
print <<<ENDHTML
<?php
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`tijd`) AS `tijd`,0 FROM `detective`");
while($delete = mysql_fetch_assoc($dbres)){
$tijd = $delete[tijd]+$delete[uren]*60*60-time();
}
print <<<ENDHTML
<form method="POST">
<table width=80%>
<tr><td class="subTitle"><b>Informatie</b></td></tr>
<tr><td class="mainTxt">Voordat je een poging kunt doen om iemand te vermoorden moet
je hem/haar eerst laten opsporen door een detective. Nadat
de detective hem/haar heeft gevonden, kun je naar hetzelfde
land reizen om hem/haar te vermoorden.<br />
1 uur zoeken kost je $<table width='90%' cellpadding='0' cellspacing='0'>
kost het je $80.000
</td>
</td></tr>
</table>
<tr><td class="subTitle" colspan=2><b>Vermoorden</b></td></tr>
<tr><td class="mainTxt" colspan=2><table colspan=2>
<form method="POST">
<td align="left">Persoon:</td>
<td><input class="mod_submit"type="text" name="naamd" /></td>
</tr>
<tr class="inhoud">
<td align="left">Aantal uren:</td>
<td><select size="1" name="uren">
<option selected value="1">1 uur</option>
<option value="2">2 uren</option>
<option value="3">3 uren</option>
<option value="4">4 uren</option>
<option value="5">5 uren</option></td>
</td>
</tr>
<tr class="inhoud">
<td align="left" valign="top">Landen:</td>
<td>
<table align="left">
<tr>
<td><input class="mod_submit"type="checkbox" name="zProvincie1" /> NederLand</td>
<td><input class="mod_submit"type="checkbox" name="zProvincie2" /> Frankrijk</td>
</tr>
<tr>
<td><input class="mod_submit"type="checkbox" name="zProvincie3" /> Cuba</td>
<td><input class="mod_submit"type="checkbox" name="zProvincie4" /> Rusland</td>
</tr>
<tr>
<td><input class="mod_submit"type="checkbox" name="zProvincie5" /> Australie</td>
<td><input class="mod_submit"type="checkbox" name="zProvincie6" /> VS</td>
</tr>
<tr>
<td><input class="mod_submit"type="checkbox" name="zProvincie8" /> Alle landen</td>
</tr>
<tr>
</tr>
<td class=sub align=left><input class="mod_submit"type="submit" value="Zoek persoon" name="submitt"></td></tr>
</td></tr></table>
</form>
</td></tr>
</td>
</tr>
</form>
</form>
ENDHTML;
if(isset($_POST['submitt'])) {
$naam = $_POST['naamd'];
$naam1 = mysql_query("SELECT * FROM `users` WHERE `login`='$naam'");
$naam1 = mysql_num_rows($naam1);
$uren = $_POST['uren'];
if ($uren < 1 )
{
echo "Cheaten is niet toegestaan!";
mysql_query("INSERT INTO `logs`(`time`,`IP`,`forwardedFor`,`login`,`person`,`code`,`area`) values(NOW(),'{$_SERVER['REMOTE_ADDR']}','$forwardedFor','{$_SESSION['login']}','{$_SESSION['login']}','0','cheaten met detective')") or die(mysql_error());
exit;
}
if($_POST['naamd'] ==""){
print "<table width=100%><tr><td class=maintxt>Je moet wel een naam invullen.</tr></td>";
}
elseif($naam1 ==0){
print "<table width=100%><tr><td class=maintxt>De naam die je hebt ingevoerd bestaat niet.</tr></td>";
}
elseif($uren*20000 > $data[contant]){
print "<table width=100%><tr><td class=maintxt>Zoveel geld heb je niet op zak.</tr></td>";
}
else{
$geld = $uren*20000;
$vind1 = 5/$uren;
$vind1 = round($vind1);
$vind1 = rand(0,$vind1);
$vind = rand(900,$uren*60*60);
mysql_query("INSERT INTO `detective` (`tijd`,`uren`,`zoeker`,`naam`,`status`,`vind`,`land`) values(NOW(),'$uren','$data[login]','$naam','0','$vind','0')");
mysql_query("UPDATE `users` SET `contant`=`contant`-'$geld' WHERE `login`='$data[login]'");
print "<table width=100%><tr><td class=maintxt>De detective is bezig met zoeken.</tr></td>";
}
}
print "</td>
";
if(isset($_POST['wis'])) {
$id = $_POST['id'];
mysql_query("DELETE FROM `detective` WHERE `id`='$id'");
print "<table width=100%><tr><td class=maintxt>Je hebt de detective ontslagen.</tr></td>";
}
if( $_POST['wissen'] ){
mysql_query("DELETE FROM `detective` WHERE `zoeker`='$data[login]'");}
print " <form method=post>";
print "
<table width='80%' cellpadding='2' cellspacing='1'>
<tr><td class=subtitle colspan=4>huidige zoekacties</td></tr>
<tr><td class=maintxt><b>Naam:</b></td><td class=maintxt><b>Tijd bezig:</b></td><td class=maintxt><b>Land:</b></td><td class=maintxt width=50><b>annuleren:</b></td></tr>";
$detectives2 = mysql_query("SELECT *,UNIX_TIMESTAMP(`tijd`) AS `tijd`,0 FROM `detective` WHERE `zoeker`='$data[login]'");
while($detectives = mysql_fetch_assoc($detectives2)) {
$tijd = $detectives[tijd]+$detectives[uren]*60*60-time();
$tijd2 = $tijd-3600;
$tijd1 = date("H:i:s", "$tijd2");
$zoeker = mysql_query("SELECT * FROM `users` WHERE `login`='$detectives[naam]'");
$zoeker = mysql_fetch_assoc($zoeker);
$land1 = array("Bezig","$city_1","$city_2","$city_3","$city_4","$city_5","$city_6");
$land = $land1[$detectives[land]];
if($detectives[tijd] + $detectives[vind] < time() && $detectives[vind] !=0){
mysql_query("UPDATE `detective` SET `land`='$zoeker[land]', `status`='1' WHERE `id`='$detectives[id]'");
}
if($tijd <1){
$tijd1 = "Gefaald";
}
if($detectives[status] ==1){
$tijd1 = "Gevonden";
}
print " <tr><td class=maintxt>{$detectives[naam]}</td> <td class=maintxt><b>{$tijd1}</b></td> <td class=maintxt>{$land}</td><td class=maintxt><input class=\"mod_submit\"type=radio name=id value={$detectives[id]}></td></tr>";
}
print " <tr><td class=\"maintxt\" colspan=4><input class=\"mod_submit\" type=\"submit\" value=\"Ontslaan!\" name=\"wis\"></td></tr>";
?>
</div></div></div>
</table>
</table></table></table>
Toon Meer