Ejemplo n.º 1
0
 static function requireAuthenticate($is_ajax = true, $extra_secure = true, &$realUser = null)
 {
     global $api_key, $api_key_secret, $adminUserIDs;
     $u = MyAuth::checkAuthentication($extra_secure);
     if (!$u) {
         if ($is_ajax) {
             return 0;
         }
         $facebook = new Facebook($api_key, $api_key_secret);
         $user = $facebook->require_login();
         if ($user) {
             MyAuth::setLoginAuthenticate($user);
         }
         $u = $user;
     }
     if (isset($realUser)) {
         $realUser = $u;
     }
     //Return the mock_user if the real user is an administrator and mockuser is set
     $mu = GetAdminDebug('mock_user');
     if ($mu != 'NONE' && in_array(intval($u), $adminUserIDs)) {
         return $mu;
     } else {
         return $u;
     }
 }
Ejemplo n.º 2
0
        $fp->log($u);
        if ($u) {
            MyAuth::setLoginAuthenticate($u['uid']);
            header("Location: {$appAfterLoginUrl}");
            die;
        } else {
            echo '<span class="error_message">Login not valid!</span>';
        }
    } else {
        //signup
        $fp->log("Signup!");
        if (!User::RegisterUser($_REQUEST['first_name'], $_REQUEST['last_name'], $_REQUEST['email'], $_REQUEST['password'], $_REQUEST['gender'])) {
            echo '<span class="error_message">Probaly the email has been already used! Plase try wih a different one</span>';
        } else {
            $u = User::getByEmail($_REQUEST['email']);
            MyAuth::setLoginAuthenticate($u['uid']);
            header("Location: {$appAfterLoginUrl}");
            die;
        }
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta http-equiv="Content-Style-Type" content="text/css">
        <meta http-equiv="Content-Script-Type" content="text/javascript">

        <link rel="stylesheet" type="text/css" href="static/css/main.css<?php 
echo cache_burner();
Ejemplo n.º 3
0
         //show cookies
         echo '<pre>';
         print_r($_COOKIE);
         if (isset($_COOKIE['tjc_lo'])) {
             $a = explode(',', $_COOKIE['tjc_lo']);
             $t = $a[1];
             $curr_t = time();
             $exp_time = $curr_t - $t;
             echo "\nCookie 'lo' was set at ", date('l jS \\of F Y h:i:s A', $t), ' (', intval($exp_time / 60), ' min and ', $exp_time % 60, ' sec  ago)';
         }
         echo '</pre>';
     } else {
         if ($c == 2) {
             //Auth as user 10101010
             $u = '10101010';
             MyAuth::setLoginAuthenticate($u);
             echo "MyAuth::setLoginAuthenticate({$u}) executed";
         } else {
             if ($c == 3) {
                 //perform the check auth
                 $n = MyAuth::checkAuthentication(false);
                 $e = MyAuth::checkAuthentication();
                 echo '<pre>';
                 print_r($_COOKIE);
                 echo "Auth (normal) user is {$n}\n";
                 echo "Auth (extra secure) user is {$e}";
                 echo '</pre>';
             }
         }
     }
 }