コード例 #1
0
ファイル: admin.inc.php プロジェクト: khanhnnvn/OKMS
        } elseif (!isset($row['User_Username'])) {
            $err[] = 'Wrong username and/or password!';
        }
    }
}
if (!username_existed($_SESSION['username'])) {
    session_name('kms');
    session_unset();
    session_destroy();
} elseif (username_existed($_SESSION['username'])) {
    session_name('kms');
    session_start();
}
/* End Auth */
$p = isset($_GET['p']) ? rawurldecode($_GET['p']) : 'home';
$pid = get_pid_from_url($p);
$uid = substr($p, 5);
$username = get_username_from_url($p);
$week = get_week_from_url($p);
$course_week = get_course_week_from_url($p);
$cid = isset($course_week) ? $course_week['cid'] : (isset($_POST['cid']) ? $_POST['cid'] : get_cid_from_url($p));
$cids = $_SESSION['rid'] == 1 ? cids_load_all() : user_cids_load_all($_SESSION['uid']);
$pids = user_pids_load_all($_SESSION['uid']);
$user = user_load($_SESSION['uid']);
$post = post_load($pid);
$course = course_load($cid);
$users = $db->array_load_all('USER');
$user_paths = array();
for ($i = 0; $i < count($users); $i++) {
    $user_paths[$i] = 'user/' . $users[$i]['User_ID'];
}
コード例 #2
0
ファイル: functions.inc.php プロジェクト: khanhnnvn/OKMS
function get_cid_from_url($p)
{
    //Get course ID from page URL, for use in admin.inc
    $pos = strpos($p, '/', 0);
    $code = substr($p, $pos + 1);
    $pid = get_pid_from_url($p);
    $post = post_load($pid);
    $course = course_load_from_code($code);
    return isset($post) ? $post['Course_ID'] : (isset($course) ? $course['Course_ID'] : 0);
}