Re: [feature] anti Spambot solutions

"Stefan Nagtegaal" <[email protected]> Fri, 9 Jan 2004 11:32:31 +0100
Newsgroups gmane.comp.php.drupal.user
Message-ID <00d201c3d69b$e34041e0$54f2a33e@nagtegaazmljsa>
This is a multi-part message in MIME format.

------=_NextPart_000_00CF_01C3D6A4.44D29D60
Content-Type: text/plain;
	charset="UTF-8"
Content-Transfer-Encoding: 8bit

Well, currently I am developing it for release (asap) but it's full of bugs
and I busy at the moment..
Tomorrow I will work at it again, and after that I can put it in contrib
after some serious testing..

If you are still interested in the module which is at
http://www.sempre-crescendo.nl/index/contact it's attached..
All comments inside the code, variable name's, and all other stuff in
commented/named in dutch words so apologise to everyone who don't know
dutch..
They should wait till I release the module in contrib..

Kind regards,



Stefan

----- Original Message ----- 
From: "Bèr Kessels" <[email protected]>
To: <[email protected]>
Sent: Friday, January 09, 2004 11:20 AM
Subject: Re: [drupal-user] [feature] anti Spambot solutions


> Stefan Nagtegaal wrote:
> > I recently made a contact.module for my own drupal (cvs) which hides the
> > e-mail adresses for spam-bots. If you like, i can mail you the module so
you
> > can get an idea about what i've done...
> > All e-mail adresses are hardcoded in there, but it's shouldn't be that
hard
> > to make these chageable using an admin interface..
> >
> > You can see it in action here:
http://www.sempre-crescendo.nl/index/contact
>
> Sounds very good! I think that the mail-selection is a good feature.
> Could you mail it? i can see if i get the feedback for 4.3 online before
> 4.4 release :). A thing i'd like to know if people oppose to using the
> node-engine for feedback:
>
> I made something similar, using nodes as feedback. The reason for this
> is that you can use taxonomy for a category. The module should then
> select, according to categories where to send the mail to.
> Another good thing, IMO, is that feedback is saved online. Problems are:
> search etc.
>
> I still beleive that the feedback module can offer *one* method of
> anti-spam-botting. not per sé *the* method. Its up to admins if they
> want to use a form or addresses (in combination with hiding the link)
> for feedback.
>
> The reason for opening this discussion, is that i wanted to see if there
> were pro's and con's on using this method. and if there were better ones.
>
> Regards
>
> -- 
>
> Ber Kessels,
>    aka exclude @ http://www.mediarevolution.org
>
>    Web design is not about art, it's about making money or disseminating
> information.
>        Vincent Flanders @ webpagesthatsuck.com
>
> -- 
> [ Drupal user list | http://list.drupal.org/ ]
> [
http://lists.drupal.org/options/drupal-user/drupal-user%40frontaal-online.com ]
>

------=_NextPart_000_00CF_01C3D6A4.44D29D60
Content-Type: application/octet-stream;
	name="contact.module"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="contact.module"

<?php

function contact_help($section) {
  if ($section =3D=3D "admin/system/modules#description") {
    return "Sempre-Crescendo.nl: Contactinformatie.";
  }
}


function contact_link($type, $node =3D 0, $main) {
  global $user;

  $links =3D array();

  if ($type =3D=3D "system" && user_access("access content")) {
    menu("contact", "Contact informatie", "contact_page", 0, MENU_HIDE);
  }

  if ($type =3D=3D "page" && user_access("access content")) {
    $links[] =3D l("Contact informatie", "contact", array("title" =3D> =
"Neem contact met ons op."));
  }
 =20
  return $links;
}


function contact_page() {
  global $user, $edit, $op;
 =20
  $op =3D $_POST["op"];
  $edit =3D $_POST["edit"];
 =20
  $ontvanger =3D $edit["contactpersoon"];
 =20
  if ($op =3D=3D "Versturen") {
    /*
    **  Bouw optie's in om data te verifieren, nl;
    **   - is de naam van de verzender ingevuld? (Zie $edit["naam"])
    **   - is het e-mail adres van de verzender ingevuld? (Zie =
$edit["contactpersoon"])
    **   - is het onderwerp van de e-mail ingevuld? (Zie =
$edit["onderwerp"])
    **   - is de beschrijving wel ingevuld? (Zie $edit["beschrijving"])
    **    =20
    **     Zo ja, verzenden en weergegeven wat er verzonden is.
    **     Zo nee, niet verzenden en terugsturen naar het formulier met =
$edit als aanhangsel net zo lang tot alles keurig is ingevuld
    */
 =20
    // Controle van de ingevulde velden: =20
    contact_verificatie($edit);
   =20
    // We hebben geen foutief ingevulde velden
    if (!drupal_set_message()) {
      contact_mail($edit);
    }
    // We hebben wel foutief ingevulde velden
    else {
      print theme("page", contact_formulier($edit));
    }
  }
 =20
  // $edit bevat geen waardes en er is nog niet op de knop "Versturen" =
gedrukt
  else {
    print theme("page", contact_formulier($edit));   =20
  }
}

function contact_formulier() {
  global $user, $edit;
 =20
  if ($user->uid) {
    // Dit zijn ingelogde leden

    $contactpersonen =3D array("Hans Landwehr" =3D> "Hans Landwehr =
(Webbeheer & Onderhoud)", "Ilse van den Berg" =3D> "Ilse van den Berg =
(Webbeheer & Onderhoud)", "Stefan Nagtegaal" =3D> "Stefan Nagtegaal =
(Webbeheer, Ontwikkeling & Onderhoud)");
    $contacthelp =3D "Technische problemen op de website worden =
verholpen door Stefan. Voor suggestie's, opmerkingen of vragen =
betreffende de website inhoud kunt u zich tevens richten tot Hans of =
Ilse.";
    $standaard =3D "Hans Landwehr";
  }
  else {
    // bezoekers die hulp zoeken/contact op willen nemen

    $contactpersonen =3D array("secretariaat" =3D> "Secretariaat =
(Informatie & boekingen)", "webbeheer" =3D> "Website beheer (Informatie, =
technische vragen en foutoplossingen betreffende de website)");
    $contacthelp =3D "Voor technische problemen op de website kiest u =
voor 'Website beheer'. Voor vragen over de vereniging, boekingen, =
prijzen enz, enz, hiest u voor het 'Secretariaat'.";
    $standaard =3D "webbeheer";
  }

//  $form .=3D form_radios("Met wie wilt u contact opnemen?", =
"contactpersoon", $edit["contactpersoon"] ? $edit["contactpersoon"] : =
$standaard, $emailadressen, "Technische problemen op de website worden =
verholpen door Stefan. Voor suggestie's, opmerkingen of vragen =
betreffende de website inhoud kunt u zich tevens richten tot Hans of =
Ilse.");
  $form .=3D form_radios("Met wie wilt u contact opnemen?", =
"contactpersoon", $edit["contactpersoon"] ? $edit["contactpersoon"] : =
$standaard, $contactpersonen, $contacthelp);
  $form .=3D form_textfield("Uw naam", "naam", $user->name ? $user->name =
: $edit["naam"], 70, 128, "Vul uw naam in.");
  $form .=3D form_textfield("Uw e-mail adres", "mail", $user->mail ? =
$user->mail : $edit["mail"], 70, 128, "Vul uw e-mail adres in zodat wij =
contact met u op kunnen nemen.");
  $form .=3D form_textfield("Onderwerp van e-mail", "onderwerp", =
$edit["onderwerp"], 70, 128, "Vul het onderwerp in van uw e-mail.");
  $form .=3D form_textarea("Beschrijving", "beschrijving", =
$edit["beschrijving"], 70, 25, "Geef hier uw vragen, opmerkingen, =
suggestie's of probeer de door u ondervonden problemen zo duidelijk =
mogelijk te beschrijven."); =20
 =20
  $form .=3D form_submit("Versturen");
 =20
  drupal_set_title("Contact Informatie");
   =20
  return form($form);
}

function contact_verificatie() {
  $op =3D $_POST["op"];
  $edit =3D $_POST["edit"];
 =20
  /* =20
  **  Optie's in om data te verifieren, nl;
  **   - is er iemand die gewaarschuwd moet worden? (Zie =
$edit["contactpersoon"])
  **   - is de naam van de verzender ingevuld? (Zie $edit["naam"])
  **   - is het e-mail adres van de verzender ingevuld? (Zie =
$edit["mail"]) <=3D=3D
  **   - is het onderwerp van de e-mail ingevuld? (Zie =
$edit["onderwerp"])
  **   - is de beschrijving wel ingevuld? (Zie $edit["beschrijving"]) =20
  */
 =20
  // Check of er een keuze is gemaakt tussen Hans, Ilse of mij
  if (!$edit["contactpersoon"]) {
    drupal_set_message("U bent vergeten om een persoon te kiezen waaraan =
u deze e-mail wilt sturen", "error");
  }
 =20
  // Check of er iets is ingevuld in het veld 'Uw naam'
  if (!$edit["naam"]) {
    drupal_set_message("U heeft uw naam niet ingevuld", "error");
  }
 =20
  // Check of er iets is ingevuld in het veld 'Uw e-mail adres'
  if (!$edit["mail"]) {
    drupal_set_message("U heeft uw e-mail adres niet ingevuld", =
"error");
  }
  else {
    // Oke, er is iets ingevuld, maar... is het een geldig e-mail adres?
    if (!valid_email_address($edit["mail"])) {
      drupal_set_message("Het door u ingevoerde e-mail adres is geen =
geldig adres", "error");
    }
  }
 =20
  // Check of er iets is ingevuld in het veld 'Onderwerp'
  if (!$edit["onderwerp"]) {
    drupal_set_message("U heeft geen onderwerp ingevuld", "error");
  }
 =20
  // Check of er iets is ingevuld in het veld 'Beschrijving'
  if (!$edit["beschrijving"]) {
    drupal_set_message("U heeft geen beschrijving van uw probleem =
gegeven", "error");
  }
}

function contact_mail() {
  $op =3D $_POST["op"];
  $edit =3D $_POST["edit"];

/*
**  $edit["contactpersoon"] =3D "Hans Landwehr", "Ilse van den Berg", =
"Stefan Nagtegaal", "webbeheer" of "secretariaat"
**  $edit["naam"] =3D Naam van hulpzoekende
**  $edit["mail"] =3D E-mail adres van hulpzoekende $edit["naam"]
**  $edit["onderwerp"] =3D Onderwerp van =
probleem/suggestie/vraag/boekingen, etc, etc
**  $edit["beschrijving"] =3D Het complete bullshit verhaal van =
$edit["naam"]
*/
=20
  switch($edit["contactpersoon"]) {
    case "Hans Landwehr":
      $contact =3D "[email protected]";
      break;
    case "Ilse van den Berg":
      $contact =3D "[email protected]";
      break;
    case "Stefan Nagtegaal":
      $contact =3D "[email protected]";
      break;
    case "secretariaat":
      $contact =3D "[email protected]";
      break;
    case "webbeheer":
      $contact =3D "[email protected]";
      break;
  }
  $onderwerp =3D "Sempre-Crescendo.nl: ". $edit["onderwerp"];

  $variabelen =3D array("%contactpersoon" =3D> $edit["contactpersoon"], =
"%hulpzoekende" =3D> $edit["naam"], "%emailhulpzoekende" =3D> =
$edit["mail"], "%onderwerp" =3D> $edit["onderwerp"], "%beschrijving" =
=3D> $edit["beschrijving"], "%datum" =3D> format_date(time()));
  $bericht =3D strtr("Beste %contactpersoon,\n\nhet volgende bericht is =
(%datum) door %hulpzoekende (%emailhulpzoekende) =
verstuurd:\n%beschrijving\n\n\nDit bericht is verstuurd vanaf =
http://www.sempre-crescendo.nl/index/contact", $variabelen);
 =20
  $mailhulpzoekende =3D $edit["mail"];
 =20
  $headers =3D "From: Muziekvereniging Sempre Crescendo =
<[email protected]>\nReply-to: =
$mailhulpzoekende\nX-Mailer: Sempre Crescendo\nReturn-path: =
[email protected]\nErrors-to: =
[email protected]";
 =20
  // E-mail naar Hans, Ilse, Stefan, Secratariaat of Webeheer
  mail($contact, user_mail_encode($onderwerp), str_replace("\r", "", =
$bericht), "MIME-Version: 1.0\nContent-Type: text/plain; =
charset=3DUTF-8; format=3Dflowed\nContent-transfer-encoding: 8Bit\n". =
$headers);
 =20
  // E-mail naar de contactzoekende
//  mail($mailhulpzoekende, user_mail_encode($onderwerp), =
str_replace("\r", "", $bericht), "MIME-Version: 1.0\nContent-Type: =
text/plain; charset=3DUTF-8; format=3Dflowed\nContent-transfer-encoding: =
8Bit\n" . $headers);
 =20
//  drupal_set_message(strtr("Uw e-mail is verzonden naar %contact", =
array("%contact" =3D> $edit["contactpersoon"])));

  print theme("page", contact_klaar($edit));
}

function contact_klaar() {
=09
  $op =3D $_POST["op"];
  $edit =3D $_POST["edit"];
 =20
/*
**  $edit["contactpersoon"] =3D "Hans Landwehr", "Ilse van den Berg", =
"Stefan Nagtegaal", "webbeheer" of "secretariaat"
**  $edit["naam"] =3D Naam van hulpzoekende
**  $edit["mail"] =3D E-mail adres van hulpzoekende $edit["naam"]
**  $edit["onderwerp"] =3D Onderwerp van =
probleem/suggestie/vraag/boekingen, etc, etc
**  $edit["beschrijving"] =3D Het complete bullshit verhaal van =
$edit["naam"]
*/

  drupal_set_title("Bedankt voor uw interresse");
 =20
  switch($edit["contactpersoon"]) {
    case "Hans Landwehr":
    case "Ilse van den Berg":
    case "Stefan Nagtegaal":
      $output .=3D "Het volgende bericht is verzonden naar =
<strong>%contactpersoon</strong>:<br /><br />";
      break;
    case "webbeheer":
      $output .=3D "Het volgende bericht is verzonden naar de beheerders =
van onze website:<br /><br />";
      break;
    case "secretariaat":
      $output .=3D "Het volgende bericht is verzonden naar het =
secretariaat van onze vereniging:<br /><br />";
      break;
  }

  $output .=3D "<strong>Verzonden door: </strong>%hulpzoekende =
(%emailhulpzoekende).<br />";
  $output .=3D "<strong>Onderwerp: </strong>%onderwerp.<br />";
  $output .=3D "<strong>Tijdsstip: </strong>%datum.<br />";
  $output .=3D "<br />";
  $output .=3D "<strong>Uw bericht: </strong><br />%beschrijving<br />";
  $output .=3D "Mocht er naar aanleiding van uw vraag, suggestie of =
opmerking nog onduidelijkheid bestaan, zullen wij spoedig contact met u =
op nemen via e-mail.<br />";
 =20
  $variabelen =3D array("%contactpersoon" =3D> $edit["contactpersoon"], =
"%hulpzoekende" =3D> $edit["naam"], "%emailhulpzoekende" =3D> =
$edit["mail"], "%onderwerp" =3D> $edit["onderwerp"], "%beschrijving" =
=3D> $edit["beschrijving"], "%datum" =3D> format_date(time()));
  return strtr($output, $variabelen);
}

?>
------=_NextPart_000_00CF_01C3D6A4.44D29D60
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-- 
[ Drupal user list | http://list.drupal.org/ ]
[ http://lists.drupal.org/options/drupal-user/gcpdu-drupal-user%40gmane.org ]
------=_NextPart_000_00CF_01C3D6A4.44D29D60--