Puha, sikke en omgang. Et godt trick er ALTID at formaterer sin kode mens man laver den. Det bliver hurtigt uoverskueligt.
Jeg har formateret koden som jeg plejer at gøre det, med indryk efter hvert tag og tilbage til udgangspunktet efter afsluttende tag.
<?php
session_start();
include("connect.php");
if($_POST['submit'])
{
$query = mysql_query("SELECT * FROM nepitoz_brugere WHERE brugernavn = '$_POST[brugernavn]'") or die(mysql_error());
$look = mysql_fetch_array($query);
if($_POST[brugernavn] == "")
{
echo "<meta http-equiv=\\"refresh\\" content=\\"0;url=?confirm=true\\">";
}
else
{
if($_POST[adgangskode] == "")
{
echo "<meta http-equiv=\\"refresh\\" content=\\"0;url=?confirm=true\\">";
}
else
{
if($look[aaben] == "Nej")
{
print "<script>alert('Brugeren du prøver og logge ind med er muligvis lukket. Er dette en fejl? Kontakt en ejer for mere infomation!')</script>";
}
else
{
if($look[aktivert] == "Nej")
{
print "<script>alert('Brugeren du prøver og logge ind med er muligvis ikke aktivert. Kan du ikke aktivere din bruger fra den aktiveringskode vi sendte dig? Eller har du måske slet ikke fået nogen mail? \\n\\nKontakt en ejer, for mere infomation!')</script>";
}
else
{
$navn = $_POST['brugernavn'];
$kode = $_POST['adgangskode'];
if(!empty($navn) && !empty($kode))
{
$query = mysql_query("SELECT * FROM nepitoz_brugere WHERE brugernavn = '$navn' AND adgangskode = '$kode'") or die(mysql_error());
if(mysql_num_rows($query) == 1)
{
$row = mysql_fetch_array($query);
$_SESSION['loggetind'] = "yes";
$_SESSION['Brugernavn'] = $row['brugernavn'];
$_SESSION['ID'] = $row['id'];
$tid = time();
$now = date("d-m-y G:i");
$ip = $_SERVER[REMOTE_ADDR];
mysql_query("UPDATE `nepitoz_brugere` SET status = 'Online', sidstset = '$now', logintid = '$tid' WHERE id = '$_SESSION[ID]'") or die(mysql_error());
header("location: ?mode=ok");
exit;
}
else
{
echo "<meta http-equiv=\\"refresh\\" content=\\"0;url=?confirm=true\\">";
}
}
}
}
}
}
}
else
{
?>
<html>
<head>
<link rel="Stylesheet" HREF="index.css" TYPE="text/css">
<meta http-equiv="Content-Language" content="da">
<title>index</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<?php
if($_GET[confirm] == "true"){
?>
<script language="JavaScript">
function getconfirm () {
confirm("Brugernavn og adgangskode passer ikke sammen!\\nHvis du har glemt din adgangskode kan du trykke på 'Glemt Adgansskode' i menuen hvor man logger ind")
}
</script>
<?php
}
?>
</head>
<body scroll="auto" style="margin-top:25px;margin-bottom:25px;"<?php
if($_GET[confirm] == "true"){
echo " onLoad=\\"getconfirm()\\">";
}else{
echo ">";
}
?>
</body>
<tr><td valign="top">
<body bgcolor="#F1F0EE" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="text-align: center">
<table id="Table_01" width="881" height="701" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="7">
<img src="images/index_01.gif" width="880" height="18" alt="">
</td>
<td>
<img src="images/spacer.gif" width="1" height="18" alt="">
</td>
</tr>
<tr>
<td rowspan="9">
<img src="images/index_02.gif" width="14" height="682" alt="">
</td>
<td colspan="5">
<img src="images/index_03.gif" width="850" height="76" alt="">
</td>
<td rowspan="9">
<img src="images/index_04.gif" width="16" height="682" alt="">
</td>
<td>
<img src="images/spacer.gif" width="1" height="76" alt="">
</td>
</tr>
<tr>
<td rowspan="2">
<img src="images/index_05.gif" width="25" height="66" alt="">
</td>
<td>
<img src="images/index_06.gif" width="90" height="38" alt="">
</td>
<td colspan="3" rowspan="2" background="images/index_07.gif" width="735" height="66" alt="">
<td>
<img src="images/spacer.gif" width="1" height="38" alt="">
</td>
</tr>
<tr>
<td>
<img src="images/index_08.gif" width="90" height="28" alt="">
</td>
<td>
<img src="images/spacer.gif" width="1" height="28" alt="">
</td>
</tr>
<tr>
<td colspan="5">
<img src="images/index_09.gif" width="850" height="1" alt="">
</td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt="">
</td>
</tr>
<td colspan="5" background="images/index_10.gif" width="850" height="27" alt="" valign="top">
<span id='Clock'></span>
<script type='text/javascript' src='script/clock.js'></script>
<?php
if($_GET[mode] == "")
{
?>
<!-- Logger ind! -->
<form name="form1" method="post" action="index.php">
<input type="text" class="login" name="brugernavn" value="Brugernavn" onkeypress="if(event.keyCode==13){this.blur()}" onFocus="if(this.value=='Brugernavn'){this.value=''}" onBlur="if(this.value==''){this.value='Brugernavn'}">
<input type="password" class="login" name="adgangskode"value="*******" onkeypress="if(event.keyCode==13){this.blur()}" onFocus="if(this.value=='*******'){this.value=''}" onBlur="if(this.value==''){this.value='*******'}">
<input type="submit" name="submit" value="Log på">
| <a href="system32/opret.php" target="main"><b>Opret Bruger</b></a>
| <a href="system32/glemt.php" target="main"><b>Glemt Adgangskode</b></a>
<?php
}
elseif($_GET[mode] == "ok")
{
if($_SESSION['loggetind'] !== "yes")
{
print "<meta http-equiv=\\"refresh\\" target=\\"main\\" content=\\"0;url=system32/ikkeloggetind.php\\">";
exit;
}
?>
<!-- Logger ind! -->
<!-- Logget ind! -->
<a href="system32/showprofile.php?id=<?php print $_SESSION[ID]; ?>" target="main">Min profil</a>
-
<a href="system32/top10_ret.php" target="main">Min top10</a>
-
<a href="system32/galleri_ret.php" target="main">Mit galleri</a>
-
<a href="system32/settings.php" target="main">Indstillinger</a>
-
<a href="system32/indbakke.php" target="main">Indbakke</a>
-
<a href="system32/venner.php" target="main">Venneliste</a>
-
<a href="system32/profiltekst_ret.php" target="main">Profiltekst</a>
-
<a href="uploadprofilbillede.php" target="main">Profilbillede</a>
-
<a href="system32/logud.php">Log ud</a>
<!--Logget ind! -->
</td>
<?php
}
?>
<?php
if($_GET[mode] == "")
{
?>
<img src="images/spacer.gif" width="1" height="27" alt="">
<tr>
<td colspan="5">
<img src="images/index_11.gif" width="850" height="13" alt="">
</td>
<td>
<img src="images/spacer.gif" width="1" height="13" alt="">
</td>
</tr>
<tr>
<td colspan="3" background="images/index_12.gif" width="191" height="466" alt="">
<div style="margin-top:3px;padding-left:12px;font-size: 14px;font-weight: bold;">» Denne Side</div>
<div style="padding-left:20px;"><b>»</b>
<a href="forside.php" target="main">Forside</a></div>
<div style="margin-top:4px;"></div>
<div style="padding-left:20px;"><b>»</b>
<a href="nyheder/index.php" target="main">Nyheder</a></div>
<div style="margin-top:4px;"></div>
<div style="padding-left:20px;"><b>»</b>
<a href="artikler/index.php" target="main">Artikler</a></div>
<div style="margin-top:4px;"></div>
<div style="padding-left:20px;"><b>»</b>
<a href="brevkasse/index.php" target="main">Brevkasser</a></div>
<div style="margin-top:4px;"></div>
<div style="padding-left:20px;"><b>»</b>
<a href="profilbilleder/profilbilleder.php" target="main">Profilbilleder</a></div>
<div style="margin-top:4px;"></div>
<div style="padding-left:20px;"><b>»</b>
<a href="system32/retningslinjer.php" target="main">Retningslinjer</a></div>
<div style="margin-top:4px;"></div>
<div style="padding-left:20px;"><b>»</b>
<a href="system32/findbruger.php" target="main">Find bruger</a></div>
<br>
<div style="padding-left:12px;font-size: 14px;font-weight: bold;">» Hitlister</div>
<div style="padding-left:20px;"><b>»</b>
<a href="Hitlister/musikhitliste.php" target="main">Musik Hitliste</a></div>
<div style="margin-top:4px;"></div>
<div style="padding-left:20px;"><b>»</b>
<a href="Hitlister/musikvideohitliste.php" target="main">Musikvideo Hitliste</a></div>
<div style="margin-top:4px;"></div>
<div style="padding-left:20px;"><b>»</b>
<a href="Hitlister/Kunstnerhitliste.php" target="main">Kunster Hitliste</a></div>
<div style="margin-top:4px;"></div>
<br>
<div style="padding-left:12px;font-size: 14px;font-weight: bold;">» Downloads</div>
<div style="margin-top:4px;"></div>
<div style="padding-left:20px;"><b>»</b>
<a href="download/index.php?kategori=demo" target="main">Demoer</a></div>
<div style="margin-top:4px;"></div>
<div style="padding-left:20px;"><b>»</b>
<a href="download/index.php?kategori=video" target="main">Videoer</a></div>
<div style="margin-top:4px;"></div>
<div style="padding-left:20px;"><b>»</b>
<a href="download/index.php?kategori=program" target="main">Programmer</a><br>
<br>
<p> </p>
<p> </p>
<p> </div>
</td>
<td rowspan="3">
<img src="images/index_13.gif" width="1" height="499" alt="">
</td>
<td rowspan="2" background="images/index_14.gif" width="658" height="485" alt="">
<iframe valign="top" src="forside.php" name="main" frameborder="0" style="width:643px;height:300px"></iframe>
<p> </p>
<p> </p>
</td>
<td>
<img src="images/spacer.gif" width="1" height="466" alt="">
</td>
</tr>
<tr>
<td colspan="3" rowspan="2">
<img src="images/index_15.gif" width="191" height="33" alt="">
</td>
<td>
<img src="images/spacer.gif" width="1" height="19" alt="">
</td>
</tr>
<tr>
<td>
<img src="images/index_16.gif" width="658" height="14" alt="">
</td>
<td>
<img src="images/spacer.gif" width="1" height="14" alt="">
</td>
</tr>
<tr>
<td>
<img src="images/spacer.gif" width="14" height="1" alt="">
</td>
<td>
<img src="images/spacer.gif" width="25" height="1" alt="">
</td>
<td>
<img src="images/spacer.gif" width="90" height="1" alt="">
</td>
<td>
<img src="images/spacer.gif" width="76" height="1" alt="">
</td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt="">
</td>
<td>
<img src="images/spacer.gif" width="658" height="1" alt="">
</td>
<td>
<img src="images/spacer.gif" width="16" height="1" alt="">
</td>
<td></td>
</tr>
</table>
</body>
</html>
<?php
}
}
?>