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


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/faceoffSave.php

<?php
function faceoffSave($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;
	}
	
	//Get the player 1 (Faceoff)
	if($numjVis != ""){
		$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));
	}
	
	//Get the player 2 (Faceoff)
	if($numjDom != ""){
		$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));
	}
	
	//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, 7, '00:$tmp', $per, '" . $REMOTE_ADDR . "', '" . date("Y-m-d G:i:s") . "', " . $session_id_usager . ")", $mysql);
	$id_event = mysql_insert_id($mysql);
	//Write the player1 sub event (Faceoff)
	if(isset($numjVis_item)){
		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], 7, $visStatus, $visZone)", $mysql);
	}
	if(isset($numjDom_item)){
		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], 7, $domStatus, $domZone)", $mysql);
	}
}
?>