Hejsa. jeg har en php side på 554 linjer, hvilket jeg ikke mener er meget, men det køre ufattelig langsomt. Er 554 for meget for en php side, eller er det min kode den er gal med ??
koden kan ses her:
<?php
include("includes/head.php");
switch($page) {
case "contact":
contact();
break;
case "commentpost":
commentpost();
break;
case "history":
history();
break;
case "login":
login();
break;
case "links":
links();
break;
case "matches":
matches();
break;
case "members":
members();
break;
case "news":
news();
break;
case "newsarchive":
newsarchive();
break;
case "newshow":
newshow();
break;
case "servers":
servers();
break;
case "showprofile":
showprofile();
break;
case "sponsors":
sponsors();
break;
case "press":
press();
break;
case "pressarchive":
pressarchive();
break;
case "tagwall":
tagwall();
break;
case "tagwallpost":
tagwallpost();
break;
case "warreport":
warreport();
break;
default:
news();
break;
}
// ********************************************************** contact
function contact() {
include("includes/connection.php");
include("includes/tables.php");
$query = mysql_query("SELECT * FROM $Ttext");
$row = mysql_fetch_array($query);
print nl2br($row['contact']);
}
// ********************************************************** history
function history() {
include("includes/connection.php");
include("includes/tables.php");
$query = mysql_query("SELECT * FROM $Ttext");
$row = mysql_fetch_array($query);
print nl2br($row['history']);
}
// ********************************************************** login
function login() {
print "
<form action='logon.php' method='post'>
<table align='center'>
<tr>
<td>Brugernavn:</td><td><input type='textbox' name='username' class='box' size='15'></td>
</tr>
<tr>
<td>Password:</td><td><input type='password' name='password' class='box' size='15'></td>
</tr>
<tr>
<td colspan='2'><input type='submit' value='logon' class='box'></td>
</tr>
</table>
</form>
";
}
// ********************************************************** links
function links() {
include("includes/connection.php");
include("includes/tables.php");
$result = "0";
$query = mysql_query("SELECT * FROM $Tlinks");
while($row = mysql_fetch_array($query)) {
$result = "1";
print "<a target='_blank' href='" . $row['href'] . "'>" . $row['kliktekst'] . "</a> - " . $row['tekst'] . "<br>";
}
if ($result == 0) {
print "Ingen links!";
}
}
// ********************************************************** matches
function matches() {
include("includes/connection.php");
include("includes/tables.php");
print "
<table cellspacing='0' width='450' cellpadding='1' border='1' align='center' bordercolor='#333333'>
<tr>
<td align='center' style='border-top: 0px; border-bottom: 0px; border-left: 0px; border-right: 0px;'><b>Against</b></td>
<td align='center' style='border-top: 0px; border-bottom: 0px; border-right: 0px;'><b>Type</b></td>
<td align='center' style='border-top: 0px; border-bottom: 0px; border-right: 0px;'><b>X on X</b></td>
<td align='center' style='border-top: 0px; border-bottom: 0px; border-right: 0px;'><b>First Map</b></td>
<td align='center' style='border-top: 0px; border-bottom: 0px; border-right: 0px;'><b>Second Map</b></td>
<td align='center' style='border-top: 0px; border-bottom: 0px; border-right: 0px;'><b>Us</b></td>
<td align='center' style='border-top: 0px; border-bottom: 0px; border-right: 0px;'><b>Them</b></td>
<td align='center' style='border-top: 0px; border-bottom: 0px; border-right: 0px;'><b>Report</b></td>
</tr>
";
$result = "0";
$query = mysql_query("SELECT * FROM $Tcws");
while($row = mysql_fetch_array($query)) {
$result = "1";
print "<tr><td align='center' style='border-bottom: 0px; border-left: 0px; border-right: 0px;'>" . $row['against'] . "</td><td align='center' style='border-bottom: 0px; border-right: 0px;'>" . $row['type'] . "</td><td align='center' style='border-bottom: 0px; border-right: 0px;'>" . $row['xonx'] . "</td><td align='center' style='border-bottom: 0px; border-right: 0px;'>" . $row['map1'] . "</td style='border-bottom: 0px; border-right: 0px;'><td align='center' style='border-bottom: 0px; border-right: 0px;'>" . $row['map2'] . "</td>";
if($row['resultus'] > $row['resultthem']) {
print "<td align='center' style='border-bottom: 0px; border-right: 0px;'><font color='green'>" . $row['resultus'] . "</font></td>";
print "<td align='center' style='border-bottom: 0px; border-right: 0px;'><font color='green'>" . $row['resultthem'] . "</font></td>";
}
if($row['resultus'] == $row['resultthem']) {
print "<td align='center' style='border-bottom: 0px; border-right: 0px;'><font color='yellow'>" . $row['resultus'] . "</font></td>";
print "<td align='center' style='border-bottom: 0px; border-right: 0px;'><font color='yellow'>" . $row['resultthem'] . "</font></td>";
}
if($row['resultus'] < $row['resultthem']) {
print "<td align='center' style='border-bottom: 0px; border-right: 0px;'><font color='red'>" . $row['resultus'] . "</font></td>";
print "<td align='center' style='border-bottom: 0px; border-right: 0px;'><font color='red'>" . $row['resultthem'] . "</font></td>";
}
print "<td align='center' style='border-bottom: 0px; border-right: 0px;'><a href='pages.php?page=warreport&ID=" . $row['ID'] . "'>Report</a></td></tr>";
}
print "</table>";
if ($result == 0) {
print "Ingen kampe!";
}
}
// ********************************************************** members
function members() {
include("includes/connection.php");
include("includes/tables.php");
print "
<table border='0' bordercolor='black' width='300' align='center' cellspacing='0'>
<tr><td><b>Nick:</b></td><td align='center'><b>Age:</b></td><td align='right'><b>Rank:</b></td></tr>";
$query = mysql_query("SELECT * FROM $Tmembers");
while($row = mysql_fetch_array($query)) {
print "<tr><td><a href='pages.php?page=showprofile&ID=" . $row['ID'] . "'>" . $row['nick'] . "</a></td>";
print "<td align='center'>" . $row['alder'] . "</td>";
print "<td align='right'>" . $row['rank'] . "</td></tr>";
}
print "</table>";
}
// ********************************************************** newsarchive
function newsarchive() {
include("includes/connection.php");
include("includes/tables.php");
$result = "0";
$query = mysql_query("SELECT * FROM $Tnews");
while($row = mysql_fetch_array($query)) {
$result = "1";
print "<a href='pages.php?page=newshow&ID=" . $row['ID'] . "'>" . $row['overskrift'] . "</a><br>";
}
}
// ********************************************************** newshow
function newshow() {
include("includes/connection.php");
include("includes/tables.php");
$query = mysql_query("SELECT * FROM $Tnews WHERE ID = '$_GET[ID]' LIMIT 1");
$row = mysql_fetch_array($query);
$_SESSION['newid'] = $row['ID'];
$ID = $row['ID'];
print "
<table cellspacing=0 cellpadding=2 border=1 bordercolor='#333333' width='400' align='center'>
<tr>
<td width=250 style='border-top: 0px; border-bottom: 0px; border-left: 0px; border-right: 0px;'>" . $row['overskrift'] . "</td><td align=right width=150 style='border-top: 0px; border-bottom: 0px; border-right: 0px;'>" . $row['dato'] . "</td>
</tr>
<tr>
<td colspan=2 style='border-bottom: 0px; border-left: 0px; border-right: 0px;'>" . nl2br($row['nyhed']) . "<br><br><div align=right><i>Skrevet af " . $row['skrevetaf'] . "</i></td>
</tr>
</table><br><hr><br>
";
$query2 = mysql_query("SELECT * FROM $Tnewscomments WHERE ID = '$_GET[ID]'");
while($row2 = mysql_fetch_array($query2)) {
print "
<table cellspacing=0 cellpadding=2 border=1 bordercolor='#333333' width='400' align='center'>
<tr>
<td align=right style='border-top: 0px; border-bottom: 0px; border-right: 0px; border-left: 0px;'>" . $row2['dato'] . "</td>
</tr>
<tr>
<td style='border-bottom: 0px; border-left: 0px; border-right: 0px;'>" . nl2br($row2['comment']) . "<br><br><div align=right><i>Skrevet af " . $row2['skrevetaf'] . "</i></td>
</tr>
</table><br><br>
";
}
print "
<form action='pages.php?page=commentpost&ID=$ID' method='post'>
<table align='center'>
<tr>
<td>Navn:</td>
<td><input name='skrevetaf' type='textbox' value='' id='form' id='form' class='box'></td>
</tr>
<tr>
<td>Kommentar: <font color='red'>*</font></td>
<td><textarea name='besked' rows='10' cols='30' id='form' id='form' class='box'></textarea></td>
</tr>
<tr>
<td><input type='submit' value='Indsæt' class='box'></td>
<td><input type='reset' value='Nulstil' class='box'></td>
</tr>
</table>
</form>
";
}
// ********************************************************** commentpost
function commentpost() {
include("includes/connection.php");
include("includes/tables.php");
$ID = $_SESSION['newid'];
$dato = date('d/m-y G:m:i');
$skrevetaf = $_POST['skrevetaf'];
$besked = $_POST['besked'];
mysql_query("INSERT INTO $Tnewscomments (ID,dato,skrevetaf,comment) VALUES('$ID','$dato','$skrevetaf','$besked')");
print "Din besked er nu gemt i databasen.<br><a href='pages.php?page=newshow&ID=" . $_SESSION['newid'] . "'>Tilbage</a>";
}
// ********************************************************** news
function news() {
include("includes/connection.php");
include("includes/tables.php");
$result = 0;
$query = mysql_query("SELECT * FROM $Tnews Order By ID Desc LIMIT 5");
while($row = mysql_fetch_array($query)) {
$result = 1;
print "<table cellspacing=0 cellpadding=2 border=1 bordercolor='#333333' width='400' align='center'>";
print "<tr>";
print "<td width=250 style='border-top: 0px; border-bottom: 0px; border-left: 0px; border-right: 0px;'>" . $row['overskrift'] . " <a href='pages.php?page=newshow&ID=" . $row['ID'] . "'>Kommentare</a></td><td align=right width=150 style='border-top: 0px; border-bottom: 0px; border-right: 0px;'>" . $row['dato'] . "</td>";
print "</tr>";
print "<tr>";
print "<td colspan=2 style='border-bottom: 0px; border-left: 0px; border-right: 0px;'>" . nl2br($row['nyhed']) . "<br><br><div align=right><i>Skrevet af " . $row['skrevetaf'] . "</i></td>";
print "</tr>";
print "</table><br><br>";
}
if ($result == 0) {
print "Ingen nyheder!";
}
}
// ********************************************************** servers
function servers() {
include("includes/connection.php");
include("includes/tables.php");
$query = mysql_query("SELECT * FROM $Ttext");
$row = mysql_fetch_array($query);
print nl2br($row['server']);
}
// ********************************************************** showprofile
function showprofile() {
include("includes/connection.php");
include("includes/tables.php");
$query = mysql_query("SELECT * FROM $Tmembers WHERE ID = '$_GET[ID]'");
$row = mysql_fetch_array($query);
print "<table cellspacing='0' cellpadding='2' border='0' align='left'>";
print "<tr><td colspan='2'><b>Generalt</b></td></tr>";
print "<tr><td width='150'>Nick:</td><td>" . $row['nick'] . "</td></tr>";
print "<tr><td>Fornavn:</td><td>" . $row['fornavn'] . "</td></tr>";
print "<tr><td>Efternavn:</td><td>" . $row['efternavn'] . "</td></tr>";
print "<tr><td>Alder:</td><td>" . $row['alder'] . "</td></tr>";
print "<tr><td>Email:</td><td>" . $row['email'] . "</td></tr>";
print "<tr><td>Rank:</td><td>" . $row['rank'] . "</td></tr>";
print "<tr><td>By:</td><td>" . $row['town'] . "</td></tr>";
print "<tr><td>Fav. weaps:</td><td>" . $row['favweaps'] . "</td></tr>";
print "<tr><td>Fav. maps:</td><td>" . $row['favmaps'] . "</td></tr>";
print "<tr><td colspan='2'><b>Computer</b></td></tr>";
print "<tr><td>CPU:</td><td>" . $row['cpu'] . "</td></tr>";
print "<tr><td>Ram:</td><td>" . $row['ram'] . "</td></tr>";
print "<tr><td>Motherboard:</td><td>" . $row['motherboard'] . "</td></tr>";
print "<tr><td>Grafikkort:</td><td>" . $row['gfx'] . "</td></tr>";
print "<tr><td>Skærm:</td><td>" . $row['skaerm'] . "</td></tr>";
print "<tr><td>Keyboard:</td><td>" . $row['keyboard'] . "</td></tr>";
print "<tr><td>Mus:</td><td>" . $row['mus'] . "</td></tr>";
print "<tr><td>Mussemåtte:</td><td>" . $row['mussemaatte'] . "</td></tr>";
print "<tr><td colspan='2'><b>Counter-Strike Instillinger</b></td></tr>";
print "<tr><td>Opløsning:</td><td>" . $row['oploesning'] . "</td></tr>";
print "<tr><td>Sens:</td><td>" . $row['sens'] . "</td></tr>";
print "<tr><td>Zoom sens:</td><td>" . $row['zoomsens'] . "</td></tr>";
print "<tr><td>Model som CT:</td><td>" . $row['modelct'] . "</td></tr>";
print "<tr><td>Model som T:</td><td>" . $row['modelt'] . "</td></tr>";
print "</table>";
}
// ********************************************************** sponsors
function sponsors() {
include("includes/connection.php");
include("includes/tables.php");
$query = mysql_query("SELECT * FROM $Ttext");
$row = mysql_fetch_array($query);
print nl2br($row['sponsors']);
}
// ********************************************************** press
function press() {
include("includes/connection.php");
include("includes/tables.php");
$query = mysql_query("SELECT * FROM $Tpress WHERE ID ='$_GET[ID]'");
while($row = mysql_fetch_array($query)) {
print "<b>" . $row['overskrift'] . " " . $row['dato'] . "</b><br>";
print nl2br($row['press']);
}
}
// ********************************************************** pressarchive
function pressarchive() {
include("includes/connection.php");
include("includes/tables.php");
$result = "0";
$query = mysql_query("SELECT * FROM $Tpress Order By ID Desc");
while($row = mysql_fetch_array($query)) {
$result = "1";
print "<a href='pages.php?page=press&ID=" . $row['ID'] . "'>" . $row['overskrift'] . "</a><br>";
}
if ($result == 0) {
print "Ingen press!";
}
}
// ********************************************************** tagwall
function tagwall() {
include("includes/connection.php");
include("includes/tables.php");
$query = mysql_query("SELECT * FROM $Ttagwall Order By ID Desc");
while($row = mysql_fetch_array($query)) {
print "<table cellspacing=0 cellpadding=2 border=1 bordercolor='#333333' width='400' align='center'>";
print "<tr>";
print "<td width=250 style='border-top: 0px; border-bottom: 0px; border-left: 0px; border-right: 0px;'>" . $row['overskrift'] . "</td><td align=right width=150 style='border-top: 0px; border-bottom: 0px; border-right: 0px;'>" . $row['dato'] . "</td>";
print "</tr>";
print "<tr>";
print "<td colspan=2 style='border-bottom: 0px; border-left: 0px; border-right: 0px;'>" . nl2br($row['besked']) . "<br><br><div align=right><i>Skrevet af " . $row['skrevetaf'] . "</i></td>";
print "</tr>";
print "</table><br><br>";
}
print "
<form method='post' action='pages.php?page=tagwallpost'>
<table align='center'>
<tr>
<td>Navn:</td>
<td><input name='skrevetaf' type='text' value='' class='box'></td>
</tr>
<tr>
<td>Overskrift: <font color='red'>*</font></td>
<td><input name='overskrift' type='text' value='' class='box'></td>
</tr>
<tr>
<td>Kommentar: <font color='red'>*</font></td>
<td><textarea name='besked' rows='10' cols='30' class='box'></textarea></td>
</tr>
<tr>
<td><input type='submit' value='Indsæt' class='box'></td>
<td><input type='reset' value='Nulstil' class='box'></td>
</tr>
</table>
</form>
<font color='red'>*</font> Skal udfyldes!
";
}
// ********************************************************** tagwallpost
function tagwallpost() {
include("includes/connection.php");
include("includes/tables.php");
$dato = date('d/m-y G:m:i');
$overskrift = $_POST['overskrift'];
$skrevetaf = $_POST['skrevetaf'];
$besked = $_POST['besked'];
mysql_query("INSERT INTO $Ttagwall (dato, overskrift, skrevetaf, besked) VALUES('$dato','$overskrift','$skrevetaf','$besked')");
print "Din besked er nu gemt i databasen.<br><a href='pages.php?page=tagwall'>Tilbage</a>";
}
// ********************************************************** warreport
function warreport() {
include("includes/connection.php");
include("includes/tables.php");
$query = mysql_query("Select * from $Tcws Where ID = '$_GET[ID]'");
$row = mysql_fetch_array($query);
print "
<table style='border-width: 1px;' width='500' border='1'>
<tr>
<td width='250'>
<table>
<tr>
<td><b>Against:</b></td><td>" . $row['against'] . "</td>
</tr>
<tr>
<td><b>Type:</b></td><td>" . $row['type'] . "</td>
</tr>
<tr>
<td><b>X on X:</b></td><td>" . $row['xonx'] . "</td>
</tr>
<tr>
<td><b>First map:</b></td><td>" . $row['map1'] . "</td>
</tr>
<tr>
<td><b>Second map:</b></td><td>" . $row['map2'] . "</td>
</tr>
<tr>
<td><b>Us:</b></td><td>" . $row['resultus'] . "</td>
</tr>
<tr>
<td><b>Them:</b></td><td>" . $row['resultthem'] . "</td>
</tr>
</table>
</td>
<td valign='top' width='250'>
<table>";
if($row['player01'] > "") {
print "<tr><td>Player01:</td><td>" . $row['player01'] . "</td></tr>";
}
if($row['player02'] > "") {
print "<tr><td>Player02:</td><td>" . $row['player02'] . "</td></tr>";
}
if($row['player03'] > "") {
print "<tr><td>Player03:</td><td>" . $row['player03'] . "</td></tr>";
}
if($row['player04'] > "") {
print "<tr><td>Player04:</td><td>" . $row['player04'] . "</td></tr>";
}
if($row['player05'] > "") {
print "<tr><td>Player05:</td><td>" . $row['player05'] . "</td></tr>";
}
print "
</table>
</td>
</tr>
<tr>
<td colspan='2'>
" . nl2br($row['report']) . "
</td>
</tr>
</table>
";
}
?>
</body>
</html>
Filen ligger på www.sih.frac.dk, og det er er den som alle menulinksne fører videre til f.eks News,Members osv.