IP banning i gæstebog
Hej.Jeg er bestemt ikke nogen ørn til php og har derfor blot taget brug af min udbyders standard gæstebog.
I den ser det ud som om, at der er mulighed for at banne uønskede IP'er.
Koden for gæstebogen er:
<?php
include("lib.php");
include("data.php");
$content = outputFormatedContent(outputPageContent(readDataFromFile(),$messageToPage));
?>
<html>
<head>
<title>Ørbæk.dk - En historie med billeder om en rigmandssøn's liv på godt og ondt.</title>
<meta name="description" content="Ørbæk.dk - En historie med billeder om en rigmandssøn's liv på godt og ondt.">
<meta name="keywords" content="">
<style>body{ scrollbar-arrow-color: #FF00FF; scrollbar-3dlight-color:
#FFCCFF; scrollbar-highlight-color: #FFDDFF; scrollbar-face-color:
#FF99CC; scrollbar-shadow-color: #CC77CC; scrollbar-darkshadow-color:
#CC6699; scrollbar-track-color: #FF99CC; }</style>
<style type="text/css">
<!--
a:link {text-decoration: none}
a:visited {text-decoration: none}
a:active {text-decoration: none}
a:hover {text-decoration: underline}
.smalltext {font: 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif; color:silver}
.text {font: 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif; color:#000000}
.#000000text {font: 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif; color:#000000}
#line {color: #000000}
textarea {font-size: 8pt; font-family: "Verdana",Arial,sans-serif; color: #000000; background: white; border-style: ridge; width: 230px}
input {font-size: 8pt; font-family: "Verdana",Arial,sans-serif; color: #000000}
input.field {border-style: ridge; width: 170px; background: white}
input.button { border-style: outset; width: 230px; cursor: hand; background: white}
/*body { scrollbar-face-color: #000000; scrollbar-shadow-color: #200000; scrollbar-highlight-color: #000000; scrollbar-3dlight-color: #000000; scrollbar-darkshadow-color: #000000; scrollbar-track-color: #488a96; scrollbar-arrow-color: #000000}*/
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#880088" link="#993366" vlink="#CC99FF" alink="#993300">
<table border="0" width="100%">
<tr><!-- Row 1 -->
<td width="150" valign="top">
<script type='text/javascript'>
function Go(){return}
</script>
<script type='text/javascript' src='../menu_var.js'></script>
<script type='text/javascript' src='../menu_com.js'></script>
<noscript>Your browser does not support script</noscript>
</td><!-- Col 1 -->
<td background="/images/bg.jpg" valign="top">
<p><b>Gæstbogen
<p><dir>Har du ikke skrevet endnu ???
<br>Bare skriv herunder ...
<p>Men har du skrevet, skriv da igen.
<p>
<table border="0" cellpadding="0" cellspacing="0" align="center" height="100%">
<tr>
<td valign="top" width="230"><font face="Century Schoolbook">
</td>
</tr>
<tr>
<td valign="top" width="230">
<table width="230" border="0" cellpadding="0" cellspacing="0">
<form action="write.php" method="post">
<tr>
<td width="50" class="text"><b>Nick: </font></td>
<td width="10"><spacer width="10" height="1" type="block"></td>
<td width="170"><input type="text" size="20" name="nick" maxlength="50" class="field"></td>
</tr>
<tr>
<td class="text"><b>Homesite:</b> </td>
<td><spacer width="10" height="1" type="block"></td>
<td><input type="text" size="20" name="url" maxlength="50" value="http://" class="field"></td>
</tr>
<tr>
<td class="text"><b>E-mail:</b> </td>
<td><spacer width="10" height="1" type="block"></td>
<td><input type="text" size="20" name="email" maxlength="50" class="field"></td>
</tr>
<tr>
<td colspan="3" class="text"><b>Din hilsen:</b></td>
</tr>
<tr>
<td colspan="3" align="right"><textarea name="message" rows="9" cols="30" wrap="vitual" style="font-size: 10pt; font-family: Arial,sans-serif"></textarea></td>
</tr>
<tr>
<td colspan="3" align="right"><input type="submit" value="send" class="button"></td>
</tr>
</form>
</table>
</td>
<td width="10"><spacer height="1" width="10" type="block"><br> </td>
<td valign="top" width="520" class="text2">
<?php
if (numberOfPages("$PHP_SELF") != null)
{
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="white">
<table width="100%" border="0" cellpadding="2" cellspacing="1">
<tr>
<td bgcolor="white" style="cursor:nw-resize" class="#000000text"><?php print numberOfPages("$PHP_SELF","<span class=\"text\">page: </span>") ?></td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<?php
}
?>
<?php
$i = 0;
while($i < sizeof($content)-4)
{
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="white">
<table width="100%" border="0" cellpadding="2" cellspacing="1">
<?php
// name and email as link >>
$i=$i+2;
if ($content[$i] != "")
{
?> <tr>
<td class=text bgcolor="white" style="cursor:hand" onMouseOver="this.style.background='white'" onMouseOut="this.style.background='white'" onClick="window.location.href='mailto:<?php print $content[$i+2] ?>'"><a href="mailto:<?php print $content[$i+2] ?>"><?php print $content[$i] ?></a></td>
</tr>
<?php
}
// name and email as link <<
?>
<?php
// url >>
$i++;
if ($content[$i] != "")
{
?> <tr>
<td class=text bgcolor="white" style="cursor:hand" onMouseOver="this.style.background='white'" onMouseOut="this.style.background='white'" onClick="window.location.href='<?php print $content[$i] ?>'"><a href="<?php print $content[$i] ?>"><?php print $content[$i] ?></a></td>
</tr>
<?php
}
// url <<
?>
<?php
// message >>
$i=$i+2;
if ($content[$i] != "")
{
?> <tr>
<td class=text bgcolor="white"><?php print divideWord($content[$i], $maxWordLength); ?></td>
</tr>
<?php
}
// message <<
?>
<?php
// date and time >>
$i++;
if ($content[$i] != "")
{
?> <tr>
<td class=text bgcolor="white" style="cursor:nw-resize" onMouseOver="this.style.background='white'" onMouseOut="this.style.background='white'">[<?php print $content[$i]; $i++?>]</td>
</tr>
<?php
}
$i++;
// date and time <<
?>
</table>
</td>
</tr>
</table>
<br>
<?php
}
?>
<tr>
<td class="text" valign="bottom"><br><?php print check(); ?></td>
<td width="10"><spacer height="1" width="10" type="block"><br> </td>
<td valign="bottom" align="right"><div><span class="text"><a href="http://www.oerbek.dk/passwd/admin.php" target="_blank">© </a></span><a href="mailto:kazzie@ofir.dk" class="#000000text"></a> <a href="http://www.oerbek.dk/" target="_blank" class="text">http://www.oerbek.dk</a></div></td>
</tr>
</table>
</td><!-- Col 2 -->
</tr>
</table>
</body>
</meta>
</meta>
</head>
</html>
Håber nogen kan hjælpe mig, med hvor jeg kan ændre noget, således at jeg kan banne uønskede IP'er.