Location: PHPKode > projects > CMSimple LE > cmsimple-le3_4/cmsimple/mailform.php
<?php
/*
CMSimple LE version 3.4 April 2011
© 2011 Preben Bjorn Biermann Madsen - hide@address.com

Based on CMSimple version 3.3 - December 31. 2009
Small - simple - smart
© 1999-2009 Peter Andreas Harteg - hide@address.com
   
This file is part of CMSimple LE
For License please see http://www.cmsimple-le.eu/cms/?License and /cmsimple/gpl.txt 
*/

// pbm replacement for eregi
if (preg_match('/mailform.php/i',sv('PHP_SELF')))die('Access Denied');

$title = $tx['title'][$f];
$o .= '<h1>'.$title.'</h1>';
initvar('sender');
$t = '';
if ($action == 'send') {
	if ($mailform == '')$e .= '<li>'.$tx['error']['mustwritemes'];
	// pbm prepared for php 6
	else if(!(preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[_a-z0-9-]+(\.[_a-z0-9-]+)*(\.([a-z]{2,4}))+$/i", $sender))) $e .= '<li>'.$tx['error']['mustwritemail'].'.';
	else if(!(@mail($cf['mailform']['email'], 'Mailform from '.sv('SERVER_NAME'), stsl($mailform), "From: ".stsl($sender)."\r\n"."X-Remote: ".sv('REMOTE_ADDR')."\r\n")))$e .= '<li>'.$tx['mailform']['notsend'];
	else $t = '<p>'.$tx['mailform']['send'].'</p>';
}
if ($t == '' || $e != '') {
	if (@$tx['mailform']['message'] != '')$o .= '<p>'.$tx['mailform']['message'].'</p>';
	$o .= '<form action="'.$sn.'" method="post"><textarea rows="12" cols="40" name="mailform">';
	if ($mailform != 'true')$o .= htmlspecialchars(stsl($mailform));
	$o .= '</textarea>'.tag('input type="hidden" name="function" value="mailform"').tag('input type="hidden" name="action" value="send"').tag('br').$tx['mailform']['sender'].': '.tag('input type="text" class="text" name="sender" value="'.htmlspecialchars(stsl($sender)).'"').' '.tag('input type="submit" class="submit" value="'.$tx['mailform']['sendbutton'].'"').'</form>';
}
else $o .= $t;

?>
Return current item: CMSimple LE