<?
/***
*
* PHP email display and call by Michael Glazer http://coding.4arrow.com March 11, 2003
*
* Let's Roll!
* America Rules!
*
* You can freely use this script as long as this header remains intact
*
**/
// start session session_start ( );
// request being made if ( $argv[0] ) {
// not allowed a direct request
if ( $_SESSION['page'] != $_SERVER['HTTP_REFERER'] ) die ( 'Not Allowed!' );
// decode request
$decode = base64_decode ( $argv[0] );
// strip our hidden random password
$email = str_replace ( $_SESSION['key'] , '' , $decode );
// open mailto link and return to previous page then die
die ( '<script>location.href='mailto:'.$email.''; location.href=''.$_SESSION['page'].''</script>' );
}
// our array of emails $emails = array('test1@yahoo.com','test2@yahoo.com');
// current page beign requested $_SESSION['page'] = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
// random generated password to append to a random place within each email
$_SESSION['key'] = md5(microtime().posix_getpid());
// iteriate through each email append random key to random place in email
foreach ( $emails as $k => $email ) {
// encode email
$encode = base64_encode ( posKey ( $email , $_SESSION['key'] ) );
// write email
echo '<a href="emails.php?'.$encode.'">Email '.$k.'</a><br>'.chr(13);
}
// function to randomlly position our random password to each email function posKey ( $email , $key ) {
$sep1 = '@';
$sep2 = '.';
$FS = explode ( $sep1 , $email , 2 );
$ST = explode ( $sep2 , $FS[1] , 2 );
$F = $FS[0]; // first
$S = $ST[0]; // second
$T = $ST[1]; // third
$place = array('FB','FM','FE','SB','SM','SE','TB','TM','TE');
$placement = $place[rand(0, sizeof($place) -1)];
switch ( $placement ) {
case 'FB': //first beginning
return $key . $email;
break;
case 'FM': // first middle
$len = strlen ($F);
$half = ($len / 2);
$front = substr($F,0,$half);
$back = substr($F,$half);
return $front . $key . $back . $sep1 . $FS[1];
break;
case 'FE': // first ending
return $F . $key . $sep1 . $FS[1];
break;
case 'SB': // second beginning
return $F . $sep1 . $key . $FS[1];
break;
case 'SM': // second middle
$len = strlen ($S);
$half = ($len / 2);
$front = substr($S,0,$half);
$back = substr($S,$half);
return $F . $sep1 . $front . $key . $back . $sep2 . $T;
break;
case 'SE': // second ending
return $F . $sep1 . $S . $key . $sep2 . $T;
break;
case 'TB': // third beginning
return $F . $sep1 . $S . $sep2 . $key . $T;
break;
case 'TM': // third middle
$len = strlen ($T);
$half = ($len / 2);
$front = substr($T,0,$half);
$back = substr($T,$half);
return $F . $sep1 . $S . $sep2 . $front . $key . $back;
break;
case 'TE': // third ending
return $email . $key;
break;
}
}
?>
|
|