Example #1
0
 function __construct()
 {
     // Menciptakan session
     $salt = "beruangitunyata";
     require_once "config/koneksi.php";
     require_once 'controller/fungsilogin.php';
     $login = new logmein();
     if ($login->cek_login($mysqli) == true) {
         header("location: adminview/index.php");
         exit;
     } elseif (isset($_POST['login'])) {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             if (isset($_POST['username']) and isset($_POST['password'])) {
                 $username = addslashes($_POST['username']);
                 # $_POST['username'] diambil dari name pada form login
                 $password = addslashes(md5($_POST['password'] . $salt));
                 # $_POST['password'] diambil dari name pada form login. MD5 dibuat untuk encrypsi
                 if ($login->login($username, $password, $mysqli) == true) {
                     if ($_SESSION['status'] == '1') {
                         header("location: adminview/index.php");
                     } else {
                         if ($_SESSION['status_konfirmasi'] == '0') {
                             header("location: index.php?key=aktivasi");
                         } else {
                             header("location: index.php#caramendaftar");
                         }
                         exit;
                     }
                 } else {
                     // Gagal login
                     echo "<script>alert('password anda salah'); document.location = 'index.php';</script>";
                 }
             }
         }
     } else {
         echo "<script>alert('anda harus login terlebih dahulu'); document.location = 'index.php';</script>";
     }
 }
Example #2
0
<?php

//instantiate if needed
include "class.login.php";
$log = new logmein();
$log->encrypt = true;
//set encryption
if ($_POST['action'] == "login") {
    if ($log->login("logon", $_POST['username'], $_POST['password']) == true) {
        //do something on successful login
        // CHECK USER LEVELS AND REDIRECT TO APPROPRIATE FILES
        //echo "Successful Login: "******"! You are now being redirected.";
        switch ($_SESSION['userlevel']) {
            case 0:
                // Admin
                header("Location:interface/admin/main.php");
                break;
            case 1:
                // Physician
                header("Location:interface/physician/main.php");
                break;
            case 2:
                // Receptionist
                header("Location:interface/receptionist/main.php");
                break;
            case 3:
                // Pharmacist
                header("Location:interface/pharmacist/main.php");
                break;
            default:
                // Unknown User
Example #3
0
<?php

session_start();
// Menciptakan session
require_once "config/koneksi.php";
require_once 'controller/fungsilogin.php';
$login = new logmein();
if ($login->cek_login($mysqli) == true) {
    header("location: adminview/index.php");
    exit;
} elseif (isset($_POST['login'])) {
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        if (isset($_POST['username']) and isset($_POST['password'])) {
            $username = addslashes($_POST['username']);
            # $_POST['username'] diambil dari name pada form login
            $password = addslashes(md5($_POST['password']));
            # $_POST['password'] diambil dari name pada form login. MD5 dibuat untuk encrypsi
            if ($login->login($username, $password, $mysqli) == true) {
                header("location: adminview/index.php");
                exit;
            } else {
                // Gagal login
                echo "<script>alert('password anda salah'); document.location = 'index.php';</script>";
            }
        }
    }
} else {
    echo "<script>alert('anda harus login terlebih dahulu'); document.location = 'index.php';</script>";
}