All pastes #2076343 Raw Edit

Someone

public text v1 · immutable
#2076343 ·published 2011-06-07 19:28 UTC
rendered paste body
<?php
header('Content-type: text/html; charset=utf-8');

if(!empty($_POST['email'])){
	die();
}

function getRealIpAddr()
{
    if (!empty($_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet
    {
      $ip=$_SERVER['HTTP_CLIENT_IP'];
    }
    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy
    {
      $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    else
    {
      $ip=$_SERVER['REMOTE_ADDR'];
    }
    return $ip;
}

/**
send confirm mail and dens to campaign monitor
**/
	function mail_utf8($to, $subject = '(No subject)', $message = '', $header = '') {
	  	$header_ = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n";
	  	mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $header_ . $header);
	}
	
	$to  = 'laura@cahierdexercices.com';

	$subject = 'You have a new e-mail from cahierdexercices.com';
	$headers = "From: Discount Form on cahierdexercices.com<".$from.">\r\nReply-To: ".$to."\r\nCc: enzo@face3media.com\r\n";

	$name = stripslashes($_POST['cm-name']);
	$email = stripslashes($_POST['cm-ckukjt-ckukjt']);
	
	$message = 'Discount Form on cahierdexercices.com
Name : '.$name.'
E-mail: '.$email.'
ip: '.getRealIpAddr().'
browser: '.$_SERVER['HTTP_USER_AGENT'];

	//send the email
	@mail_utf8($to, $subject, $message, $headers );
	//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 

	//echo json_encode(array("result"=>"ok"));
	die();
?>