您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

43 行
1.2 KiB

<?php
/**
* Mempersiapkan session. session.use_trans_sid digunakan untuk menghindari
* penyantuman Session ID pada setiap URL.
*
* Ref: https://stackoverflow.com/questions/1745984/php-session-use-trans-sid
*/
ini_set('session.use_only_cookies', TRUE );
ini_set('session.use_trans_sid', FALSE );
session_start();
require_once("conn/db.php");
require_once('utils/helper.php');
/**
* Cek session serta token. Kemudian menyimpan nilai NIM dari session.
*/
if (!isset($_SESSION['nim']) && !isset($_SESSION['token'])) {
header('location:login.php');
} else {
$nim = $_SESSION['nim'];
}
if ($_POST['formSubmit'] == "Login") {
$nims = $_POST['nim'];
$pass = $_POST['pass'];
$cekuser = odbc_exec($koneksi, "SELECT * FROM tb_mhs WHERE nim = '" . $nims . "'");
$hasil = odbc_fetch_array($cekuser);
if ($pass <> $hasil['pass']) {
echo $pass . ' ' . $hasil['pass'];
echo "Password salah!";
header('location:login.php?s=2');
} else if ($nims <> $hasil['nim']) {
header('location:login.php?s=1');
} else {
$_SESSION['nim'] = $hasil['nim'];
header('location:tampilanSION.php');
}
}