Example #1
0
 function do_login()
 {
     session_start();
     if ($_POST['usertype'] == 'student') {
         $this->load->model('user');
         $usr = new User();
         $usr->set_username($_POST['username']);
         $usr->set_credential($_POST['password']);
         $usr->start();
     } else {
         echo "Instructor or TA web service coming soon...";
     }
 }
Example #2
0
include ROOT_DIR . '/app/config.php';
set_include_path(ROOT_DIR . '/lib/' . PATH_SEPARATOR . ROOT_DIR . '/app/controllers/' . PATH_SEPARATOR . ROOT_DIR . '/app/models/' . PATH_SEPARATOR . get_include_path());
ini_set('display_errors', '0');
set_magic_quotes_runtime(0);
setlocale(LC_ALL, 'id_ID');
if (isset($_GET['theme'])) {
    $config['theme'] =& $_GET['theme'];
}
// for m.namadomain.com
if (strpos($_SERVER['HTTP_HOST'], 'm.') === 0) {
    $config['theme'] = 'm';
}
// Include pear module before autoload
require 'Mail.php';
function __autoload($class)
{
    if (!$class) {
        return;
    }
    $lib = strtolower($class) . '.php';
    require $lib;
}
// Cache
Cache::init($config['cache']['backend'], $config['cache']['options']);
Session::start();
User::start();
require ROOT_DIR . '/lib/controller.php';
ob_start();
Ctrl::dispatch();
$html = str_replace(array('/[\\r\\n\\t]/', '/\\s{2,}/'), array(' ', ' '), ob_get_clean());
echo $html;
Example #3
0
<?php

function my_session_start()
{
    if (ini_get('session.use_cookies') && isset($_COOKIE['PHPSESSID'])) {
        $sessid = $_COOKIE['PHPSESSID'];
    } elseif (!ini_get('session.use_only_cookies') && isset($_GET['PHPSESSID'])) {
        $sessid = $_GET['PHPSESSID'];
    } else {
        session_start();
        return true;
    }
    if (!preg_match('/^[-,a-zA-Z0-9]{1,128}$/', $sessid)) {
        return false;
    }
    session_start();
    return true;
}
if (!my_session_start()) {
    session_id(uniqid());
    session_start();
    session_regenerate_id();
}
class User extends \FW\User\User
{
}
User::start(isset($_SESSION['user']['id']) ? ['id' => (int) $_SESSION['user']['id']] : []);
if (!isset($_SESSION['antixsrf'])) {
    $_SESSION['antixsrf'] = md5(time() . $_SERVER['REMOTE_ADDR'] . (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : rand(1, 99999)));
}