Evan McNabb's Homepage
Home | Blog | About Me | Linux / Open Source Software | Photo Album | Funny Stuff | Misc Stuff
<?php
/*

   Copyright (C) 2003 Evan McNabb

   enmDespamify is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   enmDespamify is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   For a copy of the GNU General Public License go to http://www.gnu.org/licenses/gpl.html
   or write to:
     Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/

if ( $_REQUEST['submit'] )
{
    
draw_header();

    
$email_address $_REQUEST['email_address'];
    
$encoded_email_address "";
    
    for ( 
$i 0$i strlen$email_address ); $i++ )
    {
        
$encoded_email_address $encoded_email_address get_char_code$email_address[$i] );
    }

    
draw_page$email_address$encoded_email_address );
}
else 
{
    
draw_header();
    
draw_page"""" );
}

function 
draw_page$email_address$encoded_email_address )
{
    
?>

    <html>
    <title>enmDespamify</title>
    <body>

    <div class="body">
    
    <center><h2>enmDespamify</h2></center>
    <p>One of the most common ways that spammers get e-mail addresses is through webpage harvesting. 
    They crawl thousands of pages looking for e-mail addresses; if they find one in the form of myuser@mydomain.com
    they'll add you to their databases. For more info read this 
    <a href="http://www.cdt.org/speech/spam/030319spamreport.shtml">interesting study</a>.</p>
    <p>enmDespamify will help you "hide" your addresses by translating them into HTML character entities (for
    example 'a'=&#038;&#035;097; 'b'=&#038;&#035;098; etc).</p>
    <p>Just type in your e-mail address, click encode, and the replace every occurence of your address in your webpages with
    the encoded version. Your browser will render it as a normal looking e-mail address but it is MUCH harder for them 
    to extract while crawling your site.</p>
    <p>Good luck...</p>
    </div>
    
    <? draw_form$email_address$encoded_email_address ); ?>

    </body>

    </html>

    <?
}

function 
draw_form$email_address$encoded_email_address )
{
    
?>

    <center>

    <div class="form_box">

    <form method='post'>

    <table width="80" cellspacing="0" cellpadding="10" border="0">
       <tr>
          <td>E-mail address:</td>
          <?
                   
echo "<td><input type=\"Text\" name=\"email_address\" value=\"$email_address\" size=\"40\"></td>";
          
?>
        
       </tr>
       <br>
       <br>
       <tr>
          <td>Encoded Address:</td>
               <td><textarea rows="3" cols="60">
            <?= $encoded_email_address ?>    
               </textarea></td>
       </tr>
    </table>

    <p><input type="submit" name="submit" value="Encode Address"></p>
    <p><input type="submit" name="clear" value="Clear Fields"></p>
    </form>


    </div>    
    </center>

    <?
}

function 
draw_header()
{
    
?>

    <style>
        body 
        {
         margin-left: 10px;
         margin-right: 10px;      
         margin-top: 10px;
         margin-bottom: 10px;     

         font-family: arial;
         font-size: 80%;
        }
        input 
        {
                 font-size: 75%;
        }
            .form_box
            {
         font-size: 90%;
         background: #e3e6f9;
         border: 1px black solid;

         padding-top: 10px;
         padding-bottom: 10px;
         padding-left: 10px;
         padding-right: 10px;

         text-align: left;
         width: 700px;
        }
    </style>

    <?
}

// Return the HTML character code for a single character
function get_char_code$char )
{
    
$char_array = array(
    
' ' => '&#038;&#035;032;',
    
'!' => '&#038;&#035;033;',  
    
'"' => '&#038;&#035;034;',  
    
'#' => '&#038;&#035;035;',  
    
'$' => '&#038;&#035;036;',  
    
'%' => '&#038;&#035;037;',  
    
'&' => '&#038;&#035;038;',  
    
'\'' => '&#038;&#035;039;',  
    
'(' => '&#038;&#035;040;',  
    
')' => '&#038;&#035;041;',  
    
'*' => '&#038;&#035;042;',  
    
'+' => '&#038;&#035;043;',  
    
',' => '&#038;&#035;044;',  
    
'-' => '&#038;&#035;045;',  
    
'.' => '&#038;&#035;046;',  
    
'/' => '&#038;&#035;047;',  
    
'0' => '&#038;&#035;048;',  
    
'1' => '&#038;&#035;049;',  
    
'2' => '&#038;&#035;050;',  
    
'3' => '&#038;&#035;051;',  
    
'4' => '&#038;&#035;052;',  
    
'5' => '&#038;&#035;053;',  
    
'6' => '&#038;&#035;054;',  
    
'7' => '&#038;&#035;055;',  
    
'8' => '&#038;&#035;056;',  
    
'9' => '&#038;&#035;057;',  
    
':' => '&#038;&#035;058;',  
    
';' => '&#038;&#035;059;',  
    
'<' => '&#038;&#035;060;',  
    
'=' => '&#038;&#035;061;',  
    
'>' => '&#038;&#035;062;',  
    
'?' => '&#038;&#035;063;',  
    
'@' => '&#038;&#035;064;',  
    
'A' => '&#038;&#035;065;',  
    
'B' => '&#038;&#035;066;',  
    
'C' => '&#038;&#035;067;',  
    
'D' => '&#038;&#035;068;',  
    
'E' => '&#038;&#035;069;',  
    
'F' => '&#038;&#035;070;',  
    
'G' => '&#038;&#035;071;',  
    
'H' => '&#038;&#035;072;',  
    
'I' => '&#038;&#035;073;',  
    
'J' => '&#038;&#035;074;',  
    
'K' => '&#038;&#035;075;',  
    
'L' => '&#038;&#035;076;',  
    
'M' => '&#038;&#035;077;',  
    
'N' => '&#038;&#035;078;',  
    
'O' => '&#038;&#035;079;',  
    
'P' => '&#038;&#035;080;',  
    
'Q' => '&#038;&#035;081;',  
    
'R' => '&#038;&#035;082;',  
    
'S' => '&#038;&#035;083;',  
    
'T' => '&#038;&#035;084;',  
    
'U' => '&#038;&#035;085;',  
    
'V' => '&#038;&#035;086;',  
    
'W' => '&#038;&#035;087;',  
    
'X' => '&#038;&#035;088;',  
    
'Y' => '&#038;&#035;089;',  
    
'Z' => '&#038;&#035;090;',  
    
'[' => '&#038;&#035;091;',  
    
'\\' => '&#038;&#035;092;',  
    
']' => '&#038;&#035;093;',  
    
'^' => '&#038;&#035;094;',  
    
'_' => '&#038;&#035;095;',  
    
'`' => '&#038;&#035;096;',  
    
'a' => '&#038;&#035;097;',  
    
'b' => '&#038;&#035;098;',  
    
'c' => '&#038;&#035;099;',  
    
'd' => '&#038;&#035;100;',  
    
'e' => '&#038;&#035;101;',  
    
'f' => '&#038;&#035;102;',  
    
'g' => '&#038;&#035;103;',  
    
'h' => '&#038;&#035;104;',  
    
'i' => '&#038;&#035;105;',  
    
'j' => '&#038;&#035;106;',  
    
'k' => '&#038;&#035;107;',  
    
'l' => '&#038;&#035;108;',  
    
'm' => '&#038;&#035;109;',  
    
'n' => '&#038;&#035;110;',  
    
'o' => '&#038;&#035;111;',  
    
'p' => '&#038;&#035;112;',  
    
'q' => '&#038;&#035;113;',  
    
'r' => '&#038;&#035;114;',  
    
's' => '&#038;&#035;115;',  
    
't' => '&#038;&#035;116;',  
    
'u' => '&#038;&#035;117;',  
    
'v' => '&#038;&#035;118;',  
    
'w' => '&#038;&#035;119;',  
    
'x' => '&#038;&#035;120;',  
    
'y' => '&#038;&#035;121;',  
    
'z' => '&#038;&#035;122;',  
    
'{' => '&#038;&#035;123;',  
    
'|' => '&#038;&#035;124;',  
    
'}' => '&#038;&#035;125;',  
    );

    return 
$char_array$char ];
}

?>