All pastes #81661 Raw Edit

Miscellany

public php v1 · immutable
·published 2006-07-07 19:01 UTC
rendered paste body
<?php$pathfix = dirname(__FILE__);//Includes Smarty.require_once($pathfix.'/includes/templating/Smarty.class.php');//Now the config.require_once($pathfix.'/includes/config.php');//Classes.require_once($pathfix.'/includes/classes.php');//Assigns $tpl to smart.$tpl = new Smarty();//Assigns the template dir.$tpl->cache_dir = 'templates_c';//Display the header$tpl->display('header.tpl');//Connect to MySQL$db = new db();$db->connect($config);//If submit was already pressedif(isset($_POST['submit'])){	//Assign vars.	$name = $_POST['name'];	$company = $_POST['company'];	$email = $_POST['email'];	$address = $_POST['address'];	$country = $_POST['country'];	$phone = $_POST['phone'];	$fax = $_POST['fax'];	$require = $_POST['require'];	$message = $_POST['message'];		//Changes \n to <br /> for message.	$message = str_replace('\n','<br />',$message);		//Subject of message.	$subject = 'A New Lead has been Completed';		//Who it will be sent. Default from config file.	$to = $config['techemail'];		//Set as HTML email.	$headers  = 'MIME-Version: 1.0' . "\r\n";	$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";	$headers .= 'From: '.$name.' <'.$email.'>' . "\r\n";		//Customize the huge message.	$message = 'Hello, <br /> <br /> This message is to inform you that there is a new lead at your website. The information below is what the user has sent to you: <br /> <br /> <strong>Name</strong>: '.$name.' <br /> <strong>Company</strong>: '.$company.' <br /> <strong>Email Address</strong>: '.$email.' <br /> <strong>Address</strong>: '.$address.' <br /> <strong>Country</strong>: '.$country.' <br /> <strong>Phone</strong>: '.$phone.' <br /> <strong>Fax</strong>: '.$fax.' <br /> <strong>Require What</strong: '$require.' <br /> <br /> The message they have entered below is as follows: '.$message.'; 	//Then send the mail.	$sendmail = mail($to,$subject,$message,$headers);		//If true.	if($sendmail == true)	{		echo 'Thank you for taking the time to contact us. We will respond as soon as possible.';	}	else	{		echo 'Failed.';	}}//Else{	//Display template.	$tpl->display('leads.tpl');}//Display footer.$tpl->display('footer.tpl');?>