AlaK4X
Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64



Your IP : 3.147.73.117


Current Path : /var/www/lhjmq-records.qc.ca/public_html/administration/session/
Upload File :
Current File : /var/www/lhjmq-records.qc.ca/public_html/administration/session/session_create.php.pre-netsimplify

<?php
//Include the standard includes
require("../includes/mysql_connect.php");
include("../includes/module_audit_func.php");

$bypass_password_checkup = false;
if(isset($_GET['loginmd5'])){
	//Request by md5 digest
	$result = mysql_query("SELECT * FROM secur_usagers WHERE MD5(CONCAT(username, password)) = '".$_GET['loginmd5']."'", $mysql_link);
	$bypass_password_checkup = true;
}else{
	//Request de login info
	$result = mysql_query("SELECT * FROM secur_usagers WHERE username = '".$_POST['username']."'", $mysql_link);
}

//Check if a row was returned
if(mysql_num_rows($result)){
	//A row was returned, fetch it
	$row = mysql_fetch_array($result);
	//Check the password
	if($row['password'] == $_POST['password'] || $bypass_password_checkup == true){
		//Password match, check if account is locked?
		if($row['actif'] == 1){
			//Send to the main menu
			if($_SERVER['SERVER_ADDR'] == '204.19.191.27'){
				header("location: http://204.19.191.98/administration/session/session_create.php?loginmd5=".md5($_POST['username'].$_POST['password']));
			}else{
				//Account active, let the user start a session
				session_start();
				//Save the username for future script reference
				session_register("session_username");
				session_register("session_id_usager");
				$session_id_usager = $row['id_usager'];
				$session_username = $row['username'];
				//Redirect
				header("location: session_menu.php?currentmenu=ops");
			}
		}else{
			//Account disabled, type 2 error
			if($_SERVER['SERVER_ADDR'] == '204.19.191.27'){
				header("location: http://204.19.191.98/administration/session/session_open.php?errornumber=2&previoususername=$username");
			}else{
				header("location: session_open.php?errornumber=2&previoususername=$username");
			}
		}
	}else{
		//Password doesn't match, type 1 error
		if($_SERVER['SERVER_ADDR'] == '204.19.191.27'){
			header("location: http://204.19.191.98/administration/session/session_open.php?errornumber=1&previoususername=$username");
		}else{
			header("location: session_open.php?errornumber=1&previoususername=$username");
		}
	}
}else{
	//Password doesn't match, type 1 error
	if($_SERVER['SERVER_ADDR'] == '204.19.191.27'){
		header("location: http://204.19.191.98/administration/session/session_open.php?errornumber=1&previoususername=$username");
	}else{
		header("location: session_open.php?errornumber=1&previoususername=$username");
	}
}

//Load the standard includes footers
require("../includes/mysql_cleanup.php");
?>