Code: Selecteer alles
<?PHP
ob_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Xibitz Quiz V1.0</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<?PHP
include("config.inc.php");
////Inloggen..
if(!isset($_COOKIE['passw']) OR $_COOKIE['passw'] != $passw){
if(!isset($_POST[submit])){
echo "<center><FORM METHOD=POST>
<input type=\"password\" name=\"passw\" value=\"wachtwoord\">
<input type=\"submit\" name=\"submit\" value=\"login\">
</FORM></center>";
} else {
if ($_POST[passw] != $pass){
echo "verkeerd wachtwoord!";
} else {
$passw = $_POST[passw];
setcookie("passw", $passw,time()+60*60*24*4);
echo "Succesvol ingelogt! Wacht even...<head><meta http-equiv=\"refresh\" content=\"3;url=admin.php\"></head>";
}
}
exit;
}
////////////
// Voeg vraag toe
if (isset($_POST[addq])) {
if (!isset($_POST[vraag]) || empty($_POST[vraag])){
echo "Er is geen vraag ingevult!"; exit;
} else {
$insert = "INSERT INTO qz_vragen (id, vraag) VALUES
('','".$_POST[vraag]."')";
mysql_query($insert) or die(mysql_error());
echo "<b>".$_POST[vraag]."</b>, deze vraag is succesvol toegevoegd!"; exit;
}
}
// Voeg antwoord toe
if (isset($_POST[addv])) {
if (!isset($_POST[antwoord]) || empty($_POST[antwoord])){
echo "Er is geen antwoord ingevult!"; exit;
} else {
$insert = "INSERT INTO qz_antwoorden (id, antwoord, bij, goed) VALUES
('','".$_POST[antwoord]."','".$_POST[bij]."','0')";
mysql_query($insert) or die(mysql_error());
echo "<b>".$_POST[antwoord]."</b>, deze antwoord is succesvol toegevoegd!"; exit;
}
}
// Select goede
if(isset($_GET[sel])){
$sql = mysql_query("SELECT * FROM qz_antwoorden WHERE bij='".$_GET[b]."'");
while($q = mysql_fetch_array($sql)) {
mysql_query("UPDATE qz_antwoorden SET goed='0' WHERE id='".$q[id]."'");
}
mysql_query("UPDATE qz_antwoorden SET goed='1' WHERE id='".$_GET[u]."'");
echo "Het goede antwoord is geselecteerd!"; exit;
}
// Dell vraag
if(isset($_GET[dellv])){
mysql_query("DELETE FROM qz_vragen WHERE id='".$_GET["u"]."'");
mysql_query("DELETE FROM qz_antwoorden WHERE bij='".$_GET["u"]."'");
echo "Vraag en de bijbehorende antwoorden zijn verwijdert!"; exit;
}
// Dell Antwoord
if(isset($_GET[della])){
mysql_query("DELETE FROM qz_antwoorden WHERE id='".$_GET["u"]."'");
echo "Antwoord is verwijdert!"; exit;
}
// Leeg score lijst
if(isset($_GET[sl])){
mysql_query("DELETE FROM qz_score");
echo "De score lijst is geleegd!"; exit;
}
//main
echo "<FORM METHOD=post target=\"_blank\"><TABLE WIDTH=90%><TR><td class=\"header\">Voeg toevoegen:</td></TR>";
echo "<tr><td><input type=\"text\" name=\"vraag\"></td></tr>";
echo "<tr><td><input type=\"submit\" name=\"addq\" value=\"Voeg vraag toe\"></td></tr></table></form>";
echo "<hr class=\"header\" width=\"90%\" align=\"left\"/>";
//question beheer
$sql = mysql_query("SELECT * FROM qz_vragen ORDER by id DESC");
if(mysql_num_rows($sql) == 0) {
echo "
<table width=\"90%\">
<tr><td class=\"header\"><b>Fout</b></td></tr>
<tr><td>Er zijn geen vragen gevonden!</td></tr>
</table>"; exit;
}
echo "<table width=\"90%\">";
while($show = mysql_fetch_array($sql)) {
$antwoord = mysql_query("SELECT * FROM qz_antwoorden WHERE bij='".$show[id]."' ORDER by id DESC");
echo "<tr><td class=\"header\">".$show[vraag]."</td><td class=\"header\" width=\"15\"><a href=\"?dellv&u=".$show[id]."\" target=\"_blank\"><img src=\"del.gif\" border=\"0\"></a></td></tr>";
while($antw = mysql_fetch_array($antwoord)) {
if($antw[goed] == "1") {
echo "<TR><TD>".$antw[antwoord]."</TD><TD width=\"15\"><img src=\"goed.gif\" border=\"0\"></td><td><a href=\"?della&u=".$antw[id]."\" target=\"_blank\"><img src=\"del.gif\" border=\"0\"></a></td></TR>";
} else {
echo "<TR><TD>".$antw[antwoord]."</TD><TD width=\"15\"><a href=\"?sel&u=".$antw[id]."&b=".$antw[bij]."\" target=\"_blank\"><img src=\"select.gif\" border=\"0\"></a></td><td><a href=\"?della&u=".$antw[id]."\" target=\"_blank\"><img src=\"del.gif\" border=\"0\"></a></td></TR>";
}
}
echo "<FORM METHOD=post target=\"_blank\"><TR><td><input type=\"text\" name=\"antwoord\"><input type=\"hidden\" name=\"bij\" value=\"".$show[id]."\"></td></TR>";
echo "<tr><td><input type=\"submit\" name=\"addv\" value=\"Voeg antwoord toe\"></td></tr></form>";
}
echo "<tr><td class=\"header\"><a href=\"?sl\" target=\"_blank\">Leeg score lijst</a></td></tr></table>";
?>
</body>
</html>
<?PHP
ob_end_flush();
?>
ziet iemand dus de fout ik zie hem namelijk niet.