Cmi
11-18-2006, 06:25 AM
Hello peaple, im new here, im from Norwegian, can someone help me to fix this proplem??
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <!--////////////////////////////////////////// L O S T I N F O R R E S T by Empire Elements www.empire-elements.co.uk ////////////////////////////////////////// --> <head> <title>Gjestebok</title> <title>Gjestebok</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" /> <title>Velg Kategori</title> <link href="global.css" rel="stylesheet" type="text/css" /> </head> <body link="#C0C0C0" vlink="#C0C0C0" alink="#C0C0C0" text="#FFFFFF" bgcolor="#000000"> <div id="Container"> <div id="Top"> <div id="MenuHold"> <a title="Menu" href="index.html">Hjem</a> <a title="Om meg" href="om_meg.htm">Om meg</a> <a title="Galleri" href="galleri.htm">Galleri</a> <a title="Utstyr" href="utstyr.htm">Mitt utstyr</a> <a href="#" title="Gjestebok">Gjestebok</a> <p> </div> <h1>Velkommen</h1> <p>www.naturogfoto.net</p> </div> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p><b><font color="#C0C0C0" size="5">Gjestebok:</font></b></p> <address> <font color="#C0C0C0"><span style="font-style: normal">Legg gjerne igjen en beskjed i gjesteboka. Håper du likte nettsiden og tar turen innom igjen.</span></font></address> <address> </address> <html> <title>naturogfoto.net</title> <body link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" text="#FFFFFF" bgcolor="#000000"> <!-- 123456 --> <?php // Set these to get the guestbook more personal. // ======================================== $gbfile = "guestbook.txt"; // The file that all guestbook entrys should be saved in. $thisfile = "guestbook.php"; // The name of this file. $dateshow = "Y-m-d - H:i:s"; // Decides how the date should be shown. http://www.w3schools.com/php/func_date_date.asp $username = "Cmi"; // Admin username. $password = "555555"; // Admin password. $wrongpass = "Not logged in!"; // Text to show when the wrong password has been entered. $wrongname = "Not logged in!"; // Text to show when the wrong username has been entered. $thankstxt = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>Takk for at du tok deg tid til og skrive i gjesteboken!<br>Du vil bli sent tilbake innen 3 sekunder. Hvis ikke klikk <a href='$thisfile'>her</a></p>"; // The text that the user will see after entering something in the guestbook. $errornoname = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>You have to enter a name!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>"; // Text to print out when no name has been entered in the entry. $errornomsg = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>You have to enter a message!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>"; // Text to print out when no message has been entered in the entry. $gbedited = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>Guestbook has been edited!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>"; // Text to print out when guestbook has been edited. // ======================================== // Do not change under here // ======================================== $gbpage = "$_SERVER[PHP_SELF]"; $date = date("$dateshow"); $name = htmlentities(strip_tags($_POST['name'])); $email = htmlentities(strip_tags($_POST['email'])); $homepage = htmlentities(strip_tags($_POST['homepage'])); $message = nl2br(htmlentities(strip_tags($_POST['message']))); $message = str_replace(array("\r", "\n"), '', $message); $message = wordwrap($message, 75, "<br />", true); $printfull = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><tr><td><strong>Email:</strong></td><td><a href=\"mailto:$email\">$email</a></td></tr><tr><td><strong>Homepage:</strong></td><td><a href=\"$homepage\" target=\"_blank\">$homepage</a></td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n"; $printnoemail = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><td><strong>Homepage:</strong></td><td><a href=\"$homepage\" target=\"_blank\">$homepage</a></td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n"; $printnopage = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><tr><td><strong>Email:</strong></td><td><a href=\"mailto:$email\">$email</a></td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n"; $printnoemailpage = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n"; // ======================================== // SCRIPT START !!! // ======================================== switch($_GET['id']) { default: ?> <table border="0" width="80%"> <tr> <td align="left"> <table> <form action="<?php echo $gbpage; ?>?id=1" method="post" name="submitform0"> <tr> <td><strong>Name:</strong></td> <td> <input type="text" name="name" size="40" maxlength="50"></td> </tr> <tr> <td><strong>Email:</strong></td> <td> <input type="text" name="email" size="40" maxlength="50"></td> </tr> <tr> <td><strong>Homepage:</strong></td> <td> <input type="text" name="homepage" size="40" maxlength="50" value="http://"></td> </tr> <tr> <td valign="top"><strong>Message:</strong></td> <td><textarea name="message" cols="30" rows="7"></textarea></td> </tr> <tr> <td></td> <td><input type="submit" name="submit1" value="Submit"></td> </tr> </form> </table></td> </tr> <tr> <td align="left"><span style="font-style: normal"><br> <?php $gb = file($gbfile); $gb = array_reverse($gb); foreach ($gb as $guestbook) { echo stripslashes($guestbook); } break; case 1: if($name == "") { echo $errornoname; } elseif($message == "") { echo $errornomsg; } elseif($email == "") { if($homepage == "" || $homepage == "http://") { $writeinfo = $printnoemailpage; $printer = fopen($gbfile,"a"); fwrite($printer,$writeinfo); fclose($printer); echo $thankstxt; } else { $writeinfo = $printnoemail; $printer = fopen($gbfile, 'a'); fwrite($printer,$writeinfo); fclose($printer); echo $thankstxt; } } elseif($homepage == "" || $homepage == "http://") { $writeinfo = $printnopage; $printer = fopen($gbfile, 'a'); fwrite($printer,$writeinfo); fclose($printer); echo $thankstxt; } else { $writeinfo = $printfull; $printer = fopen($gbfile, 'a'); fwrite($printer,$writeinfo); fclose($printer); echo $thankstxt; } break; case 2: ?></span><table align="center"> <form action="<?php echo $gbpage; ?>?id=3" method="post" name="submitform"> <tr> <td> <address> <span style="font-style: normal"><strong>Username:</strong></span></address> </td> <td> <address> <span style="font-style: normal"> <input type="text" name="adminname" size="20"></span></address> </td> </tr> <tr> <td> <address> <span style="font-style: normal"><strong>Password:</strong></span></address> </td> <td> <address> <span style="font-style: normal"> <input type="password" name="adminpass" size="20"></span></address> </td> </tr> <tr> <td> <address> </address> </td> <td> <address> <span style="font-style: normal"> <input type="submit" name="submit" value="Login"></span></address> </td> </tr> </form> </table> <address align="center"><span style="font-style: normal"> <?php break; case 3: if($_POST["adminname"] == $username) { if($_POST["adminpass"] == $password) { ?> <a href="<?php echo $gbpage; ?>?id=2">Admin</a></span></address> <table align="center"> <form name="guestbookedit" method="post" action="<?php echo $gbpage; ?>?id=4"> <tr> <td> </html>
Here is some of the code
You can check out the site here: http://home.no.net/snurrebo/guestbook.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <!--////////////////////////////////////////// L O S T I N F O R R E S T by Empire Elements www.empire-elements.co.uk ////////////////////////////////////////// --> <head> <title>Gjestebok</title> <title>Gjestebok</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" /> <title>Velg Kategori</title> <link href="global.css" rel="stylesheet" type="text/css" /> </head> <body link="#C0C0C0" vlink="#C0C0C0" alink="#C0C0C0" text="#FFFFFF" bgcolor="#000000"> <div id="Container"> <div id="Top"> <div id="MenuHold"> <a title="Menu" href="index.html">Hjem</a> <a title="Om meg" href="om_meg.htm">Om meg</a> <a title="Galleri" href="galleri.htm">Galleri</a> <a title="Utstyr" href="utstyr.htm">Mitt utstyr</a> <a href="#" title="Gjestebok">Gjestebok</a> <p> </div> <h1>Velkommen</h1> <p>www.naturogfoto.net</p> </div> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p><b><font color="#C0C0C0" size="5">Gjestebok:</font></b></p> <address> <font color="#C0C0C0"><span style="font-style: normal">Legg gjerne igjen en beskjed i gjesteboka. Håper du likte nettsiden og tar turen innom igjen.</span></font></address> <address> </address> <html> <title>naturogfoto.net</title> <body link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" text="#FFFFFF" bgcolor="#000000"> <!-- 123456 --> <?php // Set these to get the guestbook more personal. // ======================================== $gbfile = "guestbook.txt"; // The file that all guestbook entrys should be saved in. $thisfile = "guestbook.php"; // The name of this file. $dateshow = "Y-m-d - H:i:s"; // Decides how the date should be shown. http://www.w3schools.com/php/func_date_date.asp $username = "Cmi"; // Admin username. $password = "555555"; // Admin password. $wrongpass = "Not logged in!"; // Text to show when the wrong password has been entered. $wrongname = "Not logged in!"; // Text to show when the wrong username has been entered. $thankstxt = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>Takk for at du tok deg tid til og skrive i gjesteboken!<br>Du vil bli sent tilbake innen 3 sekunder. Hvis ikke klikk <a href='$thisfile'>her</a></p>"; // The text that the user will see after entering something in the guestbook. $errornoname = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>You have to enter a name!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>"; // Text to print out when no name has been entered in the entry. $errornomsg = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>You have to enter a message!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>"; // Text to print out when no message has been entered in the entry. $gbedited = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>Guestbook has been edited!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>"; // Text to print out when guestbook has been edited. // ======================================== // Do not change under here // ======================================== $gbpage = "$_SERVER[PHP_SELF]"; $date = date("$dateshow"); $name = htmlentities(strip_tags($_POST['name'])); $email = htmlentities(strip_tags($_POST['email'])); $homepage = htmlentities(strip_tags($_POST['homepage'])); $message = nl2br(htmlentities(strip_tags($_POST['message']))); $message = str_replace(array("\r", "\n"), '', $message); $message = wordwrap($message, 75, "<br />", true); $printfull = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><tr><td><strong>Email:</strong></td><td><a href=\"mailto:$email\">$email</a></td></tr><tr><td><strong>Homepage:</strong></td><td><a href=\"$homepage\" target=\"_blank\">$homepage</a></td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n"; $printnoemail = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><td><strong>Homepage:</strong></td><td><a href=\"$homepage\" target=\"_blank\">$homepage</a></td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n"; $printnopage = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><tr><td><strong>Email:</strong></td><td><a href=\"mailto:$email\">$email</a></td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n"; $printnoemailpage = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n"; // ======================================== // SCRIPT START !!! // ======================================== switch($_GET['id']) { default: ?> <table border="0" width="80%"> <tr> <td align="left"> <table> <form action="<?php echo $gbpage; ?>?id=1" method="post" name="submitform0"> <tr> <td><strong>Name:</strong></td> <td> <input type="text" name="name" size="40" maxlength="50"></td> </tr> <tr> <td><strong>Email:</strong></td> <td> <input type="text" name="email" size="40" maxlength="50"></td> </tr> <tr> <td><strong>Homepage:</strong></td> <td> <input type="text" name="homepage" size="40" maxlength="50" value="http://"></td> </tr> <tr> <td valign="top"><strong>Message:</strong></td> <td><textarea name="message" cols="30" rows="7"></textarea></td> </tr> <tr> <td></td> <td><input type="submit" name="submit1" value="Submit"></td> </tr> </form> </table></td> </tr> <tr> <td align="left"><span style="font-style: normal"><br> <?php $gb = file($gbfile); $gb = array_reverse($gb); foreach ($gb as $guestbook) { echo stripslashes($guestbook); } break; case 1: if($name == "") { echo $errornoname; } elseif($message == "") { echo $errornomsg; } elseif($email == "") { if($homepage == "" || $homepage == "http://") { $writeinfo = $printnoemailpage; $printer = fopen($gbfile,"a"); fwrite($printer,$writeinfo); fclose($printer); echo $thankstxt; } else { $writeinfo = $printnoemail; $printer = fopen($gbfile, 'a'); fwrite($printer,$writeinfo); fclose($printer); echo $thankstxt; } } elseif($homepage == "" || $homepage == "http://") { $writeinfo = $printnopage; $printer = fopen($gbfile, 'a'); fwrite($printer,$writeinfo); fclose($printer); echo $thankstxt; } else { $writeinfo = $printfull; $printer = fopen($gbfile, 'a'); fwrite($printer,$writeinfo); fclose($printer); echo $thankstxt; } break; case 2: ?></span><table align="center"> <form action="<?php echo $gbpage; ?>?id=3" method="post" name="submitform"> <tr> <td> <address> <span style="font-style: normal"><strong>Username:</strong></span></address> </td> <td> <address> <span style="font-style: normal"> <input type="text" name="adminname" size="20"></span></address> </td> </tr> <tr> <td> <address> <span style="font-style: normal"><strong>Password:</strong></span></address> </td> <td> <address> <span style="font-style: normal"> <input type="password" name="adminpass" size="20"></span></address> </td> </tr> <tr> <td> <address> </address> </td> <td> <address> <span style="font-style: normal"> <input type="submit" name="submit" value="Login"></span></address> </td> </tr> </form> </table> <address align="center"><span style="font-style: normal"> <?php break; case 3: if($_POST["adminname"] == $username) { if($_POST["adminpass"] == $password) { ?> <a href="<?php echo $gbpage; ?>?id=2">Admin</a></span></address> <table align="center"> <form name="guestbookedit" method="post" action="<?php echo $gbpage; ?>?id=4"> <tr> <td> </html>
Here is some of the code
You can check out the site here: http://home.no.net/snurrebo/guestbook.php