コード例 #1
0
require_once __DIR__ . '/config.php';
require_once __DIR__ . '/../utility/database/mysql_db.php';
require_once __DIR__ . '/../utility/utilityCode.php';
require_once __DIR__ . "/../library/security/HTMLPurifier.auto.php";
// ====================================================
// ============== TAMBAHKAN MODEL DISINI ==============
require_once __DIR__ . '/../model/modelPengguna.php';
// ====================================================
// ============== TAMBAHKAN CLASS DISINI ==============
$CONFIG = new config();
$DB = new mysql_db();
$UTILITY = new utilityCode();
$PENGGUNA = new modelPengguna();
// ====================================================
$config_security = HTMLPurifier_Config::createDefault();
$config_security->set('URI.HostBlacklist', array('google.com'));
$purifier = new HTMLPurifier($config_security);
$cek = $_SERVER['SCRIPT_NAME'];
$temp = explode("/", $cek);
$file = end($temp);
if ($_SESSION["user_name"] == "") {
    if (isset($_COOKIE[$cookie_name])) {
        include 'autologin.php';
    } else {
        if ($file != "index.php") {
            session_destroy();
            $UTILITY->popup_message("Maaf anda harus login terlebih dahulu");
            $UTILITY->location_goto("#");
        }
    }
}
コード例 #2
0
ファイル: login_proses.php プロジェクト: ceciljc/inacor
require_once __DIR__ . '/../utility/utilityCode.php';
//Untuk Model
require_once __DIR__ . '/../model/modelPengguna.php';
//Akhir Model
$CONFIG = new config();
$DB = new mysql_db();
$UTILITY = new utilityCode();
$PENGGUNA = new modelPengguna();
$id = $_POST['Login'];
//echo "ID=$id";
if (isset($id)) {
    $user_name1 = $_POST['username'];
    $user_pass1 = $UTILITY->sha512($_POST['password']);
    $pass = $_POST['password'];
    if (!$user_pass1 || !$user_name1) {
        $UTILITY->popup_message("Maaf anda harus login terlebih dahulu!");
        $UTILITY->location_goto(".");
    } else {
        //$data = array("username" => "$user_name1", "status_user" => 1);
        $data = array("username" => "{$user_name1}");
        $hasil = $PENGGUNA->readPengguna($data);
        $panjang = count($hasil);
        if ($panjang < 1) {
            session_destroy();
            $UTILITY->location_goto(".");
        } else {
            $pass = $hasil->password;
            $nam = $hasil->username;
            $user_id = $hasil->user_id;
            $level = $hasil->level;
            $keterangan = $hasil->keterangan;