0byt3m1n1
Path:
/
data
/
0
/
0
/
22
/
44
/
22370
/
user
/
22848
/
cgi-bin
/
[
Home
]
File: process.php
<? include("config.php"); ?> <html> <head> <META NAME="Title" CONTENT="<? echo $title?>"> <META NAME="Author" CONTENT="CJ Website Design"> <title><? echo $title?></title> <link rel="stylesheet" href="stylesheet.php" type="text/css"> </head> <body> <? if(isset($submit)) { // Checks the form submission check_fields ("$sname","$yourname","$emptyfield"); if(!$smail) { msg("$emptymail1","$mailtype"); } else { check_email("$smail","$yourmail","$invalidmail"); } if(!$rmail) { msg("$emptymail1","$mailtype"); } else { foreach($rmail as $email) { check_email($email,"$recipientmail","$invalidmail"); } } /* building the mail body */ $mailbody=$message."\n"; $mailbody.="Check out this link:\n"; $mailbody.=$link; $mailbody.="\n$bestwishes,\n$sname\n"; $mailbody.="\n-------------------------------------------------------\n"; $mailbody.=$author; $mailheaders="From: $sname<$smail>\n"; // bug fix - thanks rahul! /* building the body of the mail for the sender */ if ($mailtosender=="1") { $smailbody=$sname.",\n"; $smailbody.=$thankyoumessage."\n"; $smailbody.="\n-------------------------------------------------------\n"; $smailheaders="From: $sitename<$adminmail>\n"; mail($smail,$thankyousubject,$smailbody,$smailheaders); } /* sends the mail */ foreach($rmail as $email) { if($email) { if(!@mail($email,$mailsubject,$mailbody,$mailheaders)) { $notsent = true; } else { logEmail($email); } } } if($mailtoadmin) { @mail($adminmail,$mailsubject,$mailbody,$mailheaders); } if($notsent) { msg("$error","$mailproblem"); } else { msg("$mailsent",$rmail); } } function logEmail($email) { $path = __FILE__; $path = preg_replace( "'\\\process\.php'", "", $path); $path = preg_replace( "'/process\.php'", "", $path); $date = time(); $ip = $_SERVER['REMOTE_ADDR']; $email = trim($email); $write = $email."|".$date."|".$ip."\n"; $fd = fopen ($path."/log.txt", "a"); $write = stripslashes($write); fwrite ($fd, $write); fclose($fd); return true; } function msg($messagetype,$m) { global $goback; ?> <br> <br> <table width="100%" cellspacing="0" cellpadding="2"> <tr> <td><? echo $messagetype ?></td> </tr> <tr> <td> <? print "<br>"; print "<ul>"; if(is_array($m)) { foreach($m as $n) { if($n) print "<li>".$n."</li>"; } } else { echo "<li>".$m."</li>"; } print "</ul>"; echo"<center><br><input type=\"button\" value=\"".$goback."\" onClick=\"history.go(-1)\"></center> "; ?> </td> </tr> </table> </body> </html> <? exit; } /*---------------------------------------------------------------------------------------*/ /* function checks the empty fields */ function check_fields($field,$fieldname,$errormessage) { if (empty ($field)) { msg("$errormessage","$fieldname"); } } /* Function checks the validity of the email addresses */ function check_email($email,$mailtype,$errmessage) { global $emptymail1,$emptymail2; if (!empty($email)) { $mail_test= trim($email); // credit to the function creator if (!eregi("^[_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,3}$", $mail_test)) { msg( "$errmessage","$mail_test"); } } } ?> </body> </html>