require 'inc/mail_flags.php'; if ($op == 'check') { $uid = $_SESSION['user']; $res = mysql_query("select sum(new_mail) from mail where UPPER(defunct)='N' and to_user='******'"); if ($res && ($row = mysql_fetch_row($res)) && $row[0]) { echo $row[0]; } else { echo '0'; } } else { if ($op == 'send') { $from = $_SESSION['user']; if (!isset($_POST['touser']) || strlen($touser = mysql_real_escape_string(trim($_POST['touser']))) == 0) { die('"To User" can\'t be empty.'); } if (!UserExist($touser)) { die('No such user.'); } if (!isset($_POST['title']) || strlen($title = mysql_real_escape_string(trim($_POST['title']))) == 0) { die('Title can\'t be empty.'); } if (isset($_POST['detail'])) { $detail = mysql_real_escape_string($_POST['detail']); } else { $detail = ''; } mysql_query("insert into mail (from_user,to_user,title,content,in_date) VALUES ('{$from}','{$touser}','{$title}','{$detail}',NOW())"); echo '__OK__'; } else { if (!isset($_GET['mail_id'])) { die('Wrong argument.');
include_once '../functions/user_functions.php'; $email = ""; //^\({1}[1-9]{1}[0-9]{2}\){1}[1-9]{1}[0-9]{2}-{1}[0-9]{4} if (isPostRequest()) { $isValid = true; $email = filter_input(INPUT_POST, 'email'); $password = filter_input(INPUT_POST, 'password'); $confirmPassword = filter_input(INPUT_POST, 'passwordConfirm'); //$emailOnlyRegex = '/^[a-zA-Z0-9$]+[@]{1}[a-zA-Z]+[\.]{1}[a-zA-Z]{2,3}$/'; $emailOnlyRegex = '/[a-zA-Z0-9$]+[@]{1}[a-zA-Z]+[\\.]{1}[a-zA-Z]{2,3}/'; //^\({1}[1-9]{1}[0-9]{2}\){1}[1-9]{1}[0-9]{2}-{1}[0-9]{4} if (!preg_match($emailOnlyRegex, $email)) { $isValid = false; $errors[] = 'Please Enter a valid email.'; } if (UserExist($email) == false) { $isValid = false; $errors[] = 'Email already exists. Please try again.'; } if (empty($confirmPassword) && empty($password)) { $isValid = false; $errors[] = 'A Password must be entered'; } if ($password != $confirmPassword) { $isValid = false; $errors[] = 'Passwords do not match. Please try again'; } if ($isValid) { if (createUser($email, $password)) { $results[] = 'User created successfully!'; } else {