%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/riacommer/domains/gasworld.com.my/public_html/admin/api/
Upload File :
Create Path :
Current File : /home/riacommer/domains/gasworld.com.my/public_html/admin/api/login.php

<?php
session_start();
include_once("db.php");
if(isset($_POST["act"])){
	if($_POST["act"]=="login"){
		$uid = $_POST["uid"];
		$pwd = $_POST["pwd"];
		
		$sql = "SELECT * FROM sys_usr WHERE uid='$uid'";
		$mysql_result = mysql_query($sql, $connection);
		$num_rows = mysql_num_rows($mysql_result);
		if($num_rows>=1){
			while($row = mysql_fetch_array($mysql_result)){
				if($row["pwd"]==sha1($pwd)){
					$_SESSION["user_id"] = $row["id"];
					$_SESSION["user_name"] = $row["staff_name"];
					$_SESSION["user_group"] = $row["group_id"];

					header("Location: http://".$_SERVER['HTTP_HOST'] . str_replace("/api", "", dirname($_SERVER['PHP_SELF']))."/index.php", true);
				} else {
					$msg = "Incorrect Password. Please try again.";
					header("Location: http://".$_SERVER['HTTP_HOST'] . str_replace("/api", "", dirname($_SERVER['PHP_SELF']))."/login.php?f=1", true);
				}
			}
		} else {
			header("Location: http://".$_SERVER['HTTP_HOST'] . str_replace("/api", "", dirname($_SERVER['PHP_SELF']))."/login.php?f=2", true);
		}
		
	}
} else {
	header("Location: http://" .$_SERVER['HTTP_HOST'] . str_replace("/api", "", dirname($_SERVER['PHP_SELF'])) ."/400.php");
}
?>

Zerion Mini Shell 1.0