-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsave_formation_data.php
More file actions
60 lines (48 loc) · 2.18 KB
/
save_formation_data.php
File metadata and controls
60 lines (48 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);
date_default_timezone_set('Europe/Berlin');
session_start();
require('./logger.php');
require_once('./db.php');
$formationid = isset($_GET["formationid"]) ? filter_var($_GET['formationid'], FILTER_VALIDATE_INT) : "";
$newformationname = isset($_GET["newformationname"]) ? $_GET["newformationname"] : "";
$newformationtype = isset($_GET["newformationtype"]) ? $_GET["newformationtype"] : "";
$newformation = isset($_GET["newformation"]) ? $_GET["newformation"] : "";
$formationshort = isset($_GET["formationshort"]) ? $_GET["formationshort"] : "";
$autobuild = isset($_GET["autobuild"]) ? $_GET["autobuild"] : "";
$factionid = isset($_GET["factionid"]) ? $_GET["factionid"] : "";
echo "<!DOCTYPE html>\n";
echo "<html lang='en'>\n";
echo "<body>\n";
echo "<p style='font-family:Arial,sans-serif;font-size:14px;color:yellow;'>\n";
echo "FormationId: ".$formationid."<br>";
echo "New formation name: ".$newformationname."<br>";
echo "New formation type: ".$newformationtype."<br>";
echo "New formation: ".$newformation."<br>";
echo "FormationShort: ".$formationshort."<br>";
echo "Autobuild name: ".$autobuild."<br>";
echo "FactionId: ".$factionid."<br>";
echo "Saving Formation info...";
if ($autobuild === "true") {
$formationlong = $newformationname." ".$newformationtype." ".$newformation;
} else {
$formationlong = $newformationname;
}
if (!empty($newformationname)) {
$sql = "UPDATE asc_formation SET formationname='".$newformationname."',formationtype='".$newformationtype."',formation='".$newformation."',formationshort='".$formationshort."',formationlong='".$formationlong."',autobuildname=".$autobuild.",factionid=".$factionid." WHERE formationid=".$formationid.";";
echo "<br><br>".$sql;
if (mysqli_query($conn, $sql)) {
echo "<br><br>Formation updated successfully.";
mysqli_commit($conn);
echo "<script>top.window.location = './gui_select_unit.php'</script>";
//die('ERROR 3');
} else {
echo "<br><br>ERROR while updating formation: " . mysqli_error($conn);
}
}
echo "</p>\n";
echo "</body>\n";
echo "</html>\n";
?>