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.148.108.174


Current Path : /var/www/lhjmq-records.qc.ca/public_html/administration/security_sysblockage/
Upload File :
Current File : /var/www/lhjmq-records.qc.ca/public_html/administration/security_sysblockage/execute.php

<?
//Load the standard includes
include("../includes/secur_isloggedin.php");
//Make certain that the user is none other than sysadmin
if($session_username != "sysadmin"){
	exit("Unauthorized usage of this page");
}
//continue standard includes
include("../includes/mysql_connect.php");

//Flush the Dump Table
mysql_query("DELETE FROM secur_groupes_dump", $mysql_link);

//Get all the groups
$query = "SELECT * FROM secur_groupes ORDER BY id_groupe";
$result = mysql_query("$query", $mysql_link);

//Loop the groups and dump them in the dump table
while($row = mysql_fetch_array($result)){
	//Insert this row in the dump
	mysql_query("INSERT INTO secur_groupes_dump VALUES($row[id_groupe], '$row[nom]', '$row[description]', $row[niveaugroupe], $row[typegroupe], $row[actif])", $mysql_link);
}

//Dump the current group active flags
mysql_query("UPDATE secur_groupes SET actif = 0");

//Generate a random number 7 times to get a 32 digit number
$blockcode1 = rand(10000,99999);
$blockcode2 = rand(10000,99999);
$blockcode3 = rand(10000,99999);
$blockcode4 = rand(10000,99999);
$blockcode5 = rand(10000,99999);
$blockcode6 = rand(10000,99999);
$blockcode7 = rand(10,99);

//Generate the total number
$blockcode = $blockcode1 . " " . $blockcode2 . " " . $blockcode3 . " " . $blockcode4 . " " . $blockcode5 . " " . $blockcode6 . " " . $blockcode7;

//Save the block code
mysql_query("UPDATE lhjmq_variables SET var_text = '$blockcode' WHERE id_var = 'secur_block_32_digit_code'", $mysql_link);

//Get the email address of the person in charge
$row = mysql_fetch_array(mysql_query("SELECT var_text FROM lhjmq_variables WHERE id_var = 'secur_admin_email'", $mysql_link));
$secur_admin_email = $row[var_text];

//Send an email with the unblock code
mail("$secur_admin_email", "Security system unblock code", "The self-generated security system unblock code is: $blockcode\n\nSecurity system", "From: LHJMQ Security System <security-system@lhjmq.qc.ca>");

//Load the standard includes footers
include("../includes/mysql_cleanup.php");

//Redirect
header("location: ../session/session_menu.php");
?>