<?
session_start();
ob_start("ob_gzhandler");
include("./includes/config.php");
include("./lang/arabic.php");
include("./includes/easytemplate.php");
include("./includes/function.php");
include("./includes/online.php");
include("./includes/inquiry.php");

$PhpGroup_style['def_style'] = "designs/$style";
$stylepath= $PhpGroup_style['def_style'];
$tpl = new EasyTemplate;
$tpl->Temp = $PhpGroup_style['def_style'];
$tpl->Cache = "easycache";


$id= trim($_GET['poemid']);
$cleanid = strip_tags($id);


//ctype_alnum();

echo $tpl->display("headerinclude.html");
$do = $_GET['do'];
if (($do)==('')){
echo $tpl->display("sendtofrind.html");
}elseif (($do)==('send')){

$usermail= trim($_POST['yourmail']);
$frindmail = trim($_POST['frindmail']);
$username = trim($_POST['yourname']);
$message = $_POST['message'];
$vcode = $_POST['vcode'];

$cp = $_SESSION['key'];
$code = md5($vcode);

if (($code)!=($cp)){


$message = "<p align='center'>$lang[falsecode]<br><a href='javascript:history.back()'>اضغط هنا للعودة</a></p>";
print $tpl->display("message.html");
}

$to = $frindmail;
	//عنوان الرسالة
	$subject = "رسالة من صديق";
	// هيدر الرسالة
		$headers = "From: $username <$to>\r\nReply-To: $usermail\r\n";
		$headers .= "X-Sender: <$usermail>\n";
		$headers .= "X-Mailer: PHP\n";
		$headers .= "Return-Path: <$usermail>\n";
		$headers .= "Content-type: text/html\n\n";
    //محتوي الرسالة
    $body = $message;
  $mas = @mail($to, $subject, $body, $headers);

  if($mas){
  $message = "<p align='center'>تم ارسال الرسالة بنجاح <br>  <A href='javascript:self.close()'>أغلق هذه الصفحة</A>
  </p>";
print $tpl->display("message.html");
  }else{
    $message = "<p align='center'>هناك مشكلة بارسال الرسالة <br><a href='javascript:history.back()'>اضغط هنا للعودة</a></p>";
print $tpl->display("message.html");


  }

				}


?>