<?php
$date=date("F j, Y - g:i A");
echo getBreadCrumb("Settings");
if (!isset($_POST['email'])) {
}
elseif (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { 
	updateEmail($_POST['email'],$users['id']);
	echo getPanel("success","Success","Your Email has been Updated.");
}
else{
	echo getPanel("danger","Failed","Please enter a valid Email Address. (Example: runaway@email.com)");
}
if (!isset($_POST['exception'])) {
}
elseif(empty($_POST['exception'])) {
	echo getPanel("danger","Failed","Please enter a time period.");
}
elseif(empty($_POST['comment'])) {
	echo getPanel("danger","Failed","Please enter a reason.");
}
else{
	$_POST['comment']=str_replace(' ','_',$_POST['comment']);
	$comment=$_POST['exception'];
	$comment.= $_POST['comment'];
	applyException($users['id'],'0000-00-00 00:00:00',$comment);
	echo getPanel("success","Success","Your application has been submitted.");
}
if (!isset($_POST['password']) && !isset($_POST['pass'])) {
}
elseif(empty($_POST['password'])) {
	echo getPanel("danger","Failed","Please enter your current Password");
}
elseif(empty($_POST['pass'])) {
	echo getPanel("danger","Failed","Please enter a new Password");
}
elseif(strlen($_POST['pass'])<6) {
	echo getPanel("danger","Field Error","Password is less than 6 characters long");
}
elseif(strlen($_POST['pass'])>15) {
	echo getPanel("danger","Field Error","Password is more than 15 characters long");
}
elseif(checkPassword($users['id'],$_POST['password'])==false){
	echo getPanel("danger","Field Error","Error With Current Password");
}
else{
	updatePass($_POST['pass'],$users['id']);
	echo getPanel("success","Success","Your password has been updated");
}


?>
