Fejl i PHP formel
Hvorfor får jeg en fejl i dette dokument?<?php
//http://www.eksperten.dk/spm/697765
session_start();
require("connect.php");
if($_SESSION['loggedIn'])
{
//Vi har en admin
if(isset($_POST['opret']))
{
//Forbind til mysql...
mysql_query("INSERT INTO
tbl_697765_match(id,datotid,hjemmehold,udehold,hjemmemap,udemap,hjemscore1,udescore1,hjemscore2,udescore2,hjemscore3,udescor
e3,hjemscore4,udescore4)
VALUES('',NOW(),'".$_POST['team1']."','".$_POST['team2']."','".$_POST['map1']."','".$_POST['map2']."',
'".$_POST['runde1t1']."','".$_POST['runde1t2']."','".$_POST['runde2t1']."','".$_POST['runde2t2']."','".$_POST['runde3t1']."'
,'".$_POST['runde3t2']."','".$_POST['runde4t1']."','".$_POST['runde4t2']."')") or die(mysql_error());
}
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
echo 'Team1: => <input type="text" name="team1"><br />';
echo 'Team2: => <input type="text" name="team2"><br />';
echo '<br>';
echo 'Map1: => <input type="text" name="map1"><br />';
echo 'Map2: => <input type="text" name="map2"><br />';
echo '<br>';
echo 'Point runde 1'<br />;
echo 'Allid'<br />;
echo 'Runde1 - Team1: => <input type="text" name="runde1t1"><br />';
echo 'Runde1 - Team2: => <input type="text" name="runde1t2"><br />';
echo '<br>';
echo 'Axis'<br />;
echo 'Runde2 - Team1: => <input type="text" name="runde2t1"><br />';
echo 'Runde2 - Team2: => <input type="text" name="runde2t2"><br />';
echo '<br>';
echo 'Point runde 2'<br />;
echo 'Allid'<br />;
echo 'Runde2 - Team1: => <input type="text" name="runde3t1"><br />';
echo 'Runde2 - Team2: => <input type="text" name="runde3t2"><br />';
echo '<br>';
echo 'Axis'<br />;
echo 'Runde2 - Team1: => <input type="text" name="runde4t1"><br />';
echo 'Runde2 - Team2: => <input type="text" name="runde4t2"><br />';
echo '<br>';
echo '<input type="submit" name="opret" value="Gem">';
echo '</form>';
}
else
{
//Vi har ikke en admin
if($_POST['user'] == 'tobias' && $_POST['pass'] == 'fisse123')
{
$_SESSION['loggedIn'] = true;
header('Location: ' . $_SERVER['PHP_SELF']);
exit();
}
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
echo 'Brugernavn: => <input type="text" name="user"><br />';
echo 'Kodeord: => <input type="password" name="pass"><br />';
echo '<input type="submit" name="login" value="Login">';
echo '</form>';
}
$query = mysql_query("SELECT * FROM tbl_697765_match ORDER BY datotid DESC");
if(mysql_num_rows($query)>0)
{
echo "<table border='1'>";
echo "<tr><th>Dato/Tid</th><th>Team 1</th><th> </th><th>Team 2</th><th>Bane 1</th><th>Bane
2</th><th>Map1</th><th>Map2</th><th>Map1</th><th>Map2</th><th>Total score</th><th>Total score2</th></tr>";
while($row = mysql_fetch_assoc($query))
{
echo "<tr><td>" . $row['datotid'] . "</td>";
echo "<td>" . $row['hjemmehold'] . "</td>";
echo "<td>vs</td>";
echo "<td>" . $row['udehold'] . "</td>";
echo "<td>" . $row['hjemmemap'] . "</td>";
echo "<td>" . $row['udemap'] . "</td>";
echo "<td>" . $row['hjemscore1'] . " / " . $row['udescore1'] . "</td>";
echo "<td>" . $row['hjemscore2'] . " / " . $row['udescore2'] . "</td>";
echo "<td>" . $row['hjemscore3'] . " / " . $row['udescore3'] . "</td>";
echo "<td>" . $row['hjemscore4'] . " / " . $row['udescore4'] . "</td>";
echo "<td>" . ($row['hjemscore1']+$row['hjemscore2']) . " / " . ($row['udescore1']+$row['udescore2']) .
"</td>
echo "<td>" . ($row['hjemscore3']+$row['hjemscore4']) . " / " . ($row['udescore3']+$row['udescore4']) .
"</td>
</tr>";
}
echo "</table>";
}
?>
