Better explanations I101
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
require "/home/hpr/php/include.php";
|
||||
|
||||
if ( $_SERVER['REQUEST_METHOD'] !== 'GET' ) {
|
||||
naughty("438a220a58dc34c200a8669547afc66b");
|
||||
naughty("438a220a58dc34c200a8669547afc66b REQUEST_METHOD not supported");
|
||||
}
|
||||
|
||||
$num_get_args=0;
|
||||
@@ -12,7 +12,7 @@ foreach($_GET as $k => $v) {
|
||||
if ( $num_get_args !== 2 ){
|
||||
$result = mysqli_query($connection, "SET time_zone = '+0:00';");
|
||||
if (!isset($result)) {
|
||||
naughty("cca6408ae1febc3f07974177b2d04375");
|
||||
naughty("cca6408ae1febc3f07974177b2d04375 DB Error");
|
||||
}
|
||||
|
||||
header("Content-type: text/csv");
|
||||
@@ -26,18 +26,18 @@ if ( $num_get_args !== 2 ){
|
||||
}
|
||||
}
|
||||
else {
|
||||
naughty("2dcabda45255713ea9bf04523e804016");
|
||||
naughty("2dcabda45255713ea9bf04523e804016 Query error");
|
||||
}
|
||||
mysqli_close($connection);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( empty($_GET["ep_num"]) or empty($_GET["status"]) ) {
|
||||
naughty("32bedea129648f27701f2f2f3ff4b7b5");
|
||||
naughty("32bedea129648f27701f2f2f3ff4b7b5 Empty ep_num or status");
|
||||
}
|
||||
|
||||
if ( !in_array($_GET["status"], array('METADATA_PROCESSED','SHOW_POSTED','MEDIA_TRANSCODED','UPLOADED_TO_IA','UPLOADED_TO_RSYNC_NET','REMOVE_RESERVATION'), true ) ) {
|
||||
naughty("88882bc97094e7aabf2a258756f917f5 ");
|
||||
naughty("88882bc97094e7aabf2a258756f917f5 Wrong enum status");
|
||||
}
|
||||
else {
|
||||
$status = $_GET["status"];
|
||||
@@ -47,7 +47,7 @@ if ( !empty($_GET["ep_num"]) and isset( $_GET["ep_num"] ) ) {
|
||||
$ep_num = intval( $_GET["ep_num"] );
|
||||
}
|
||||
else {
|
||||
naughty("ecb0ebc5b38b4c09226ccbfce05978cb");
|
||||
naughty("ecb0ebc5b38b4c09226ccbfce05978cb ep_num not correct");
|
||||
}
|
||||
|
||||
// // SELECT MAX(ep_num) FROM `reservations` → 3627
|
||||
@@ -55,7 +55,7 @@ else {
|
||||
//
|
||||
$result = mysqli_query($connection, 'SELECT MAX(ep_num) FROM `reservations`;');
|
||||
if (!isset($result)) {
|
||||
naughty("360e6381ffca736b6f12056abd7dcc7d");
|
||||
naughty("360e6381ffca736b6f12056abd7dcc7d Cant get max from db");
|
||||
}
|
||||
$max_eps_array = mysqli_fetch_row( $result );
|
||||
$max_eps = $max_eps_array[0];
|
||||
@@ -63,22 +63,22 @@ mysqli_free_result($result);
|
||||
|
||||
$result = mysqli_query($connection, 'SELECT MIN(ep_num) FROM `reservations` WHERE ep_num > 0;');
|
||||
if (!isset($result)) {
|
||||
naughty("6971b6d378292e8fc9583de6082eddf4");
|
||||
naughty("6971b6d378292e8fc9583de6082eddf4 Cant get min from db");
|
||||
}
|
||||
$min_eps_array = mysqli_fetch_row( $result );
|
||||
$min_eps = $min_eps_array[0];
|
||||
mysqli_free_result($result);
|
||||
|
||||
if ( empty( $ep_num ) ) {
|
||||
naughty("6cf46a9b21e667c61b2c5bf87a7104f9 $ep_num");
|
||||
naughty("6cf46a9b21e667c61b2c5bf87a7104f9 Empty ep_num");
|
||||
}
|
||||
|
||||
if ( $ep_num < $min_eps ) {
|
||||
naughty("bbcef7cd8a263dc57e85195935ad600a $ep_num < $min_eps");
|
||||
naughty("bbcef7cd8a263dc57e85195935ad600a Invalid $ep_num < $min_eps");
|
||||
}
|
||||
|
||||
if ( $ep_num > $max_eps ) {
|
||||
naughty("a75115f3fa706ceee4b61971cd22b8f9 $ep_num > $max_eps");
|
||||
naughty("a75115f3fa706ceee4b61971cd22b8f9 Invalid $ep_num > $max_eps");
|
||||
}
|
||||
|
||||
// SHOW_SUBMITTED → METADATA_PROCESSED → SHOW_POSTED → MEDIA_TRANSCODED → UPLOADED_TO_IA → UPLOADED_TO_RSYNC_NET
|
||||
@@ -113,19 +113,19 @@ switch ($status) {
|
||||
|
||||
$result = mysqli_query($connection, "SELECT ep_num FROM reservations WHERE `ep_num` = '$ep_num' AND status='$current_status';");
|
||||
if (!isset($result)) {
|
||||
naughty("7f2d7228ca355be6dd2a24769595b18f");
|
||||
naughty("7f2d7228ca355be6dd2a24769595b18f Cant get reservation");
|
||||
}
|
||||
$db_ep_num_array = mysqli_fetch_row( $result );
|
||||
$db_ep_num = $db_ep_num_array[0];
|
||||
mysqli_free_result($result);
|
||||
if ( $db_ep_num != $ep_num ){
|
||||
problem("da59731c6ae6d1ce0fa2fa9fc4e1e726 $db_ep_num != $ep_num");
|
||||
problem("da59731c6ae6d1ce0fa2fa9fc4e1e726 Error $db_ep_num != $ep_num");
|
||||
}
|
||||
|
||||
$query = "UPDATE reservations SET `status` = '$status' WHERE `ep_num` = '$ep_num' AND status='$current_status';";
|
||||
$result = mysqli_query($connection, $query );
|
||||
if(!isset($result)) {
|
||||
problem("8a76bb408877b1d33bf31ea96b6fc02f");
|
||||
problem("8a76bb408877b1d33bf31ea96b6fc02f Could not UPDATE Reservation");
|
||||
}
|
||||
if (mysqli_errno( $connection )) {
|
||||
$error = "MySQL error ".mysqli_errno( $connection).": ".mysqli_error($connection)."\n";
|
||||
|
||||
Reference in New Issue
Block a user