0){ session_start(); include "timeout.php"; $_SESSION[namauser] = $r[username]; $_SESSION[namalengkap] = $r[nama_lengkap]; $_SESSION[passuser] = $r[password]; $_SESSION[leveluser] = $r[level]; $signas = $r[signas]; $nik = $r[nik]; $query=mysql_query("SELECT a.kode_perusahaan,CONCAT(b.namajabatan,' ',c.namadivisi) AS posisi,a.jnskelamin FROM dberp.karyawan a LEFT JOIN dberp.jabatan b ON b.kode_jabatan=a.kode_jabatan LEFT JOIN dberp.divisi c ON c.kode_divisi=a.kode_divisi WHERE a.nik='$nik'"); $data=mysql_fetch_array($query); $_SESSION[kodeprshn] = $data[kode_perusahaan]; $_SESSION[posisi] = $data[posisi]; if($data[jnskelamin]==1){ $_SESSION[pathavatar] = "img/avatar5.png"; }else{ $_SESSION[pathavatar] = "img/avatar6.jpg"; } // session timeout $_SESSION[login] = 1; timer(); $ipaddress = empty($_SERVER['HTTP_CLIENT_IP'])?(empty($_SERVER['HTTP_X_FORWARDED_FOR'])? $_SERVER['REMOTE_ADDR']:$_SERVER['HTTP_X_FORWARDED_FOR']):$_SERVER['HTTP_CLIENT_IP']; $sql = "UPDATE dberp.userapp SET lastupdate=now(),lastlogin=now(),ipaddress='$ipaddress',online=1 WHERE username='$_SESSION[namauser]'"; mysql_query($sql); if($signas!=NULL){ header('location:../media.php?mod=home'); }else{ header('location:../media.php?mod=dashboard'); } } return false; } function msg(){ echo "






Maaf, silahkan cek kembali User ID dan Password Anda

Kesalahan $_SESSION[salah]
"; return false; } function salah_blokir($username){ echo "






User ID $username telah TERBLOKIR

"; return false; } function salah_username($username){ echo "






User ID $username tidak dikenal !!

"; return false; } function username_aktif($username){ echo "






Status User ID $username masih aktif digunakan!
"; return false; } function salah_password(){ echo "






Maaf, silahkan cek kembali Password Anda

Kesalahan $_SESSION[salah]
"; return false; } function blokir($username){ $ipaddress = empty($_SERVER['HTTP_CLIENT_IP'])?(empty($_SERVER['HTTP_X_FORWARDED_FOR'])? $_SERVER['REMOTE_ADDR']:$_SERVER['HTTP_X_FORWARDED_FOR']):$_SERVER['HTTP_CLIENT_IP']; $sql = "UPDATE userapp SET lastlogin=now(),ipaddress='$ipaddress',blokir='Y' WHERE username='$username'"; mysql_query($sql); session_start(); session_destroy(); return false; } ?>