public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Beispiel #2
0
 * and open the template in the editor.
 */
#This code provided by:
#Andreas Hadiyono (andre.hadiyono@gmail.com)
#Gunadarma University
define("__DIR__", "/opt/lampp/htdocs/demo/core");
require_once __DIR__ . '/../config/config.php';
require_once __DIR__ . '/../utility/database/mysql_db.php';
require_once __DIR__ . '/../utility/utilityCode.php';
//Untuk Model
require_once __DIR__ . '/../model/modelUser.php';
//Akhir Model
$CONFIG = new config();
$DB = new mysql_db();
$UTILITY = new utilityCode();
$USER = new modelUser();
$id = $_POST['Login'];
//echo "ID=$id";
if (isset($id)) {
    $user_name1 = $_POST['username'];
    $user_pass1 = $UTILITY->sha512($_POST['password']);
    $pass = $_POST['password'];
    //    echo "$user_pass1";
    //  exit;
    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("userlogin" => "{$user_name1}");
        $hasil = $USER->readUser($data);
            $pagetitle = 'Login';
            $view = 'Login';
        }
        break;
    case 'read':
        $view = 'ToutFaire';
        $message = ' Vous n\'êtes pas autorisé ';
        if (isset($_SESSION['id']) && $_GET['id'] == isset($_SESSION['id'])) {
            $pagetitle = $_SESSION['id'];
            $view = '';
            $layout = 'viewConnected';
            $usr = modelUser::select($_SESSION['id']);
        }
        break;
    case 'activation':
        $view = 'ToutFaire';
        $pagetitle = 'Activation compte';
        $code = $_GET['code'];
        $id = $_GET['idUsr'];
        $usr = modelUser::select($id);
        if ($code == $usr->getCodAct()) {
            $message = "Bienvenue sur Sneaker {$usr->getName()}";
            $layout = 'viewConnected';
            $_SESSION['id'] = $usr->getIdUser();
            $_SESSION['name'] = $usr->getFirstName();
        } else {
            $message = 'Une erreur est survenue';
        }
        break;
}
require "{$ROOT}{$DS}view{$DS}{$layout}.php";
Beispiel #4
0
<?php

include '../../model/modelUser.php';
include '../../config/purifier.php';
$User = new modelUser();
if (empty($_POST['manage'])) {
    echo "Error Data Tidak Tersedia";
} else {
    $manage = $_POST['manage'];
    switch ($manage) {
        case 'adduser':
            $user_name = $purifier->purify($_POST['user_name']);
            $user_pass = $purifier->purify(md5($_POST['user_pass']));
            $email = $purifier->purify($_POST['email']);
            $kd_lokasi = $purifier->purify($_POST['kduakpb']);
            $data = array("user_name" => $user_name, "user_pass" => $user_pass, "user_email" => $email, "kd_lokasi" => $kd_lokasi);
            $User->tambahuser($data);
            break;
        default:
            echo "Error Data Tidak Tersedia";
            break;
    }
}
Beispiel #5
0
 static function insertUsr($tab, $id, $mail, $code)
 {
     $res = false;
     if (self::sendMail($id, $mail, $code)) {
         modelUser::insert($tab);
         $res = true;
     }
     return $res;
 }