<?php
/**
 * Processing Forget password form data:
 * check data then generate new password and send it through SMPT Email
 *
 * PHP version 7.3
 *
 * @package        SMS
 * @version        Release 1.0.0
 * @create_by      Mohammad aljaouni
 * @create_date    10-08-2020
 * @edited_by      Mohammad aljaouni
 * @last_edit_date 10-08-2020
 * @todo           Nothing
 */
ob_start();
session_start();
$chain = "AWdrh78y892Djk*^523*%$#ghgHGHia&%$*)AsfdsLJnLaad";
$msg = trim($_POST['msg']);
if($msg == '' || !isset($_SESSION['userId']))
{
	echo 0; // البيانات غير كافية 
	exit();
}
include("validateLogin.php");
include("includeInformation.php");
$numChars = $_POST['numChars'];
$numMsgs = $_POST['numMsgs'];
$title = trim($_POST['title']);
$msg = trim($_POST['msg']);

if(mysqli_query($conn, "INSERT INTO `messages_box` (`user_id` ,`name`, `message`, `numChars`, `numMsgs`, `insert_time`) VALUES ( $_SESSION[userId], '".mysqli_real_escape_string($conn, iconv("utf-8","windows-1256",$title))."', '".mysqli_real_escape_string($conn, iconv("utf-8","windows-1256",$msg))."', '".$numChars."','".$numMsgs."','".time()."')"))
{
	echo 1;// تمت عملية الاضافة 
	exit();
}
else 
{
	echo 2; //  لم تتم عملية الاضافة 
	exit();
}
ob_end_flush();
?>
