Location: PHPKode > projects > GBook > gbook/sign.php
<?
// GBook made by Racin Nygaard. If you have any questions please ask them on irc (darkking @ Efnet)
// Or email me at: hide@address.com :)

// Without these includes the script won't work.
include("config.php");
include("translation.php");

$query = "select * from $designtable" or die(mysql_error());
$result = mysql_db_query($database, $query, $link) or die(mysql_error());
$design = mysql_fetch_row($result);

$title = $design[1];
$background = $design[2];
$picture = $design[3];
$tablebg = $design[4];
$txtcolor = $design[5];
$logopoint = $design[6];
$aover = $design[7];
$alink = $design[8];
$active = $design[9];
$avis = $design[10];

// Remove this if you want to disable ip banning
$query = "select * from $bantable" or die(mysql_error());
$result = mysql_db_query($database, $query, $link) or die(mysql_error());

while ($ip = mysql_fetch_row($result))
if ($ip[1] == getenv ("remote_addr"))
{
echo '<META HTTP-EQUIV="refresh" CONTENT="0; URL=banned.html">';
}
else
{ echo ""; }
mysql_free_result($result);
echo "
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html>
<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<style type=\"text/css\">
BODY {
        SCROLLBAR-FACE-COLOR: #B0B0B0; SCROLLBAR-HIGHLIGHT-COLOR: #000000;
        SCROLLBAR-SHADOW-COLOR: #333333; SCROLLBAR-3DLIGHT-COLOR: #2e425a;
        SCROLLBAR-ARROW-COLOR: #3300FF; SCROLLBAR-TRACK-COLOR: #000000;
        SCROLLBAR-DARKSHADOW-COLOR: #000000; BACKGROUND-COLOR: $background;
}
A:link {
        COLOR: $alink; TEXT-DECORATION: none
}
A:active {
        COLOR: $active; TEXT-DECORATION: none
}
A:visited {
        COLOR: $avis; TEXT-DECORATION: none
}
A:hover {
        COLOR: $aover;
}

</style><font face=\"Verdana,Geneva,Arial,Helvetica,sans-serif\" color='$txtcolor' size=\"2\">
<title>Sign ". $title."</title></head>
<form method=\"post\" action=\"sign.php?action\">
Your name: <input type=\"text\" name=\"name\"><br>
Email: <input type=\"text\" name=\"email\"><br>
Homepage: <input type=\"text\" name=\"homepage\" value=\"http://\"><br><br>
Smileys:<br>"; 
$count = count($trans);
for ($i = 1; $count >= $i; $i=$i+1)
{
$num = $i;
echo $trans[$num]." = <strong>". $org[$num] ."</strong> --- ";
}
echo "<br>";
echo "<br><br>Write something here:<br>
<textarea name=\"guestbook\" rows=\"10\" cols=\"100\"></textarea><br><br>
<input type=\"submit\" value=\"POST!\"></form></font></html>";

if (isset($_GET["action"]))
{
if ( !isset($_POST["name"]) || !$_POST["name"] || !isset($_POST["guestbook"]) 
|| !$_POST["guestbook"] || !isset($_POST["email"]) || !$_POST["email"] || !isset($_POST["homepage"]) || !$_POST["homepage"] )
{
echo "<html><font face=\"Verdana,Geneva,Arial,Helvetica,sans-serif\" color='$txtcolor' size=\"2\">All fields are mandatory!</html>";
}
else
{ 
include("config.php");
global $table, $link;

$dato = date('H:i:s - d.m.y');
$ip = getenv ("REMOTE_ADDR");
$navn = str_replace("\"", "'", $_POST["name"]);
$guestbook = str_replace("\"", "'", $_POST["guestbook"]);
$qadd = "
     INSERT INTO $table
     (id,name,date,email,homepage,guestbook,ip)
     VALUES
     (\"{$_POST['id']}\", \"{$navn}\", '$dato', \"{$_POST['email']}\", 
\"{$_POST['homepage']}\", \"{$guestbook}\", '$ip')";



if (!$result = mysql_query($qadd,$link)) 
{
                echo "<html><font size=\"2\" face=\"Verdana,Geneva,Arial,Helvetica,sans-serif\" 
color='$txtcolor'>".mysql_error()."</html>";
} 
else 
{
        echo '<META HTTP-EQUIV="refresh" CONTENT="0; URL=index.php">';
}
}
}
?>
Return current item: GBook