コード例 #1
0
ファイル: function.php プロジェクト: mul14/FiyoCMS
function load_login()
{
    if (isset($_POST['fiyo_login'])) {
        $db = new FQuery();
        $user = mysql_real_escape_string($_POST['user']);
        $sql = $db->select(FDBPrefix . "user", "*", "status=1 AND user='******' AND password='******'pass']) . "'");
        $qr = mysql_fetch_array($sql);
        $jml = mysql_affected_rows();
        if ($jml > 0) {
            $_SESSION['USER_ID'] = $qr['id'];
            $_SESSION['USER'] = $qr['user'];
            $_SESSION['USER_NAME'] = $qr['name'];
            $_SESSION['USER_EMAIL'] = $qr['email'];
            $_SESSION['USER_LEVEL'] = $qr['level'];
            $_SESSION['USER_LOG'] = $qr['time_log'];
            $time_log = date('Y-m-d H:i:s');
            $db->update(FDBPrefix . 'user', array("time_log" => "{$time_log}"), "id={$qr['id']}");
            $db->delete(FDBPrefix . "session_login", "user_id={$qr['id']}");
            $qr = $db->insert(FDBPrefix . "session_login", array("{$qr['id']}", "{$qr['user']}", "{$qr['level']}", date('Y-m-d H:i:s')));
        }
        if ($qr or !empty($_SESSION['USER_ID']) and $_SESSION['USER_LEVEL'] <= 3 and userInfo()) {
            redirect(getUrl());
        } else {
            select_themes('login');
            alert('error', Login_Error);
        }
    } else {
        if (isset($_GET['theme']) and $_GET['theme'] == 'blank') {
            echo "Redirecting...";
        } else {
            select_themes('login');
        }
    }
}
コード例 #2
0
/*                                                                      */
/* Copyright (c) 2002 by Meir Michanie                                  */
/* http://www.riunx.com                                                 */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
if (!eregi("modules.php", $PHP_SELF)) {
    die("You can't access this file directly...");
}
include_once "mainfile.php";
if (isset($submit)) {
    write_config($theme_selected);
} else {
    select_themes();
}
function get_themes()
{
    global $name;
    $themes = null;
    if ($handle = opendir("modules/{$name}/themes")) {
        echo "Themes:\n";
        /* This is the correct way to loop over the directory. */
        while (false !== ($file = readdir($handle))) {
            if (is_dir("modules/{$name}/themes/{$file}") and $file != "." and $file != ".." and $file != "CVS") {
                $themes[] = "{$file}";
            }
        }
        closedir($handle);
    }