ugrás a tartalomhoz

spamszűrés

Batka1985 · 2010. Már. 2. (K), 18.34
Sziasztok! Lentebb megtaláltok egy vendégkönyv php kódját, nem én írtam csak letöltöttem netről. Én ezt szeretném használni az oldalamon, de annyi spamet kapok rá h használhatatlan a vendégkönyv. Hogyan tudnám kiküszöbölni a kéretlen spam-eket? Légyszives segítsetek, mert már 1-2 ötletem kudarcba fulladt. Captcha-t próbáltam de nem sikerült beillesztenem a kódba úgy h működjön is. Próbáltam spamszűrő progit de az se működött, valszeg vlmit rosszul csináltam. Sok magyarázattal ha kérhetném mert még igencsak kezdő vagyok.
Köszönöm előre is a segítségeteket!
  1. <?  
  2. /* ----------------------------------------------------------------------------- */  
  3. /*                                                                               */  
  4. /* Copyright (C) 2005, Script by RP-Draw WebDesign, Delfzijl, Netherlands        */  
  5. /* http://www.rp-draw.nl/scripts/index.html - info##kukac##rp-draw.nl                    */  
  6. /* Version 2.1.01 - 28-03-2005                                                   */  
  7. /*                                                                               */  
  8. /*                                                                               */  
  9. /* GPL LICENCE                                                                   */  
  10. /* This file is part of Flat-Guest guestbook.                                    */  
  11. /*                                                                               */  
  12. /* Flat-Guest guestbook is free software; you can redistribute it and/or modify  */  
  13. /* it under the terms of the GNU General Public License as published by          */  
  14. /* the Free Software Foundation; either version 2 of the License, or             */  
  15. /* (at your option) any later version.                                           */  
  16. /*                                                                               */  
  17. /* Flat-Guest guestbook is distributed in the hope that it will be useful,       */  
  18. /* but WITHOUT ANY WARRANTY; without even the implied warranty of                */  
  19. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 */  
  20. /* GNU General Public License for more details.                                  */  
  21. /*                                                                               */  
  22. /* You should have received a copy of the GNU General Public License             */  
  23. /* along with Flat-Guest guestbook; if not, write to the Free Software           */  
  24. /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA     */  
  25. /*                                                                               */  
  26. /* ----------------------------------------------------------------------------- */  
  27.   
  28.   
  29. error_reporting('E_ALL & ~E_NOTICE');  
  30. //Script file version  
  31.   $version = "2.1.01";  
  32.   
  33. //Script file version date  
  34.   $versiondate = "14-0-2010";  
  35.   
  36. // Ttitle of the web page  
  37.   $title = "Vendégkönyv";  
  38.   
  39. //####Change "12345" with your own password. It's required when you delete an entry  
  40.   $admin_password = "*******";  
  41.   
  42. //####Change "hu" to your language   
  43.   $language = 'hu';  
  44.                     // dk = Danish, by Robert van Rees ** partial translation Need help.  
  45.                     // nl = Dutch, by Robert van Rees  
  46.                     // en = English by Gary Cleghorn  
  47.                     // fr = French, by Loďc Reynaud  
  48.                     // de = German, by Robert van Rees  
  49.                     // hu = Hungarian, by Timea Vrasko  
  50.                     // no = Norwegian, by Vegard Sřbstad Alsli  
  51.                     // pt = Portuguese, by Mirele Sotelo Gonçalves  
  52.                     // es = Spanish, by Manuel  
  53.                     // se = swedish, by Roffe Johnzon  
  54.   
  55. //####Change to your website adres.  
  56. //####When people click the back button on the main page the will be taken here...  
  57.   $website = "http://www.valami.hu";  
  58.   
  59. //Maximum entry per page when you view your guestbook  
  60.   $max_entry_per_page = "10";  
  61.   
  62. //--only 2000 characters allowed for comment  
  63.   $maxchar = 2000;  
  64.   
  65. //Name of file used to store your entry  
  66. //Be sure that your server can write in this file by CHMOD it to 777  
  67.   $data_file = "data.dat";  
  68.   
  69. //Maximum entry stored in data file  
  70.   $max_record_in_data_file = "30";  
  71.   
  72. //Color & font setting  
  73.   $background = "#CD853F";                      // Page color  
  74.   $table_top = "#800000";                       // Color of the first row  
  75.   $font_top_color = "#FFFFFF";                  // Font Color of the text on the first row  
  76.   $table_content_1a = "#EFDDC7";                // Background color of odd messages  
  77.   $table_content_2a = "#deb887";                // Background color of even messages  
  78.   $table_bottom = "#800000";                    // Color of the last row  
  79.   $table_width = "95%";                         // Width of the message table  
  80.   $font_bottom_color = "#FFFFFF";               // Font Color of the text on the last row  
  81.   $table_border = "#800000";                    // Bordercolor of the main message table  
  82.   $link = "#FFFFFF";                            // Color of some of the links (see style sheet)  
  83.   $visited_link = "#FFFFFF";  
  84.   $active_link = "#CC0000";  
  85.   $font_face = "verdana";                       // Fontface of some of the text (zee style sheet)  
  86.   $linecolor = "#800000";                       // Color of line above messages  
  87.   $message_font_face = "arial";                 // Fontface of messages (also see style sheet)  
  88.   $message_font_size = "2";                     // Fontsize of messages (also see style sheet)  
  89.   $message_font_color = "#000000";              // Fontcolor of messages (also see style sheet)  
  90.   
  91.   
  92. $conf = array();                                // Don't edit this line!  
  93. /* language-file selection */  
  94. $conf['lang'] = $language;  
  95. $lang = array();  
  96. $langfile = "language/".$language."-lang.php";  
  97.   
  98. // Check if language file exists.  
  99. if (!file_exists($langfile)) {  
  100. echo "<FONT FACE=\"$page_font\" SIZE=\"$page_font_size\" COLOR=\"$page_font_color\">";  
  101.     echo "<B>ERROR !</B><BR>The Script can not find the language file <b>$langfile</B>.<BR> Please check and change the language value: \"<b>$language</b>\" in the config area of fggbook.php.</font><BR>";  
  102.         exit;  
  103. else {  
  104. include $langfile;  
  105. }  
  106.   
  107. // +++ Start of Script +++ DO NOT EDIT BELOW THIS LINE ++++++++++++++++++++++++++++++++++++++++++  
  108. if (!emptyempty($_GET)) {  
  109.         if (isset($_GET["do"])) $do = $_GET["do"];  
  110.         if (isset($_GET["id"])) $id = $_GET["id"];  
  111.         if (isset($_GET["page"])) $page = $_GET["page"];  
  112. else if (!emptyempty($HTTP_GET_VARS)) {  
  113.         if (isset($HTTP_GET_VARS["do"])) $do = $HTTP_GET_VARS["do"];  
  114.         if (isset($HTTP_GET_VARS["id"])) $id = trim($HTTP_GET_VARS["id"]);  
  115.         if (isset($HTTP_GET_VARS["page"])) $page = trim($HTTP_GET_VARS["page"]);  
  116. }  
  117.   
  118. if (isset($_POST["do"])) $do = $_POST["do"];  
  119. else if (isset($HTTP_POST_VARS["do"])) $do = $HTTP_POST_VARS["do"];  
  120.   
  121. if (!isset($PHP_SELF)) {  
  122.         if (isset($_SERVER["PHP_SELF"])) $PHP_SELF = $_SERVER["PHP_SELF"];  
  123.         else if (isset($HTTP_SERVER_VARS["PHP_SELF"])) $PHP_SELF = $HTTP_SERVER_VARS["PHP_SELF"];  
  124. }  
  125. if (!isset($DOC_ROOT)) {  
  126.         if (isset($_SERVER['DOCUMENT_ROOT'])) $DOC_ROOT = $_SERVER['DOCUMENT_ROOT'];  
  127.         else if (isset($HTTP_SERVER_VARS['DOCUMENT_ROOT'])) $DOC_ROOT = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];  
  128. }  
  129.   
  130. // reverse strrchr() - PHP v4.0b3 and above  
  131. function reverse_strrchr($haystack$needle)  
  132. {  
  133.    $pos = strrpos($haystack$needle);  
  134.    if($pos === false) {  
  135.        return $haystack;  
  136.    }  
  137.    return substr($haystack, 0, $pos + 1);  
  138. }  
  139. $data1 = $DOC_ROOT;  
  140. $data2 = reverse_strrchr($PHP_SELF'/');   
  141. $data_path = "$data1$data2$data_file";  
  142.   
  143. if (!isset($do)) $do = "";  
  144. else if (preg_match("/\W/",$do)) $do = "";  
  145.   
  146. if (!isset($pageor $page == 0) $page=1;  
  147.   
  148. // Check if date file exists.  
  149. if (!file_exists($data_path)) {  
  150.     echo "<B>".$lang[$conf['lang']]['error']."</B><BR> ".$lang[$conf['lang']]['no-datafile']."<BR>path : <b>$data_path</B><BR>";  
  151.         exit;  
  152. else {  
  153.   if ($max_record_in_data_file <> 0) {  
  154.      $f = file($data_path);  
  155.      rsort($f);  
  156.      $j = count($f);  
  157.      if ($j > $max_record_in_data_file) {  
  158.         $rf = fopen($data_path,"w");  
  159.               for ($i=0; $i<$max_record_in_data_file$i++) {  
  160.                   fwrite($rf,$f[$i]);  
  161.                    }  
  162.                     fclose($rf);  
  163.      }  
  164.   }  
  165. }  
  166.   
  167.    
  168.   
  169.   
  170. switch ($do) {  
  171. case "":  
  172.    $record = file($data_path);  
  173.    rsort($record);  
  174.    $jmlrec = count($record);  
  175. ?>  
  176. <?  
  177. /*          Ez a Script fölött ne legyen semmiféle html tag. 
  178. Etz a <head> fölé rakd. vagy ha van ilyened:<html> allor e-fölé. 
  179.  
  180. */  
  181. if($_POST[sendThis]){  
  182. if((($robotcookie)&&($_COOKIE["robot"] != $robotcookie))||(!$robotcookie)){  
  183. setcookie("robot""", -3600);  
  184. $_POST = NULL;  
  185. }  
  186. }  
  187. ?>  
  188. <HTML>  
  189.       
  190.       
  191.       
  192. <HEAD>  
  193. <TITLE><?php echo "$title" ?></TITLE>  
  194. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">  
  195. <LINK REL="StyleSheet" HREF="fg-style.css" TYPE="text/css">    
  196.       
  197. </HEAD>  
  198. <BODY bgcolor="<?php echo $background; ?>" link="<?php echo $link; ?>" vlink="<?php echo $visited_link; ?>" alink="<?php echo $active_link; ?>" topmargin="0" marginheight="0">  
  199. <!--SPAMSZŰRŐ------------------------------------------------------------->  
  200. <script>  
  201.  function readCookie(name) {  
  202. var nameEQ = name + "=";  
  203. var ca = document.cookie.split(';');  
  204. for(var i=0;i < ca.length;i++) {  
  205. var c = ca[i];  
  206. while (c.charAt(0)==' ') c = c.substring(1,c.length);  
  207. if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);  
  208. }  
  209. return null;  
  210. }  
  211.   
  212.  function formrobot(click){  
  213.   
  214.   var form = document.getElementsByTagName('form');  
  215.  for(var f=0; f<form.length; f++){  
  216.   
  217.   
  218. var x = readCookie('robot')  
  219.   
  220. document.cookie ='robot=<?= time(); ?>';  
  221.   
  222.     var inpElement = document.createElement("input");  
  223. inpElement.value = x;  
  224. inpElement.id = "ipaddress";  
  225. inpElement.name = "robotcookie";  
  226. inpElement.type = "hidden";  
  227.     form[f].appendChild(inpElement);  
  228.   
  229. if(click){  
  230.  document.getElementById("formonclick"+f).innerHTML = 1;  
  231. }else{  
  232. var newdiv = document.createElement('div');  
  233. newdiv.id = "formonclick"+f;  
  234. newdiv.style.display = "none";  
  235. newdiv.innerHTML = "0";  
  236. document.body.appendChild(newdiv);  
  237. }  
  238.    var input = form[f].getElementsByTagName('input');  
  239. for(var i=0; i<input.length; i++){  
  240. if(input[i].type != "hidden"){  
  241. if(input[i].onclick){  
  242. input[i].getAttribute("onkeyup""formrobot('1');", 0);  
  243. }else{  
  244. if(document.all){  
  245. input[i].setAttribute("onclick"function() { formrobot('1');  }, 0);  
  246.  }else{  
  247. input[i].setAttribute("onclick""formrobot('1'); ", 0);  
  248. }  
  249. }  
  250. }  
  251. if(input[i].type == "submit"){  
  252.   
  253. if(document.getElementById("formonclick"+f).innerHTML == 0){  
  254. input[i].disabled = "disable";  
  255. }else{  
  256. input[i].disabled = "";  
  257. }  
  258. }  
  259. }  
  260.   }  
  261.  }  
  262.  formrobot();  
  263.  </script>  
  264. <!--SPAMSZŰRŐ VÉGE-------------------------------------------------------->  
  265. <h1><?php echo $lang[$conf['lang']]['read-gbook-title']; ?></h1>  
  266.   
  267. <!-- start Top Row message board with link to sign guestbook -->  
  268. <TABLE align=center border=0 cellPadding=2 cellSpacing=0 width="<?php echo $table_width; ?>">  
  269.   <TBODY>  
  270.   <TR>  
  271.     <TD class=font2 width="56%"><?PHP echo date("Y.m.d   h:m"); ?></TD>  
  272.     <TD class=font1 align=right width="44%"><B><FONT SIZE="2" ><img src="home.gif" width="16" height="16" border="0" alt="<?php echo $lang[$conf['lang']]['sign-but3'] ?>" title="<?php echo $lang[$conf['lang']]['sign-but3'] ?>" align=absmiddle><A class=font1 HREF='<?php echo $website; ?>'><?php echo $lang[$conf['lang']]['sign-but3'] ?></A>&nbsp; &nbsp;   
  273.     <IMG src="sign.gif" width=15 alt="<?php echo $lang[$conf['lang']]['sign-gbook-link']; ?>" title="<?php echo $lang[$conf['lang']]['sign-gbook-link']; ?>" align=absmiddle><A class=font1 HREF="<?PHP echo "$PHP_SELF?do=add_form&page=$page" ?>">  
  274.       <?php echo $lang[$conf['lang']]['sign-gbook-link']; ?></FONT></B></a>  
  275.       </TD></TR></TBODY></TABLE><br>  
  276. <!-- End Top Row message board -->  
  277.   
  278.    <TABLE align=center bgcolor="<?PHP echo $table_border; ?>" border=0 cellPadding=5 cellSpacing=1 width="60%"> <!--méretezi az egész oldal szélességét-->  
  279.   
  280.  <TR bgColor="<?php echo $table_top; ?>">  
  281.     <TD width="32%"><FONT color="<?php echo $font_top_color; ?>"   
  282.       FACE="<?php echo $font_face?>" size=2><B><?php echo $lang[$conf['lang']]['signed-by']; ?></B></FONT></TD>  
  283.     <TD width="68%"><FONT color="<?php echo $font_top_color; ?>"   
  284.       FACE="<?php echo $font_face; ?>"  
  285.     size=2><B><?php echo $lang[$conf['lang']]['messages']; ?></B></FONT></TD></TR>  
  286.   
  287. <?  
  288.       $jml_page = intval($jmlrec/$max_entry_per_page);  
  289.       $sisa = $jmlrec%$max_entry_per_page;  
  290.       if ($sisa > 0) $jml_page++;  
  291.       $no = $page*$max_entry_per_page-$max_entry_per_page;  
  292.       if ($jmlrec == 0) echo "<TR><TD colspan=2 bgcolor='$table_content_1a' align='center'><FONT color='$message_font_color' SIZE='3' FACE='$font_face'><b>".$lang[$conf['lang']]['no-messages']."</b></FONT></TD></TR>";  
  293.   
  294.                 $w = 0; //--Color  
  295.         for ($i=0; $i<$max_entry_per_page$i++) {  
  296.                     $no++;  
  297.                     $recno = $no-1;  
  298.                     if (isset($record[$recno])) {  
  299.                        $row = explode("|~~|",$record[$recno]);  
  300.                            if ($w==0) {  
  301.                                    $warna = $table_content_1a;  
  302.                                         //$warna = "#c6d7ec";  
  303.                                             $w=1;  
  304.                            } else {  
  305.                                    $warna = $table_content_2a;  
  306.                                         //$warna = "#D9E4F2";  
  307.                                         $w=0;  
  308.                                     }  
  309. //---Displaying Records--  
  310.   
  311.                 echo "<TR bgColor='$warna'><TD vAlign=top width='32%'>  
  312.                 <TABLE border=0 cellPadding=2 cellSpacing=0><TBODY>";  
  313.   
  314.         echo "<TR><TD class=font1 colSpan=2><IMG border=0 height=17 src='user.gif' width=18 alt='".$lang[$conf['lang']]['userinfo1']."$row[3]' title='".$lang[$conf['lang']]['userinfo1']."$row[3]'><b> &nbsp;$row[3]</b></TD><TR>";  
  315.         echo "<TR><TD class=font2 colSpan=2>";  
  316.                 if (trim($row[7])<>"" and trim($row[7])<>"http://")  
  317.                 {  
  318.                 if (ereg("^http://", trim($row[7])))  
  319.         echo "<A class=font2 HREF='$row[7]'TARGET='_blank'><IMG SRC='homepage.gif' BORDER=0 ALT='".$lang[$conf['lang']]['userinfo2']."$row[7]' title='".$lang[$conf['lang']]['userinfo2']."$row[7]'></A> &nbsp;<A HREF='$row[7]'TARGET='_blank'>$row[7]</A>";  
  320.                  else  
  321.         echo "<A class=font2 HREF='http://$row[7]' TARGET='_blank'><IMG SRC='homepage.gif' BORDER=0 ALT='".$lang[$conf['lang']]['userinfo2']."$row[7]' title='".$lang[$conf['lang']]['userinfo2']."$row[7]'></A> &nbsp;<A HREF='http://$row[7]' TARGET='_blank'>$row[7]</A>";  
  322.                 }  
  323.         echo "</TD></TR>";  
  324.                 if ($row[4] == "")  
  325.                 {  
  326.         echo " ";}  
  327.                  else {  
  328.         echo "<TR><TD class=font2 colSpan=2><A href='mailto:$row[4]'><IMG alt='".$lang[$conf['lang']]['userinfo3']."$row[4]' title='".$lang[$conf['lang']]['userinfo3']."$row[4]' border=0 height=15 src='email.gif' width=15></A> &nbsp;<A HREF='mailto:$row[4]'>$row[4]</a></TD></TR>";  
  329.                 }  
  330.          echo "<TR><TD class=font2 colSpan=2><img src='location.gif' width=16 height=16 border=0 alt='".$lang[$conf['lang']]['userinfo4']."$row[5]' title='".$lang[$conf['lang']]['userinfo4']."$row[5]'> &nbsp;$row[5]</TD></TR>";  
  331.         echo "</TBODY></TABLE></TD>";  
  332.   
  333.         echo "<TD class=font1 valign=top width='68%'><!--<DIV align=left class=font3><B>$no .</B> &nbsp;--><img src=message.gif width=18 height=15 border=0 align=absmiddle alt='".$lang[$conf['lang']]['userinfo5a']."$no ".$lang[$conf['lang']]['userinfo5b']."$row[3]' title='".$lang[$conf['lang']]['userinfo5a']."$no ".$lang[$conf['lang']]['userinfo5b']."$row[3]'>";  
  334.         echo " &nbsp;<A HREF='$PHP_SELF?do=del&id=$row[1]&page=$page'><IMG SRC='slot.gif' width=15 height=16 ALT='".$lang[$conf['lang']]['userinfo6']."$no' title='".$lang[$conf['lang']]['userinfo6']."$no' border=0 align='center'></A> &nbsp;$row[2]</DIV>";  
  335.         echo "<HR SIZE=1 color='$linecolor' size='1' noshade>  
  336.               <div align=left valign=top>$row[6]</div></TD>";  
  337.         echo "</td></tr>";  
  338.   
  339.   
  340.         } //--end if  
  341. //--end for  
  342.   
  343. echo "<TR><TD bgcolor='$table_bottom' align='left' colspan='2'>";  
  344. echo "<Table width='100%' border='0' cellpadding='0' cellspacing='0'>";  
  345.   
  346. //--- Page Count Start  
  347.       echo "<TR><TD align='left'><FONT SIZE='1' FACE='$font_face' COLOR='$font_bottom_color'>";  
  348.       if ($jml_page > 1) {  
  349.            if ($page <> 1) echo "[<A HREF='$PHP_SELF?page=1'>".$lang[$conf['lang']]['pagenum-top']."</A>] "else echo "[".$lang[$conf['lang']]['pagenum-top']."] ";  
  350.            echo $lang[$conf['lang']]['pagenum-a'] ;  
  351.        if ($jml_page > 10) {  
  352.                   if ($page < 5) {  
  353.                     $start = 1;  
  354.                         $stop = 10;  
  355.                  } elseif ($jml_page - $page < 5) {  
  356.                     $start = $jml_page - 9;  
  357.                         $stop = $jml_page;  
  358.                  } else {  
  359.                     $start = $page-4;  
  360.                         $stop = $page+5;  
  361.                  }  
  362.                  if ($start <> 1) echo "... ";  
  363.          for ($p=$start$p<=$stop$p++) {  
  364.                  if ($p == $pageecho "<FONT color='$active_link'><B>$p</B></FONT>&nbsp;&nbsp;";  
  365.                          else echo "<A HREF='$PHP_SELF?page=$p'>$p</A>&nbsp;&nbsp;";  
  366.          }  
  367.                  if ($stop <> $jml_pageecho "... ";  
  368.                  echo "van $jml_page ";  
  369.        } else {  
  370.          for ($p=1; $p<=$jml_page$p++) {  
  371.                  if ($p == $pageecho "<FONT color='$active_link'><B>$p</B></FONT>&nbsp;&nbsp;";  
  372.                          else echo "<A HREF='$PHP_SELF?page=$p'>$p</A>&nbsp;&nbsp;";  
  373.          }  
  374.            }  
  375.        if ($page <> $jml_pageecho "[<A HREF='$PHP_SELF?page=$jml_page'>".$lang[$conf['lang']]['pagenum-bot']."</A>]"else echo "[".$lang[$conf['lang']]['pagenum-bot']."]";  
  376.       } else echo $lang[$conf['lang']]['pagenum-b'];  
  377.           echo "</FONT></TD><td bgcolor='$table_bottom' align='right' width='30%'><FONT size='2' face='$font_face' color='$active_link'><IMG src='sign.gif' width=12 align=absmiddle  alt=".$lang[$conf['lang']]['sign-gbook-link']." title=".$lang[$conf['lang']]['sign-gbook-link']."> <A HREF=$PHP_SELF?do=add_form&page=$page><B>".$lang[$conf['lang']]['sign-gbook-link']."</B></a></font></td></TR>";  
  378. //---Page Count End  
  379. echo "</TABLE>"  
  380. ?>  
  381.         </td></TR>  
  382.         </TABLE>  
  383.         <P>  
  384.         <TABLE align=center border=0 cellPadding=2 cellSpacing=0 width="95%">  
  385.         <TBODY><TR>  
  386.         <!--TD class=font2 align=center><b>Flat-Guest script by: <a class=font1 href="http://www.rp-draw.nl/scripts/index.html" target="_blank">RP-Draw WebDesign</a></b> - <b>Version: <?php echo $version;?></b></td></TR-->  
  387.         </TBODY></TABLE>  
  388.    </CENTER>  
  389.    </BODY>  
  390.    </HTML>  
  391. <?  
  392. break;  
  393. case "add_form":  
  394. ?>  
  395. <!-- Start Form --->  
  396. <html>  
  397. <head>  
  398. <title><?php echo "$title" ?></title>  
  399. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">  
  400. <LINK REL="StyleSheet" HREF="fg-style.css" TYPE="text/css">  
  401. </head>  
  402. <body bgcolor="<?php echo "$background" ?>">  
  403.   
  404. <h1><?PHP echo $lang[$conf['lang']]['sign-gbook-title']; ?></h1>  
  405.   
  406. <div align="center"> <br>  
  407.   <form method="post" action="<?php echo "$PHP_SELF" ?>">  
  408.   <input type="hidden" name="do" value="add">  
  409.     <table width="460" border="0" cellspacing="0" cellpadding="0" bgcolor="<?php echo "$table_border" ?>">  
  410.       <tr>  
  411.       <td>  
  412.         <div align="center">  
  413.             <table width="100%" border="0" cellspacing="1" cellpadding="5">  
  414.                   <tr>  
  415.                     <TD bgColor="<?php echo $table_top ?>" colSpan=2><B>  
  416.                     <FONT color='<?php echo $font_top_color ?>' face="<?php echo $font_face ?>" size=2>  
  417.                     <?PHP echo $lang[$conf['lang']]['sign-gbook-link']; ?>:</FONT></B></TD>  
  418.                   </tr>  
  419.               <tr bgcolor="<?php echo "$table_content_1a" ?>">  
  420.                 <td width="28%">  
  421.                   <div align="left"><font face="<?php echo $font_face?>" size="2"><IMG border=0 height=17 src='user.gif' width=18 alt="<?PHP echo $lang[$conf['lang']]['signinfo1']; ?>" title="<?PHP echo $lang[$conf['lang']]['signinfo1']; ?>">&nbsp;*<?PHP echo $lang[$conf['lang']]['signinfo1']; ?></font></div>  
  422.                 </td>  
  423.                 <td width="72%">  
  424.                   <input type="text" name="vname" size="40" maxlength="70">  
  425.                 </td>  
  426.               </tr>  
  427.               <tr bgcolor='<?php echo "$table_content_1a" ?>'>  
  428.                 <td width="28%">  
  429.                   <div align="left"><font face="<?php echo $font_face?>" size="2"><IMG border=0 height=17 src='email.gif' width=18 alt="<?PHP echo $lang[$conf['lang']]['userinfo3']; ?>" title="<?PHP echo $lang[$conf['lang']]['userinfo3']; ?>">&nbsp;<?PHP echo $lang[$conf['lang']]['signinfo2']; ?></font></div>  
  430.                 </td>  
  431.                 <td width="72%">  
  432.                   <input type="text" name="vemail" size="40" maxlength="100">  
  433.                 </td>  
  434.               </tr>  
  435.               <tr bgcolor='<?php echo "$table_content_1a" ?>'>  
  436.                 <td width="28%">  
  437.                   <div align="left"><font face="<?php echo $font_face?>" size="2"><IMG border=0 height=17 src='home.gif' width=18 alt="<?PHP echo $lang[$conf['lang']]['userinfo2']; ?>" title="<?PHP echo $lang[$conf['lang']]['userinfo2']; ?>">&nbsp;<?PHP echo $lang[$conf['lang']]['signinfo3']; ?></font></div>  
  438.                 </td>  
  439.                 <td width="72%">  
  440.                   <input type="text" name="vurl" size="40" maxlength="150" VALUE="http://">  
  441.                 </td>  
  442.               </tr>  
  443.               <tr bgcolor='<?php echo "$table_content_1a" ?>'>  
  444.                 <td width="28%">  
  445.                   <div align="left"><font face="<?php echo $font_face?>" size="2"><IMG border=0 height=17 src='location.gif' width=18 alt="<?PHP echo $lang[$conf['lang']]['signinfo4']; ?>" title="<?PHP echo $lang[$conf['lang']]['signinfo4']; ?>">&nbsp;*<?PHP echo $lang[$conf['lang']]['signinfo4']; ?></font></div>  
  446.                 </td>  
  447.                 <td width="72%">  
  448. <input type="text" name="vcountry" size="40" maxlength="100">  
  449.                 </td>  
  450.               </tr>  
  451.               <tr bgcolor="<?php echo "$table_content_1a" ?>">  
  452.                 <td valign="top" width="28%">  
  453.                   <div align="left"><font face="<?php echo $font_face?>" size="2"><IMG border=0 height=17 src='message.gif' width=18 alt="<?PHP echo $lang[$conf['lang']]['signinfo5']; ?>" title="<?PHP echo $lang[$conf['lang']]['signinfo5']; ?>">&nbsp;*<?PHP echo $lang[$conf['lang']]['signinfo5']; ?></font></div>  
  454.                 </td>  
  455.                 <td width="72%">  
  456.                   <textarea name="vcomment" cols="40" rows="7" wrap="VIRTUAL"></textarea><BR><font size=1 FACE="<?php echo $font_face?>">* <?PHP echo $lang[$conf['lang']]['signinfo6']; ?></font>  
  457.                 </td>  
  458.               </tr>  
  459.               <tr bgcolor="<?php echo "$table_content_1a" ?>">  
  460.                 <td colspan="2" bgcolor="<?php echo "$table_bottom" ?>">  
  461.                   <div align="center"><font face="<?php echo $font_face?>" size="3">  
  462.                     <font size="2">  
  463.                     <input class="button" type="submit" value="<?PHP echo $lang[$conf['lang']]['sign-but1']; ?>">  
  464.                     <input class="button" type="reset" value="<?PHP echo $lang[$conf['lang']]['sign-but2']; ?>">  
  465.                     <input class="button" type="button" value="<?PHP echo $lang[$conf['lang']]['sign-but3']; ?>" onclick="window.location='<?php echo "$PHP_SELF?page=$page" ?>'">  
  466.                     </font></font></div>  
  467.                 </td>  
  468.               </tr>  
  469.             </table>  
  470.         </div>  
  471.       </td>  
  472.     </tr>  
  473.   </table>  
  474.   </form>  
  475. </div>  
  476. <TABLE align=center border=0 cellPadding=2 cellSpacing=0 width="95%">  
  477. <TBODY><TR>  
  478. <TD class=font2 align=center><b>Flat-Guest script by: <a class=font1 href="http://www.rp-draw.nl/scripts/index.html" target="_blank">RP-Draw WebDesign</a></b> - <b>Version: <?php echo $version;?></b></td></TR>  
  479. </TBODY></TABLE>  
  480. </body>  
  481. </html>  
  482. <!-- End of entry form -->  
  483. <?  
  484. break;  
  485. case "add":  
  486.    if (!emptyempty($_POST)) {  
  487.            if (isset($_POST["vname"])) {  
  488.                    $vname = $_POST["vname"];  
  489.                    if (strlen($vname) > 70) $vname = substr($vname,0,70);  
  490.            }  
  491.            if (isset($_POST["vemail"])) {  
  492.                    $vemail = $_POST["vemail"];  
  493.                    if (strlen($vemail) > 100) $vemail = substr($vemail,0,100);  
  494.            }  
  495.            if (isset($_POST["vurl"])) {  
  496.                    $vurl = $_POST["vurl"];  
  497.                    if (strlen($vurl) > 150) $vurl = substr($vurl,0,150);  
  498.            }  
  499.            if (isset($_POST["vcountry"])) {  
  500.                    $vcountry = $_POST["vcountry"];  
  501.                    if (strlen($vcountry) > 50) $vcountry = substr($vcountry,0,50);  
  502.            }  
  503.            if (isset($_POST["vcomment"])) $vcomment = $_POST["vcomment"];  
  504.    } else if (!emptyempty($HTTP_POST_VARS)) {  
  505.            if (isset($HTTP_POST_VARS["vname"])) {  
  506.                    $vname = $HTTP_POST_VARS["vname"];  
  507.                    if (strlen($vname) > 70) $vname = substr($vname,0,70);  
  508.            }  
  509.            if (isset($HTTP_POST_VARS["vemail"])) {  
  510.                    $vemail = $HTTP_POST_VARS["vemail"];  
  511.                    if (strlen($vemail) > 100) $vemail = substr($vemail,0,100);  
  512.            }  
  513.            if (isset($HTTP_POST_VARS["vurl"])) {  
  514.                    $vurl = $HTTP_POST_VARS["vurl"];  
  515.                    if (strlen($vurl) > 150) $vurl = substr($vurl,0,150);  
  516.            }  
  517.            if (isset($HTTP_POST_VARS["vcountry"])) {  
  518.                    $vcountry = $HTTP_POST_VARS["vcountry"];  
  519.                    if (strlen($vcountry) > 50) $vcountry = substr($vcountry,0,50);  
  520.            }  
  521.            if (isset($HTTP_POST_VARS["vcomment"])) $vcomment = $HTTP_POST_VARS["vcomment"];  
  522.    }  
  523.   
  524. // ERROR - Empty fields  
  525.    if (trim($vname)=="" or trim($vcountry)=="" or trim($vcomment)=="") {  
  526.       echo "<HTML>  
  527.             <head>  
  528.             <title>".$lang[$conf['lang']]['error']." - $title></title>  
  529.             <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>  
  530.             <LINK REL='StyleSheet' HREF='fg-style.css' TYPE='text/css'>  
  531.             </head>";  
  532.       echo "<BODY bgcolor='$background'>  
  533.             <H2>".$lang[$conf['lang']]['error']."</H2>  
  534.             <FONT SIZE=2 FACE='$font_face'>".$lang[$conf['lang']]['empty-fields']."<B><A class=font1 HREF='javascript:history.back()'>".$lang[$conf['lang']]['click-here']."</A></B> ".$lang[$conf['lang']]['try-again']."</FONT>  
  535.             </BODY>  
  536.             </HTML>";  
  537.           exit;  
  538.    }  
  539.   
  540. // ERROR - Wrong Email address  
  541.    if (trim($vemail)!="" and !preg_match("/([\w\.\-]+)(\@[\w\.\-]+)(\.[a-z]{2,4})+/i"$vemail)) {  
  542.       echo "<HTML>  
  543. <head>  
  544. <title>".$lang[$conf['lang']]['error']." - $title></title>  
  545. <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>  
  546. <LINK REL='StyleSheet' HREF='fg-style.css' TYPE='text/css'>  
  547. </head>";  
  548.       echo "<BODY bgcolor='$background'>  
  549. <H2>".$lang[$conf['lang']]['error']."</H2>  
  550. <FONT SIZE=2 FACE='$font_face'>".$lang[$conf['lang']]['wrong-email']."<B><A class=font1 HREF='javascript:history.back()'>".$lang[$conf['lang']]['click-here']."</A></B> ".$lang[$conf['lang']]['try-again']."</FONT>  
  551. </BODY>  
  552. </HTML>";  
  553.           exit;  
  554.    }  
  555.   
  556. // ERROR - Wrong URL address  
  557.    if (trim($vurl) <> "") {  
  558.           if (strtolower(trim($vurl)) <> "http://") {  
  559.          if (!preg_match ("#^http://[_a-z0-9-]+\\.[_a-z0-9-]+#i"$vurl)) {  
  560.       echo "<HTML>  
  561. <head>  
  562. <title>".$lang[$conf['lang']]['error']." - $title></title>  
  563. <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>  
  564. <LINK REL='StyleSheet' HREF='fg-style.css' TYPE='text/css'>  
  565. </head>";  
  566.       echo "<BODY bgcolor='$background'>  
  567. <H2>".$lang[$conf['lang']]['error']."</H2>  
  568. <FONT SIZE=2 FACE='$font_face'>".$lang[$conf['lang']]['wrong-url']."<B><A class=font1 HREF='javascript:history.back()'>".$lang[$conf['lang']]['click-here']."</A></B> ".$lang[$conf['lang']]['try-again']."</FONT>  
  569. </BODY>  
  570. </HTML>";  
  571.                 exit;  
  572.           }  
  573.       }  
  574.    }  
  575.   
  576. // ERROR - Message to long  
  577.    $test_comment = explode(" ",$vcomment);  
  578.    $jmltest = count($test_comment);  
  579.    for ($t=0; $t<$jmltest$t++) {  
  580.       if (strlen(trim($test_comment[$t])) > 300) {      //MAXIMUM KARAKTEREK SZÁMÁT ADJA MEG//  
  581.       echo "<HTML>  
  582. <head>  
  583. <title>".$lang[$conf['lang']]['error']." - $title></title>  
  584. <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>  
  585. <LINK REL='StyleSheet' HREF='fg-style.css' TYPE='text/css'>  
  586. </head>";  
  587.       echo "<BODY bgcolor='$background'>  
  588. <H2>".$lang[$conf['lang']]['error']."</H2>  
  589. <FONT SIZE=2 FACE='verdana'>".$lang[$conf['lang']]['no-abuse1']."$maxchar ".$lang[$conf['lang']]['no-abuse2']."<B><A class=font1 HREF='javascript:history.back()'>".$lang[$conf['lang']]['click-here']."</A></B> ".$lang[$conf['lang']]['try-again']."</FONT>  
  590. </BODY>  
  591. </HTML>";  
  592.             exit;  
  593.           }  
  594.    }  
  595.   
  596.    if (strlen($vcomment) > $maxchar$vcomment = substr($vcomment,0,$maxchar)."...";  
  597.    $idx = date("YmdHis");  
  598.    $tgl = date("F d, Y - h:i A");  
  599.    $vname = str_replace("<","",$vname);  
  600.    $vname = str_replace(">","",$vname);  
  601.    $vname = str_replace("~","-",$vname);  
  602.    $vname = str_replace("'","&quot;",$vname);  
  603.   
  604.    $vcomment = str_replace("<","&lt;",$vcomment);  
  605.    $vcomment = str_replace(">","&gt;",$vcomment);  
  606.    $vcomment = str_replace("~","-",$vcomment);  
  607.    $vcomment = str_replace("'","&quot;",$vcomment);  
  608.   
  609.    $vurl = str_replace("<","",$vurl);  
  610.    $vurl = str_replace(">","",$vurl);  
  611.    $vcomment = str_replace("\r\n","<BR>",$vcomment);  
  612.    $vcomment = str_replace("\r","",$vcomment);  
  613.    $vcomment = str_replace("\n","",$vcomment);  
  614.   
  615.    if (preg_match("#<|>|'\~#",$vcountry)) exit;  
  616.    if (preg_match("/[^a-z ,-]/i",$vcountry)) $vcountry = "...";  
  617.    $newdata = "|~~|$idx|~~|$tgl|~~|$vname|~~|$vemail|~~|$vcountry|~~|$vcomment|~~|$vurl|~~|\n";  
  618.    $newdata = stripslashes($newdata);  
  619.   
  620.    $tambah = fopen($data_path,"a");  
  621.    fwrite($tambah,$newdata);  
  622.    fclose($tambah);  
  623.   
  624. // Message added to Guestbook  
  625.       echo "<HTML>  
  626. <head>  
  627. <title>$title</title>  
  628. <META HTTP-EQUIV='REFRESH' CONTENT='1; URL=$PHP_SELF'>  
  629. <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>  
  630. <LINK REL='StyleSheet' HREF='fg-style.css' TYPE='text/css'>  
  631. </head>";  
  632.       echo "<BODY bgcolor='$background'>  
  633. <H1>".$lang[$conf['lang']]['added1']."</H1>  
  634. <center>".$lang[$conf['lang']]['added2']."".$lang[$conf['lang']]['one-moment']."</center>  
  635. </BODY>  
  636. </HTML>";  
  637.   
  638. break;  
  639. case "del":  
  640.    $record = file($data_path);  
  641.    $jmlrec = count($record);  
  642.    for ($i=0; $i<$jmlrec$i++) {  
  643.        $row = explode("|~~|",$record[$i]);  
  644.            if ($id == $row[1]) {  
  645.               echo "<HTML>  
  646. <head>  
  647. <TITLE>".$lang[$conf['lang']]['delete-title']." - $title</TITLE>  
  648. <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>  
  649. <LINK REL='StyleSheet' HREF='fg-style.css' TYPE='text/css'>  
  650. </head>";  
  651.       echo "<BODY bgcolor='$background'>  
  652. <CENTER>  
  653. <h1>".$lang[$conf['lang']]['delete-title']."</h1>  
  654. <BR><BR>  
  655. <TABLE border=1 cellpadding=5 cellspacing=-1 width=450 bordercolor='#000000'>  
  656.     <TR>  
  657.     <TD bgcolor='$table_content_1a'>  
  658.     <FONT SIZE=2 FACE='$font_face'>  
  659.     <FONT SIZE='1'><B>$row[2]</FONT><BR>$row[3]</B> ".$lang[$conf['lang']]['from']." $row[5]<BR><A HREF='mailto:$row[4]'>$row[4]</A> &nbsp;$row[7] <P>$row[6]</FONT>  
  660.     </TD>  
  661.     </TR>  
  662. </TABLE>  
  663.                   ";  
  664.               break;  
  665.            }  
  666.    }  
  667. // echo "<FONT COLOR=\"RED\" >Demo version: Delete is disabled !</FONT><BR><BR>";  
  668.    echo "<FORM ACTION='$PHP_SELF' METHOD='post'>  
  669. <img src='slot.gif' width='16' height='16' border='0' alt='".$lang[$conf['lang']]['password-needed']."'>  
  670. <FONT FACE='$font_face' SIZE=2><B>".$lang[$conf['lang']]['admin-password']."</B></FONT>  
  671. <INPUT TYPE='password' NAME='pwd'>  
  672. <INPUT TYPE='hidden' NAME='do' VALUE='del2'>  
  673. <P>  
  674. <INPUT class=button TYPE='submit' VALUE='".$lang[$conf['lang']]['del-but1']."'>   
  675. <INPUT class=button TYPE='button' VALUE='".$lang[$conf['lang']]['del-but2']."' onclick='window.location=\"$PHP_SELF?page=$page\"'>  
  676. <INPUT TYPE='hidden' NAME='id' VALUE='$id'>  
  677. <INPUT TYPE='hidden' NAME='page' VALUE='$page'>  
  678. </FORM>  
  679. </CENTER>  
  680. </BODY>  
  681. </HTML>";  
  682. break;  
  683. case "del2":  
  684.    if (isset($_POST["pwd"])) $pwd = $_POST["pwd"];  
  685.    else if (isset($HTTP_POST_VARS["pwd"])) $pwd = $HTTP_POST_VARS["pwd"];  
  686.   
  687.    if (isset($_POST["id"])) $id = $_POST["id"];  
  688.    else if (isset($HTTP_POST_VARS["id"])) $id = $HTTP_POST_VARS["id"];  
  689.   
  690.    if (isset($_POST["page"])) $page = $_POST["page"];  
  691.    else if (isset($HTTP_POST_VARS["page"])) $page = $HTTP_POST_VARS["page"];  
  692.   
  693. // error - Wrong admin password  
  694.    if ($pwd <> $admin_password) {  
  695.          echo "<HTML>  
  696. <HEAD>  
  697. <TITLE>".$lang[$conf['lang']]['wrong-admin-password']." - $title</TITLE>  
  698. <META HTTP-EQUIV='REFRESH' CONTENT='1; URL=$PHP_SELF?page=$page'>  
  699. <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>  
  700. <LINK REL='StyleSheet' HREF='fg-style.css' TYPE='text/css'>  
  701. </HEAD>";  
  702.       echo "<BODY bgcolor='$background'>  
  703. <H1>".$lang[$conf['lang']]['wrong-admin-password']."</H1>  
  704. <center>".$lang[$conf['lang']]['one-moment']."</center>  
  705. </BODY>  
  706. </HTML>";  
  707.          exit;  
  708.    }  
  709.   
  710.    $record = file($data_path);  
  711.    $jmlrec = count($record);  
  712.    for ($i=0; $i<$jmlrec$i++) {  
  713.        $row = explode("|~~|",$record[$i]);  
  714.        if ($id==$row[1]) {  
  715.               $record[$i] = "";  
  716.                   break;  
  717.            }  
  718.    }  
  719.    $update_data = fopen($data_path,"w");  
  720.          for ($j=0; $j<$jmlrec$j++) {  
  721.         if ($record[$j] <> ""fputs($update_data,$record[$j]);  
  722.         }  
  723.          fclose($update_data);  
  724.   
  725. // report - message deleted  
  726.    echo "<HTML>  
  727. <HEAD>  
  728. <TITLE>".$lang[$conf['lang']]['deleted']." - $title</TITLE>  
  729. <META HTTP-EQUIV='REFRESH' CONTENT='1; URL=$PHP_SELF?page=$page'>  
  730. <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>  
  731. <LINK REL='StyleSheet' HREF='fg-style.css' TYPE='text/css'>  
  732. </HEAD>";  
  733.       echo "<BODY bgcolor='$background'>  
  734. <H1>".$lang[$conf['lang']]['deleted']."</H1>  
  735. <center>".$lang[$conf['lang']]['one-moment']."</center>  
  736. </BODY>  
  737. </HTML>";  
  738.   
  739. break;  
  740. //--end switch  
  741. ?>  
 
1

Tanás

janoszen · 2010. Már. 3. (Sze), 11.56
Ha elfogadsz tőlem egy tanácsot, sokkal inkább fogsz választ kapni, ha látszik a hozzászólásodból, hogy fordítottál rá energiát. Az abszolút minimum az, hogy kitakarítod a 62 km kódból a HTML részeket és csak a lényeges dolgokat hagyod meg.

A témához: több féle megoldás létezik.

  • Beteszel egy üres mezőt, amit JavaScripttel elrejtesz. Ha kitölti, nem fogadod el a kommentet.
  • Beteszel captchat.
  • Használsz Akismetet.
  • Elolvasod az általam írt cikket a Bayes szűrőkről és írsz egy Bayes szűrőt.