| Server IP : 27.254.66.5 / Your IP : 216.73.217.39 Web Server : Apache/2 System : Linux cs82.hostneverdie.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64 User : technic2 ( 1951) PHP Version : 7.4.30 Disable Function : apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd,exec, fp, fput, highlight_file, ini_alter, ini_restore, inject_code, passthru,phpAds_remoteInfo, phpAds_XmlRpc,phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid,posix_setuid, posix_setuid, posix_uname,proc_open,proc_close, proc_get_status, proc_nice, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode, show_source,sleep,pcntl_exec,virtual,suexec,dbmopen,dl,symlink,disk_free_space,diskfreespace,leak MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/technic2/public_html/ |
Upload File : |
<html lang="en">
<head>
<title>Rayong Technical College</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
</head>
<body>
<?php
#starts a new session
session_start();
#includes a database connection
include('connect.php');
#catches user/password submitted by html form
// $USE_NAME = $_POST['USE_NAME'];
// $USE_SECUREKEY = $_POST['USE_SECUREKEY'];
if(isset($_GET['usr_login'])){$usr_login=$_GET['usr_login'];}
if(isset($_POST['usr_login'])){$usr_login=$_POST['usr_login'];}
if(isset($_GET['usr_pwd'])){$usr_pwd=$_GET['usr_pwd'];}
if(isset($_POST['usr_pwd'])){$usr_pwd=$_POST['usr_pwd'];}
#checks if the html form is filled
if(empty($_POST['usr_login']) || empty($_POST['usr_pwd'])){
echo "Fill all the fields!";
}else{
$query = "SELECT * FROM user WHERE usr_login='$usr_login' AND "."usr_pwd='$usr_pwd'";
$result = mysqli_query($conn, $query); //$conn is your connection in 'connection.php'
//echo $query;
#checks if the search was made
if($result === false){
die( print_r( sqlsrv_errors(), true));
}
#checks if the search brought some row and if it is one only row
if(mysqli_num_rows($result) != 1){
// echo "User/password not found";
?>
<div align="center" class="alert alert-danger" role="alert">" User/password not found (ชื่อ / รหัสผ่าน ไม่ถูกต้อง) " <a href="login.php"> => กรุณาลองใหม่อีกครั้ง <=</a></div>
<?php
}else{
#creates sessions
if(mysqli_num_rows($result) > 0){
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
$key=$row['usr_id'];
$_SESSION['usr_id'] = $row['usr_id'];
$_SESSION['usr_login'] = $row['usr_login'];
$_SESSION['usr_type'] = $row['usr_type'];
}
#redirects user
if($_SESSION['usr_type'] == 'admin')
{
// header("location:admin_page.php?usr_id=".$key."");
header("location:admin_page.php");
}else{
header("location:login.php");
}
}
}
mysql_close($conn);
?>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
</body>
</html>