コード例 #1
0
ファイル: index.php プロジェクト: techczech/tuit
/*
   compare the contents of received cookie with database and if both
   are the same, then treat user as already logged. the IP is also compared
   for 'safety'..
   if we don't get a cookie or get '***' (which we send after logout),
   user can only see login and acct_request sections..
*/
if (isset($udata)) {
    $udata = array();
}
if (isset($bisquit) and strcmp($bisquit, "***")) {
    @($res = mysql_query("select id,login,name,email,send_note,admin from users where ip='{$REMOTE_ADDR}' and cookie='{$bisquit}'"));
    if (!@($udata = mysql_fetch_array($res))) {
        $section = 'login';
    } else {
        $page->set_logged(1);
        @($res2 = mysql_query("select uc_cou_id from user_categories where uc_u_id='" . $udata['id'] . "'"));
        while (@($row2 = mysql_fetch_array($res2))) {
            $MY_CATEGORIES[$row2['uc_cou_id']] = $row2['uc_cou_id'];
        }
    }
    if (empty($section) and is_numeric($exercise)) {
        $section = 'exercise_display';
    } elseif (empty($section) and is_numeric($unit)) {
        $section = 'unit_display';
    }
    if (empty($section)) {
        $section = 'main';
    }
} elseif (!isset($section) and is_numeric($exercise) or is_numeric($unit)) {
    $section = 'public_access';