PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Marco van Oostende   No Spam class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example file
Class: No Spam class
Prevent robot spamming through web forms
Author: By
Last change:
Date: 18 years ago
Size: 616 bytes
 

Contents

Class file image Download
<?php
   
include_once("nospamclass.php");

// this file is called like 'example.php?spamhash=7643766'.
// it is called just like the nextfile.php below

// here comes code to check whether people are logged in. Outcome in $loggedin

   
$noSpam = new noSpam();

// compare $spamhash with today's hash. We already trust logged in people.
// $spamhash is extracted from the called uri

 
if ($noSpam->validatedHash($spamhash, !$loggedin)) {

       
// bla bla. The link below can be used to build a url with today's hash

       
echo '<a href="nextfile.php?spamhash='.$noSpam->dateHash.'">Next File</a>';
    }

?>