<?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();
if(!isset($_POST["idCategory"]) || empty($_POST["msg"])) {
	header("location: category2.php?res=2");
	exit;
}
$chain = "AWdrh78y892Djk*^523*%$#ghgHGHia&%$*)AsfdsLJnLaad";
include("validateLogin.php");
include("includeInformation.php");
include("../functions/commonFunction.php");

$queryUserInfo = "SELECT `fullName` FROM `user_login` WHERE `id`=$_SESSION[userId]";
$resultUserInfo = mysqli_query($conn, $queryUserInfo);
$rowUserInfo = mysqli_fetch_assoc($resultUserInfo);
$today = date("m/d/Y");
$query = "INSERT INTO ".$tempMsg;
$query.= " (name,idCategory,msg,date,viewMsg) values ";
$query.= " ('".$rowUserInfo['fullName']."','".$_POST['idCategory']."','".$_POST['msg']."','".$today."','1')";
$result = mysqli_query($conn, $query);
if($result) {
	header("location: tempMsg.php?res=1&catId=".$_POST["idCategory"]."&showMsg=1");
	exit;
} else {
	header("location: category2.php?res=2");
	exit;
}

ob_end_flush();
?>
