-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsave_formation_startindex.php
More file actions
57 lines (46 loc) · 1.57 KB
/
save_formation_startindex.php
File metadata and controls
57 lines (46 loc) · 1.57 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
<?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"]) ? $_GET["formationid"] : "";
$currentindex = isset($_GET["currentindex"]) ? $_GET["currentindex"] : "";
$op = isset($_GET["op"]) ? $_GET["op"] : "";
echo "<!DOCTYPE html>\n";
echo "<html lang='en'>\n";
echo "<body>\n";
echo "FormationId: " . $formationid . "<br>";
echo "CurrentIndex: " . $currentindex . "<br>";
echo "Operation: " . $op . "<br>";
echo "Saving Formation start index...";
if (!empty($formationid)) {
$newindex = $currentindex;
if ($op == "up") {
$newindex++;
} else if ($op == "down") {
$newindex--;
}
$sql = "UPDATE asc_formation SET startindex='".$newindex."' WHERE formationid=".$formationid.";";
echo $sql;
if (mysqli_query($conn, $sql)) {
echo "<p style='font-family:Arial,sans-serif;font-size:14px;color:yellow;'>";
echo "Record (formation start index) updated successfully.";
echo "</p>";
mysqli_commit($conn);
echo "<script>\n";
echo " let currentURL = top.location.href;\n";
echo " let newURL = currentURL.replace('stv=1','stv=0');\n";
echo " top.location.replace(newURL);\n";
echo "</script>\n";
} else {
echo "<p style='font-family:Arial,sans-serif;font-size:14px;color:yellow;'>";
echo "Error (formation start index) updating record: " . mysqli_error($conn);
echo "</p>";
}
}
echo "</body>\n";
echo "</html>\n";
?>