Og admin filen er her:
<?php
if ($admin == "true") {
if(isset($_SESSION['myusername']))
{
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<a href="?admin=logout" class="textfield">Log ud</a>
<?
} else {
?>
<form action="?admin=challenge" method="post" name="form1">
<p> </p>
<p><span class="indhold">Username: </span>
<input name="myusername" type="text" class="textfield" id="myusername" />
</p>
<p><span class="indhold">Password:
</span>
<input name="mypassword" type="text" class="textfield" id="mypassword" />
<input name="Submit" type="submit" class="textfield" value="Login" />
</p>
</form>
<p>
<?
}
} elseif ($admin == 'challenge') {
ob_start();
$myusername = $_POST['myusername'];
$mypassword = $_POST['mypassword'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql = "SELECT * FROM users WHERE username='$myusername' and password='$mypassword'";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
if($count ==1){
$_SESSION['myusername'] = $mypassword;
$_SESSION['mypassword'] = $mypassword;
?>
</p>
<p><span class="indhold">Login godkendt</span><br />
<br />
<a href='?admin=true' class="indhold"><< Gå til administration</a>
<br /><br /><h3>ELLER...<br /><br /><a onclick="window.open('
http://kokkemad.dk/editor.php','Rediger tekst','width=650,height=1000');return false;" href="
http://kokkemad.dk/editor.php">KLIK HER...</a><h3></a>for at redigere tekstboks nederst på siden.
<?
}
else {
?>
</p>
<p><span class="indhold">Forkert brugernavn eller kodeord</span>
<?
}
ob_end_flush();
} elseif
($admin == 'logout') {
session_start();
session_destroy();
?>
</p>
<p><span class="indhold">Du er nu logget ud</span><br /><br />
<a href='/' class="indhold"><< Gå til forsiden</a>
<br /><br /><h3>ELLER...<br /><br /><a onclick="window.open('
http://kokkemad.dk/editor.php','Rediger tekst','width=650,height=700');return false;" href="
http://kokkemad.dk/editor.php">KLIK HER...</a><h3></a>for at redigere tekstboks nederst på siden.
<?
}
?>
</p>
</span>