Jump to content


Photo

Help with php, i'am getting to much spam


  • Please log in to reply
2 replies to this topic

#1 XO101

XO101
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 27 October 2006 - 01:51 PM

Hi,
I've became a administrator of a page i didn't design, this page has an guestbook, the problem is that every guestbook entry is checked by me, i'm getting 100 / 200 emails a day with spam entry's for my guestbook.

i would like this to stop (Duh), but how, any suggestions, at the moment 3 of the 5 fields are required, but thats not working,

i would like a to make a sort of code like when you register here at phpfreaks, with a picture containing a code that has to be enterd in a specific field,
or else your entry wouldn't be sumbitted.

Could somebody help me,

below the entire code of the site, (sorry, some parts are in dutch0

<html>
<head>
<style type="text/css">
<!--
body {
    scrollbar-3d-light-color : #FFE3A0;
    scrollbar-arrow-color : #FFE3A0;
    scrollbar-base-color : #FFE3A0;
    scrollbar-dark-shadow-color : #FFE3A0;
    scrollbar-face-color : #FFA800;
    scrollbar-highlight-color : #FFFFFF;
    scrollbar-shadow-color : #FFE3A0;
    scrollbar-track-color: #FFE3A0;
    }
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: x-small;
font-weight: bold;
}
-->
</style>
<title>Teken het gastenboek.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>


<?

if ($bev == "yes")

{

include "connect.php";
$bevestig = mysql_query("UPDATE gastenboek SET bev=1 WHERE id='$ID'");

if ($bevestig)
{
echo "<font face=\"Verdana\" size=\"-1\">Het bericht is succesvol geplaatst.</font>";
exit;
}
else
{
echo "<font face=\"Verdana\" size=\"-1\" color=\"red\">Het bericht is NIET geplaatst. Probeer het nogmaals, of neem contact op met de webmaster.</font>";
exit;
}

}

if ($opslaan)
{
  if ($naam && $bericht && $email)
  {
include ('connect.php');
$naam = htmlspecialchars($naam);
$email = htmlspecialchars($email);
$website = htmlspecialchars($website);
$plaats = htmlspecialchars($plaats);
$bericht = htmlspecialchars($bericht);
$bericht = nl2br($bericht);
$website = ereg_replace('http://','',$website);


$insert = mysql_query("INSERT INTO gastenboek (naam, email, website, plaats, bericht) VALUES ('$naam','$email','$website','$plaats','$bericht')");
$gbid = mysql_insert_id();
if ($insert)
{
function send_mail($myname, $myemail, $contactname, $contactemail, $subject, $message)
{
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: \"".$myname."\" <".$myemail.">\n";
return(mail("\"".$contactname."\" <".$contactemail.">", $subject, $message, $headers));
}


//bericht
$message = '

<html>
<head>
<title>Gastenboek Amigo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="50%" border="1" cellspacing="0" cellpadding="2" bordercolor="#000000" align="center">
  <tr>
<td bgcolor="#FF9933">
  <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif"><b>GASTENBOEK Pssst... AMIGO </b></font></div>
</td>
  </tr>
  <tr>
<td height="271">
  <p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Er is een nieuw bericht geplaatst in het gastenboek:</font></p>
  <p><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">Naam:<br>
  '.$naam.'</font></p>
  <p><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">E-mail: <br>
  '.$email.'</font></p>
  <p><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"> Website: <br>
'.$website.'</font></p>
  <p><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"> Plaats: <br>
'.$plaats.'</font></p>
  <p><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"> Bericht:<br>
'.$bericht.'
  </font></p>
  <p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><a href="http://www.pssstamigo.nl/gastenboek/toevoeg.php?ID='.$gbid.'&bev=yes">Keur dit 
bericht goed </a></font></p>
  <p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Als deze
link om wat voor reden dan ook niet werkt, kun je het volgende adres in
de adresbalk van uw browser typen (of copy/paste):</font></p>
  <p><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">http://www.pssstamigo.nl/gastenboek/toevoeg.php?ID='.$gbid.'&amp;bev=yes</font></p>
  <p><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"><em><strong>Als je het bericht NIET goed wilt keuren, hoef je niets te doen!</strong></em> </font></p>      <p><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">Voor vragen kun je contact opnemen met de webmaster van www.pssstamigo.nl</font></p>      </td>
  </tr>
  <tr>
<td bgcolor="#FF9933">
  <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Pssst... Amigo </font></div>
</td>
  </tr>
</table>
</body>
</html>

';

if (send_mail("Pssst... Amigo", "webmaster@pssstamigo.nl", "Frank Meijers", "f.meyers1@chello.nl", "Er is een nieuw bericht geplaatst in het gastenboek van Pssst... Amigo.", $message))
{
echo "<br>";
echo "<font face=\"Verdana\" size=\"-1\">Uw bericht wordt na goedkeuring geplaatst. Alvast hartelijk dank voor uw inzending</font>";
exit;
}
else
{
echo "<br>";
echo "<font face=\"Verdana\" size=\"-1\" color=\"red\">Er is een fout opgetreden bij het plaatsen van een bericht. Probeer het opnieuw a.u.b.</font>";

}
}
}


  else
  {
  echo "<font face=\"verdana\" size=\"+1\" color=red><b>Niet alle verplichte velden zijn ingevuld.</b></font>";
  }
}

?>



<body bgcolor="#FFE3A0" text="#000000" link="#000000" vlink="#000000" alink="#000000">
<table width="100%" border="0" cellspacing="0" cellpadding="10" height="100%">
  <tr>
    <td width="10" bgcolor="#FFA800">&nbsp;</td>
    <td valign="top">
      <table width="100%" border="0" cellspacing="0" cellpadding="10">
        <tr>
          <td bgcolor="#FFA800"><font face="Comic Sans MS, Verdana, Tahoma, Arial"><b><font size="+1" color="#FFFFFF">Gastenboek</font></b></font></td>
        </tr>
        <tr>
          <td>
            <table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
              <tr>
    <td>
      <div align="left"><font face="verdana" size="-1"><b>Teken het gastenboek.</b></font></div>
    </td>
  </tr>
</table>
<form method=post action="toevoeg.php" >
  <input type="hidden" name="opslaan" value="1">
              <table width="500" cellspacing="0" cellpadding="2" bgcolor="#FFE3A0" align="center">
                <tr>
      <td colspan="3"><b><font face="verdana" size="-1" color="#DB692D">Velden
        met een * zijn verplicht.</font></b></td>
    </tr>
    <tr>
      <td width="50%"><b><font face="verdana" size="-1">Naam:</font></b></td>
      <td>
        <input type="text" name="naam" maxlength="150" size="50">      </td>
      <td valign="top"><font color="DB692D">*</font></td>
    </tr>
    <tr>
      <td width="50%"><b><font face="verdana" size="-1">E-mail adres:</font></b></td>
      <td>
        <input type="text" name="email" maxlength="75" size="50">      </td>
      <td valign="top"><font color="DB692D"></font></td>
    </tr>
    <tr>
      <td width="50%"><b><font face="verdana" size="-1">Website:</font></b></td>
      <td>
        <input type="text" name="website" maxlength="75" size="50">      </td>
      <td valign="top"><font color="DB692D"></font></td>
    </tr>
    <tr>
      <td width="50%"><b><font face="verdana" size="-1">Woonplaats:</font></b></td>
      <td>
        <input type="text" name="plaats" maxlength="75" size="50">      </td>
      <td valign="top"><font color="DB692D"></font></td>
    </tr>
    <tr>
      <td width="50%" valign="top"><b><font face="verdana" size="-1">Bericht:</font></b></td>
      <td><textarea name="bericht" rows="5" cols="50"></textarea></td>
      <td valign="top"><font color="DB692D">*</font></td>
    </tr>
    <tr>
      <td colspan="3"><font face="verdana" size="-1" color="#FF0000"><b><font color="#000000">Smilies:
        voer de code in die boven de smilie staat om hem in te voegen.</font></b></font></td>
    </tr>
    <tr>
      <td colspan="3">
                    <table width="100%" border="1" cellspacing="0" cellpadding="2" bgcolor="#FFE3A0" bordercolor="#DB692D">
                      <tr>
            <td width="12%">
              <div align="center"><b><font face="verdana" size="-1">:-)</font></b></div>            </td>
            <td width="12%">
              <div align="center"><b><font face="verdana"><font face="verdana"><font size="-1">):)</font></font></font></b></div>            </td>
            <td width="12%">
              <div align="center"><b><font face="verdana"><font face="verdana"><font size="-1">):</font></font></font></b></div>            </td>
            <td width="12%">
              <div align="center"><b><font face="verdana"><font face="verdana"><font size="-1">:-D</font></font></font></b></div>            </td>
            <td width="12%">
              <div align="center"><b><font face="verdana"><font face="verdana"><font size="-1">;-)</font></font></font></b></div>            </td>
            <td width="12%">
              <div align="center"><b><font face="verdana"><font face="verdana"><font size="-1">:-p</font></font></font></b></div>            </td>
            <td width="12%">
              <div align="center"><b><font face="verdana"><font face="verdana"><font size="-1">:-(</font></font></font></b></div>            </td>
            <td width="12%">
              <div align="center"><b><font face="verdana"><font face="verdana"><font size="-1">:love:</font></font></font></b></div>            </td>
          </tr>
          <tr>
            <td width="12%">
              <div align="center"><img src="../smilies/blij.gif" width="16" height="16"></div>            </td>
            <td width="12%">
              <div align="center"><img src="../smilies/boosblij.gif" width="15" height="15"></div>            </td>
            <td width="12%">
              <div align="center"><img src="../smilies/boos.gif" width="15" height="15"></div>            </td>
            <td width="12%">
              <div align="center"><img src="../smilies/haha.gif" width="15" height="15"></div>            </td>
            <td width="12%">
              <div align="center"><img src="../smilies/knipoog.gif" width="15" height="15"></div>            </td>
            <td width="12%">
              <div align="center"><img src="../smilies/tong.gif" width="15" height="15"></div>            </td>
            <td width="12%">
              <div align="center"><img src="../smilies/weeeh.gif" width="15" height="15"></div>            </td>
            <td width="12%">
              <div align="center"><img src="../smilies/love.gif" width="15" height="15"></div>            </td>
          </tr>
        </table>      </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2"><font face="verdana" size="-1" color="#FF0000"><b><font color="#DB692D">Let op!</font></b></font> <span class="style1">De beheerder van het gastenboek behoudt zich het recht voor om kwetsende, ongefundeerde en obscene berichten niet te plaatsen. </span></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>
        <input type="submit" name="save" value="Teken!">      </td>
      <td>
        <input type="submit" name="Submit2" value="Maak leeg">      </td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
            <table width="500" border="0" cellspacing="0" cellpadding="2" align="center">
              <tr>
    <td align="right"><font face="verdana" size="-1" color="#DB692D"><b>Bekijk
      het gastenboek:</b></font></td>
    <td width="19"><a href="index.php"><img src="../images/oogje.gif" width="23" height="23" border="0"></a></td>
  </tr>
</table>
</td>
        </tr>
      </table>
      <p>&nbsp;</p>
    </td>
  </tr>
</table>
</body>
</html>

#2 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 27 October 2006 - 02:45 PM

What you're looking for is captcha.

If you search these forums for that 'word' you'll come up with some solutions.

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#3 XO101

XO101
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 30 October 2006 - 10:11 AM

Thnx for the above,

but this capcha thing is a little over my head, does somebody have other ideas to make my guestbook spam free ?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users