Example #1
0
//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;
            $provinsi = $hasil->provinsi;
Example #2
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("#");
        }
    }
}
Example #3
0
if (isset($cookie_name)) {
    // Check if the cookie exists
    $UTILITY->show_data("asdasd");
    if (isset($_COOKIE[$cookie_name])) {
        parse_str($_COOKIE[$cookie_name]);
        //list($iv,$hash)= explode (";", $hash);
        //$fileplain=  $UTILITY->dekripsi($algoritma, $mode, $iv, $secretkey, $fileplain, $hash);
        // $hash=$fileplain;
        $data = array("username" => "{$usr}", "user_id" => $hash);
        $hasil = $PENGGUNA->readPengguna($data);
        $panjang = count($hasil);
        $UTILITY->show_data($hasil);
        echo "Panjangg {$panjang}";
        if ($panjang < 1) {
            session_destroy();
            $UTILITY->location_goto("index.php");
        } else {
            $pass = $hasil->password;
            $nam = $hasil->username;
            $user_id = $hasil->user_id;
            $level = $hasil->level;
            $keterangan = $hasil->keterangan;
            $provinsi = $hasil->provinsi;
            $kabupaten = $hasil->kabupaten;
            $status_user = $hasil->status_user;
            //set session
            $_SESSION['keterangan'] = $keterangan;
            $_SESSION['provinsi'] = $provinsi;
            $_SESSION['kabupaten'] = $kabupaten;
            $_SESSION['status_user'] = $status_user;
            $_SESSION['level'] = $level;