Files
PQS/getFSgame.php
CydandClaude Opus 4.8 061291c951 Add centralized DB helper; fix legacy mysql_error() landmines
- includes/db.php: shared mysqli connection + parameterized query helpers
  (pqs_db/pqs_exec/pqs_rows/pqs_row/pqs_val), targets PHP 7.4+.
- Replace 11 mysql_error() calls (undefined function on PHP 7+) with
  mysqli_error($link) / mysqli_connect_error() across getFSgame, getFSplayers,
  config, callsign, console. Only affected already-failed error paths.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 12:51:13 -05:00

66 lines
1.8 KiB
PHP

<?php
// vars
$missionid=0;
$numplayers = 0;
// db setup
$link = mysqli_connect('localhost', 'pqs', 'pqs') or die('Could not connect: ' . mysqli_error($link));
mysqli_select_db($link, 'pqs') or die('Could not select database');
// get current pods
$query = 'SELECT * FROM pqs_gameconfig';
$result = mysqli_query($link, $query) or die('Query failed 12: ' . mysqli_error($link));
$line = mysqli_fetch_array($result);
$visibility = $line[7];
$weather = $line[8];
$timeofday = $line[9];
$timelimit = $line[10];
$radar = $line[11];
$heat = $line[12];
$friendlyfire = $line[13];
$splashdamage = $line[14];
$limitedammo = $line[15];
$noreturn = $line[16];
$printdebriefing = $line[17];
$missionreview = $line[18];
$weaponjam = $line[19];
$advancemode = $line[20];
$armormode = $line[21];
$cameraship = $line[22];
// locate next mission in queue
$sql = "SELECT MIN(MissionID) FROM pqs_queue";
$getid = mysqli_query($link, $sql) or die('Query failed getqueue line 49: ' . mysqli_error($link));
$rs = mysqli_fetch_array($getid);
$missionid = $rs[0];
// lookup gametype map, other conditions. make changeable defaults on the console page and override-able by the mission by the reservations page?
$query = "SELECT * FROM pqs_mission WHERE MissionID = $missionid";
$result = mysqli_query($link, $query) or die('Query failed: 77' . mysqli_error($link));
$line = mysqli_fetch_array($result);
$gametype = $line[8];
$map = $line[9];
echo"$gametype\r\n";
echo"$map\r\n";
echo"$visibility\r\n";
echo"$weather\r\n";
echo"$timeofday\r\n";
echo"$timelimit\r\n";
echo"$radar\r\n";
echo"$heat\r\n";
echo"$friendlyfire\r\n";
echo"$splashdamage\r\n";
echo"$limitedammo\r\n";
echo"$noreturn\r\n";
echo"$printdebriefing\r\n";
echo"$missionreview\r\n";
echo"$weaponjam\r\n";
echo"$advancemode\r\n";
echo"$armormode\r\n";
echo"$cameraship\r\n";
mysqli_close($link);
?>