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


Current Path : /var/www/lhjmq-records.qc.ca/public_html/administration/op_resultats/lib/
Upload File :
Current File : /var/www/lhjmq-records.qc.ca/public_html/administration/op_resultats/lib/checkingSave.php

<?php
function checkingSave($mysql, $id_partie, $nume, $numjVis, $numjDom, $zone, $tmp, $per){

	global $session_id_usager, $REMOTE_ADDR;

	//Fix the times
	$tmp = fixTime($tmp);
	
	//Get the team numbers
	$sql = "SELECT id_equipe_dom AS sd, id_equipe_vis AS sv FROM parties WHERE id_partie = $id_partie";
	$teamIds = mysql_fetch_array(mysql_query($sql, $mysql));
	$idVis = $teamIds[sv];
	$idDom = $teamIds[sd];
	//Visitors are on left, Local on right
	//Find the winner
	if($nume == $idVis){
		$visStatus = 1;
		$domStatus = 2;
		$visZone = $zone;
		$domZone = 4 - $zone;
	}else{
		$visStatus = 2;
		$domStatus = 1;
		$visZone = 4 - $zone;
		$domZone = $zone;
	}
	
	//Write the main event (Faceoff)
	mysql_query($sql = "INSERT INTO parties_events (id_partie, code_event, minutes, periode, ip, timestamp, id_usager) VALUES($id_partie, 9, '00:$tmp', $per, '" . $REMOTE_ADDR . "', '" . date("Y-m-d G:i:s") . "', " . $session_id_usager . ")", $mysql);
	$id_event = mysql_insert_id($mysql);
	
	//Get the player 1 (Faceoff)
	if($numjVis != "999"){
		$sql = "SELECT id_partie_joueur, id_equipe FROM parties_joueurs WHERE id_partie = $id_partie AND numero = '$numjVis' AND id_equipe = $idVis";
		$numjVis_item = mysql_fetch_array(mysql_query($sql, $mysql));
		mysql_query($sql = "INSERT INTO parties_subevents (id_partie_event, id_equipe, id_partie_joueur, code_subevent, param1, param2) VALUES($id_event, $idVis, $numjVis_item[id_partie_joueur], 6, $visStatus, $visZone)", $mysql);
	}else{
		mysql_query($sql = "INSERT INTO parties_subevents (id_partie_event, id_equipe, id_partie_joueur, code_subevent, param1, param2) VALUES($id_event, $idVis, 0, 6, $visStatus, $visZone)", $mysql);
	}
	
	//Get the player 2 (Faceoff)
	if($numjDom != "999"){
		$sql = "SELECT id_partie_joueur, id_equipe FROM parties_joueurs WHERE id_partie = $id_partie AND numero = '$numjDom' AND id_equipe = $idDom";
		$numjDom_item = mysql_fetch_array(mysql_query($sql, $mysql));
		mysql_query($sql = "INSERT INTO parties_subevents (id_partie_event, id_equipe, id_partie_joueur, code_subevent, param1, param2) VALUES($id_event, $idDom, $numjDom_item[id_partie_joueur], 6, $domStatus, $domZone)", $mysql);
	}else{
		mysql_query($sql = "INSERT INTO parties_subevents (id_partie_event, id_equipe, id_partie_joueur, code_subevent, param1, param2) VALUES($id_event, $idDom, 0, 6, $domStatus, $domZone)", $mysql);
	}
}
?>