This repository has been archived by the owner on Feb 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bulk_move_submit.php
executable file
·79 lines (67 loc) · 1.72 KB
/
bulk_move_submit.php
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
require_once("connect.php");
include ("position_check.php");
if(!session_id()) session_start();
if(!(MD_check())){
die ('You aren\'t allowed to be here!<br>');
}
if(empty($_SESSION['username'])){
die('You need to login first!<br><a href="login.php">Click here to login!</a>');
}
if(!(isset($_POST["list"]))){
die ("You didn't type any albums");
}
else {
$list = $_POST["list"];
}
if(!(isset($_POST["new_bin"]))){
die ("You didn't select the desired bin, failed to move albums<br> $list");
}
else {
$new_bin = $_POST["new_bin"];
if($new_bin == 999){
die ("You didn't select the desired bin, failed to move albums<br> $list");
}
}
switch($new_bin){
case 0:
$bin_name = "To Be Reviewed";
break;
case 1:
$bin_name = "New";
break;
case 2:
$bin_name = "Heavy";
break;
case 3:
$bin_name = "Medium";
break;
case 4:
$bin_name = "Light";
break;
case 5:
$bin_name = "Optional";
break;
case 6:
$bin_name = "Jazz";
break;
case 7:
$bin_name = "To Be Reviewed";
break;
default:
die("What the Fuck did you do, Peter?");
break;
}
$album = explode(" ", $list);
foreach($album as $albums){
$album_code = preg_replace("/[^a-zA-Z0-9\s]/", "", $albums);
$query = sprintf("UPDATE libalbum SET rotationID='%d' WHERE album_code LIKE '%s'", mysql_real_escape_string($new_bin), mysql_real_escape_string($album_code));
if(mysql_query($query)){
echo "Successfully moved $album_code to $bin_name<br>";
}
else {
echo "<br>Failed to move $album_code to $bin_name:" . mysql_error() . "<br>";
}
}
echo "<br><a href=\"bulk_move.php\">Bulk Move More!</a> or go to <a href=\"rotation_control.php\">Rotation Control!</a>";
?>