Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64
Your IP : 52.14.140.108
<?php
function shotSave($mysql, $id_partie, $nume, $numj, $gb, $dang, $sit, $tmp, $per){
global $session_id_usager, $REMOTE_ADDR;
//Fix the times
$tmp = fixTime($tmp);
//Fix the checkbox option
if($dang != 2){$dang = 1;}
//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];
if($nume == $idVis){
$shootingTeam = $idVis;
$receivingTeam = $idDom;
}else{
$shootingTeam = $idDom;
$receivingTeam = $idVis;
}
//Get the player 1 (shot)
if($numj != ""){
$sql = "SELECT id_partie_joueur, id_equipe FROM parties_joueurs WHERE id_partie = $id_partie AND numero = '" . $numj . "' AND id_equipe = $shootingTeam";
$numj_item = mysql_fetch_array(mysql_query($sql, $mysql));
}
//Get the player 2 (Goalie: BlockedShot)
if($gb != ""){
$sql = "SELECT id_partie_joueur, id_equipe FROM parties_joueurs WHERE id_partie = $id_partie AND numero = '" . $gb . "' AND id_equipe = $receivingTeam";
$gb_item = mysql_fetch_array(mysql_query($sql, $mysql));
}
//Write the main event (Shot)
$sql = "INSERT INTO parties_events (id_partie, code_event, minutes, periode, ip, timestamp, id_usager) VALUES($id_partie, 8, '00:$tmp', $per, '" . $REMOTE_ADDR . "', '" . date("Y-m-d G:i:s") . "', " . $session_id_usager . ")";
mysql_query($sql, $mysql);
$id_event = mysql_insert_id($mysql);
//Write the player1 sub event (Shot)
if(isset($numj_item)){
$sql = "INSERT INTO parties_subevents (id_partie_event, id_equipe, id_partie_joueur, code_subevent, param1, param2) VALUES($id_event, $shootingTeam, $numj_item[id_partie_joueur], 5, $dang, $sit)";
mysql_query($sql, $mysql);
}
//Write the player2 sub event (BlockedShot)
if(isset($gb_item)){
$sql = "INSERT INTO parties_subevents (id_partie_event, id_equipe, id_partie_joueur, code_subevent, param1) VALUES($id_event, $receivingTeam, $gb_item[id_partie_joueur], 4, $dang)";
mysql_query($sql, $mysql);
}
}
?>
|