<?
//echo $_GET[mail];
include("../includes/config.php");
include("../includes/bbcode.php");
$adminuser = @mysql_db_query("$dbName", "select *  from admin where  admin_id = '1'") ;
while  ($ab = mysql_fetch_array($adminuser)){
$adminu = $ab['admin_name'];
$adminp = $ab['admin_password'];
}
$loguser= $_COOKIE['adminuser'];
$logipass= $_COOKIE['adminpassword'];



if ( $adminp == $logipass  && $adminu == $loguser ){

?>
  <html dir="rtl">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<meta http-equiv="Content-Language" content="ar-sa">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" href="stylesheet.css" type="text/css">

<title>لوحة تحكم الادارة</title>
</head>
<script language="JavaScript" src="./js/globtrax.js" type="text/javascript"></script>
 <?
 if(($_GET['go'])==('')){
 ?>
  <form name="" action="send.php?&go=send&mail=<?echo $_GET[mail];?>" method="post">
  <table width="20%" align="center"  cellpadding="0" cellspacing="0" class="mytable">
    <tr>
      <td>
      <div align="center">
          <table width="365" height="100%" align="center" bordercolor="#006633">
            <tr>
              <td width="359" class="backtablemun" colspan="2">
				<p align="center"><span lang="ar-sa">مراسلة الأعضاء</span></td>
            </tr>
            <tr>
              <td width="118" class="submun" align="center">
				<span lang="ar-sa">اسم المرسل : </span></td>
              <td width="237" class="subsub" align="center">
				<input name="adminusername" type="text" value="" size="36"></td>
            </tr>
            <tr>
              <td width="118" class="submun" align="center">
				<span lang="ar-sa">بريد المرسل : </span></td>
              <td width="237" class="subsub" align="center">
				&nbsp;<input name="oldpassword" type="text" value="" size="36"></td>
            </tr>
            <tr>
              <td width="118" class="submun" align="center">
				<span lang="ar-sa">الرسالة</span> : </td>
              <td width="237" class="subsub" align="center">
				<textarea name="message" cols="27" rows="4"></textarea></td>
            </tr>
            <tr>
              <td width="118" class="submun" align="center">
				&nbsp;</td>
              <td width="237" class="subsub" align="center">
				&nbsp;<input type="submit" value="ارسال"></td>
            </tr>
            </table>
        </div>
        </td>
    </tr>
  </table>
</form>

 <?
 }else{
 $to = $_GET['mail'];
 $from = $_POST[oldpassword];
 $formname= $_POST[adminusername];
 $message = $_POST[message];
 $message = nl2br($message);


	//عنوان الرسالة
		$subject = "رسالة من $formname";
	// هيدر الرسالة
		$headers = "From: $from <$to>\r\nReply-To: $from\r\n";
		$headers .= "X-Sender: <$from>\n";
		$headers .= "X-Mailer: PHP\n";
		$headers .= "Return-Path: <$from>\n";
		$headers .= "Content-type: text/html\n\n";
    //محتوي الرسالة

 	 $send = @mail($to, $subject, $message, $headers);
 	 if($send){
   		echo"<br><div align='center'><b>تم ارسال الرسالة بنجاح</b></div>";

 	 	}else{
 	 	echo "<br><div align='center'><b>عفوا هناك مشكلة بارسال الرسالة</b></div>";
 	 	}
 }
 ?>
  <br>
 <?
 }else{
 echo "من فضلك قم بتسجيل الدخول";
 }
 ?>