Example #1
0
<?php

# define('WE_ARE_TESTING', true);
require_once 'init.php';
$qq = new QQ();
$server = $qq->server();
$qv = array();
$qv['server'] = $server;
$qv['flash'] = $qq->flash();
$qv['pagetitle'] = '';
$qv['basehref'] = 'http://' . ($server['host'] == 'songwork.dev' ? 'songwork.dev' : 'songwork.com');
$qv['bodyid'] = str_replace('/', '-', $server['script']);
if (strpos($qv['bodyid'], '-') === false) {
    $qv['bodyid'] = 'x-' . $qv['bodyid'];
}
########### IDENTIFICATION
$p = Person::get_by_cookie();
# lopass interception: http://songwork.com/home/1234/ab8f
# not full auth, only to have existing client's name & address pre-filled from database for forms
if ($p === false && isset($_SERVER['PATH_INFO']) && preg_match('/\\/(\\d*)\\/([0-9a-zA-Z]{4})$/', $_SERVER['PATH_INFO'], $matches)) {
    $possible_id = $matches[1];
    $possible_lopass = $matches[2];
    $pp = Person::get_by_id_lopass($possible_id, $possible_lopass);
    if ($pp !== false) {
        $pp->set_welcome_cookie();
        $p = $pp;
    }
}
$student = Student::get_by_person($p);
$teacher = Teacher::get_by_person($p);
$admin = Administrator::get_by_person($p);