Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64
Your IP : 3.21.244.34
<?php
//Saves a complete goal event and it's sub events
function goalieSave($mysql, $id_partie, $nume, $numin, $tmpin, $perin, $numout, $tmpout, $perout, $bc, $fd, $lan, $dang){
global $session_id_usager, $REMOTE_ADDR;
//Fix the times
$tmpin = fixTime($tmpin);
$tmpout = fixTime($tmpout);
//Get the team numbers
$changingTeam = $nume;
//Get the player 1 (Goalie In)
if($numin != ""){
$sql = "SELECT id_partie_joueur, id_equipe FROM parties_joueurs WHERE id_partie = $id_partie AND numero = '$numin' AND id_equipe = $changingTeam";
$numin_item = mysql_fetch_array(mysql_query($sql, $mysql));
}
//Get the player 2 (Goalie Out)
if($numout != ""){
$sql = "SELECT id_partie_joueur, id_equipe FROM parties_joueurs WHERE id_partie = $id_partie AND numero = '$numout' AND id_equipe = $changingTeam";
$numout_item = mysql_fetch_array(mysql_query($sql, $mysql));
}
//Write the main event (Goalie Change)
if($numin != ""){
mysql_query($sql = "INSERT INTO parties_events (id_partie, code_event, minutes, periode, ip, timestamp, id_usager) VALUES($id_partie, 6, '00:$tmpin', $perin, '" . $REMOTE_ADDR . "', '" . date("Y-m-d G:i:s") . "', " . $session_id_usager . ")", $mysql);
$id_event = mysql_insert_id($mysql);
}else{
mysql_query($sql = "INSERT INTO parties_events (id_partie, code_event, minutes, periode, ip, timestamp, id_usager) VALUES($id_partie, 6, '00:$tmpout', $perout, '" . $REMOTE_ADDR . "', '" . date("Y-m-d G:i:s") . "', " . $session_id_usager . ")", $mysql);
$id_event = mysql_insert_id($mysql);
}
//Write the IN event if any
if(isset($numin_item)){
mysql_query($sql = "INSERT INTO parties_subevents (id_partie_event, id_equipe, id_partie_joueur, code_subevent, param5) VALUES($id_event, $changingTeam, $numin_item[id_partie_joueur], 9, '00:$tmpin')", $mysql);
}
//Write the OUT event if any
if(isset($numout_item)){
if(!isset($bc) or $bc == ""){$bc = 0;}
if(!isset($fd) or $fd == ""){$fd = 0;}
if(!isset($lan) or $lan == ""){$lan = 0;}
if(!isset($dang) or $dang == ""){$dang = 0;}
mysql_query($sql = "INSERT INTO parties_subevents (id_partie_event, id_equipe, id_partie_joueur, code_subevent, param5, param1, param2, param3, param4) VALUES($id_event, $changingTeam, $numout_item[id_partie_joueur], 8, '00:$tmpout', $bc, $fd, $lan, $dang)", $mysql);
}
}
?>
|