Exemplo n.º 1
0
  * ----------------------
  */
 $obj = new AjaxRequest();
 $_POST['user'] = trim(_Function::spaces($_POST['user']));
 $_POST['password'] = trim(_Function::spaces($_POST['password']));
 $emailAddress = $_POST['user'];
 if ($_POST['user'] == '' || strlen($_POST['user']) == 0) {
     echo '<strong>Field</strong> is required.';
 } else {
     if (preg_match('/[^a-z0-9\\_]/i', $_POST['user']) && !filter_var($emailAddress, FILTER_VALIDATE_EMAIL)) {
         echo $_SESSION['LANG']['username_email_not_invalid'];
     } else {
         if (mb_strlen($_POST['password'], 'utf8') < 5 || mb_strlen($_POST['password'], 'utf8') > 20) {
             echo $_SESSION['LANG']['pass_not_invalid'];
         } else {
             $res = $obj->signIn();
             if (isset($res['id'])) {
                 echo 'True';
                 $_SESSION['username'] = $res['username'];
                 $_SESSION['authenticated'] = $res['id'];
                 $_SESSION['lang_user'] = $res['language'];
                 if (isset($_POST['Keeplogged']) && $_POST['Keeplogged'] == 1) {
                     $time = time() + 60 * 60 * 24 * 1000;
                     setcookie('socialRemember', $res['id'], $time);
                 }
             } else {
                 echo $_SESSION['LANG']['account_not_active'];
             }
             // ELSE
         }
     }