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 "