function mysave() { global $id, $er; global $auth, $site_path; global $tournamentId; $orderData = pack_data(); $ermess = checkorderBuilder($orderData); if ($ermess) { print "<script>alert('Ошибка сохранения ордера: " . $ermess . "')</script>"; $er = 1; return; } if ($id) { $file = fopen($site_path . "files/ord/" . $id . "-" . $auth->user . ".ord", "w"); fputs($file, $orderData); fclose($file); } else { $file = fopen($site_path . "files/preord/" . $auth->user . ".ord", "w"); fputs($file, $orderData); fclose($file); } }
function mysave() { global $id; global $auth; global $tournamentId; echo "test"; $orderData = pack_data(); $ermess = checkorderBuilder($tournamentId, $orderData); if ($ermess) { print "<script>alert('Ошибка сохранения ордера: " . $ermess . "')</script>"; return; } if ($id > 0) { $orderData = addslashes($orderData); $q = select("select TournamentID from ut_matches where MatchID='{$id}'"); $tournamentId = $q[0]; $ip = $_SERVER['REMOTE_ADDR']; mysql_query("delete from ut_orders where TeamID='{$auth->team}' and TournamentID='{$tournamentId}'"); mysql_query("insert into ut_orders(TeamID,Name,Date,IP,OrderFile,TournamentID,Tour) values(" . $auth->team . ",'" . $name . "',UNIX_TIMESTAMP(),'{$ip}','{$orderData}',{$tournamentId}," . "(1+ coalesce((\nselect Tour from ut_maxtour where TournamentID='{$tournamentId}' limit 0,1\n) ,0)))"); //mysql_query("update ut_matches set OrderTeam1='$orderData',DateOrder1=unix_timestamp() where MatchID='$id' and TeamID1='$auth->team'"); //mysql_query("update ut_matches set OrderTeam2='$orderData',DateOrder2=unix_timestamp() where MatchID='$id' and TeamID2='$auth->team'"); } else { if ($tournamentId > 0) { echo "TOUR"; mysql_query("delete from ut_orders where TeamID='{$auth->team}' and TournamentID='{$tournamentId}'"); mysql_query("insert into ut_orders(TeamID,Name,Date,IP,OrderFile,TournamentID,Tour) values(" . $auth->team . ",'" . $name . "',UNIX_TIMESTAMP(),'{$ip}','{$orderData}',{$tournamentId}," . "(1+ coalesce(\n(select Tour from ut_maxtour where TournamentID='{$tournamentId}' limit 0,1) ,0)))"); } else { $ip = $_SERVER['REMOTE_ADDR']; $name = $_POST["filename"]; $res = mysql_query("select OrderID from ut_orders where IP='" . $ip . "' and Name='" . $name . "'"); if ($data = mysql_fetch_row($res)) { $res = mysql_query("update ut_orders set TeamID=" . $auth->team . ",Name='{$name}',Date=UNIX_TIMESTAMP(),IP='{$ip}',OrderFile='{$orderData}' where OrderID = " . $data[0]); } else { $res = mysql_query("insert into ut_orders(TeamID,Name,Date,IP,OrderFile)values(" . $auth->team . ",'" . $name . "',UNIX_TIMESTAMP(),'{$ip}','{$orderData}')"); $res = mysql_query("select Name,OrderID from ut_orders where TeamID=" . $auth->team . " and Name='{$name}'"); $data = mysql_fetch_row($res); echo "<script>window.parent.appendNewFileName('{$data['0']}',{$data['1']});</script>"; } } } }