Gæstebog, der burde virke.
Nogen der kan fortælle mig hvorfor denne gb ikke virker efter hensigt?Den vil ikke komme med formen når jeg trykker.
Den vil heller ikke udskrive forrige og næste forneden.
link: http://192.168.1.3/martin/gaestebog.php
<?
$pr_side = "3";
include("conn.php");
if (!isset($s)) {
$s = "0";
}
#gem
if ($_POST) {
$comm = stripslashes($comm);
$comm = str_replace("\"",""",$comm);
$comm = str_replace("<","<",$comm);
$comm = str_replace(">",">",$comm);
$comm = str_replace("\n","<BR>",$comm);
$comm = str_replace("\\","\",$comm);
$comm = str_replace("http://","",$comm);
$comm = ereg_replace("((w{3}|W{3})+.[a-zA-Z0-9:%_.~#-?&]+)", "<a href=\"http://\\1\" CLASS=\"tekstlink\" TARGET=\"_blank\">\\1</a>",$comm);
$comm = ereg_replace("([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+.[a-zA-Z0-9._-]+)", "<a href=\"mailto:\\1\" CLASS=\"tekstlink\">\\1</a>",$comm);
$comm = str_replace("'","'",$comm);
$insert = "INSERT INTO gb(tid,navn,email,comm)
VALUES(NOW(),'$navn','$email','$comm')";
mysql_query($insert) || die(mysql_error());
}
print "<center><a href=\"gaestebog.php?action=skriv\">Skriv indlæg</a></center><br />";
if($action == "skriv") {
?>
<form action="" method="post">
<table border="0" cellpadding="5" cellspacing="0">
<tr><td align="right"><font size="-1" face="Verdana">Navn:</font></td><td><input type="text" name="navn" size="15" maxsize="20" style="border-color:#336699" style="color:#336699; style="border-width: thin;"></td></tr>
<tr><td align="right"><font size="-1" face="Verdana">Email:</font></td><td><input type="text" name="email" size="15" maxsize="20" style="border-color:#336699" style="color:#336699; style="border-width: thin;"></td></tr>
<tr><td align="right" valign="top"><font size="-1" face="Verdana">Kommentar:</font></td><td><textarea cols="28" rows="10" name="comm" style="border-color:#336699" style="color:#336699; style="border-width: thin;"></textarea></td></tr>
<tr><td></td><td><input type="submit" value="Send" Class="submit" name="send"></td></tr>
</form>
</table>
<?
}
if($action == "skriv") {
print "<br /><br /><hr color=#336699>";
}
#Gæstebogen
$query = "SELECT * FROM gb ORDER BY tid DESC
limit $s,$pr_side";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
print "<table>";
print "<tr>";
print "<td>";
print "<b>Navn:</b> $row[navn]<br /></font>";
print "<b>Email:</b> <a href='mailto:$row[email]'>$row[email]</a><br />";
print "<font size=-2><b>Tidspunkt:<b> $row[tid]</font>";
print "</td>";
print "</tr>";
print "<td><br />";
print "$row[comm]";
print "</td>";
print "</td>";
print "</table>";
print "<hr color=#336699>";
}
$g_total = mysql_query("select count(*) as total from gb") or die(mysql_error());
$total = mysql_result($g_total,0);
print "<br /><br /><center>";
if ($s >= $pr_side) {
$previous_s = $s-$pr_side;
print "<a href='?s=$previous_s'>Forrige</a> ";
}
$page = 1;
for($start=0; $total > $start; $start=$start+$pr_side){
if ($start != $s) {
print "<a href='?s=$start'>$page</a> ";
} else {
print "$page ";
}
$page++;
}
if ($total > $s+$pr_side) {
$next_s = $s+$pr_side;
print "<a href='?s=$next_s'>Næste</a>";
}
print "</center><br />";
mysql_close($conn);
?>