This repository was 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
Expand file tree
/
Copy pathimport_submit_cart.php
More file actions
116 lines (88 loc) · 3.33 KB
/
Copy pathimport_submit_cart.php
File metadata and controls
116 lines (88 loc) · 3.33 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
$delete = FALSE; // default state - don't fuck up drs by deleting tracks
$time = microtime(true);
require_once("conn.php");
require_once("utils_ccl.php");
require_once("review_lib.php");
sanitizeInput();
//require_once("dbupdate/getid3/getid3/getid3.php");
define('BASE_DIR', "E:\\DRSAUDIO");
define('BASE_NEW', "E:\\ZAutoLib\\carts\\");
define('SCRIPT_PREFIX', "http://wsbf.net/wizbif/");
define('LABEL_DUMMY', 1899);
//sanitizeInput();
if(session_id() == "") session_start();
global $user;
if(!isset($user)) $user = "zachm";
else $user = $user->name;
echo "<h1>PRELIMINARY IMPORT SYSTEM</h1>\n";
echo "<h3>Import Submission/Confirmation</h3>\n";
echo "<p>Go <a href='".urldecode($_POST['redirect'])."'>back</a>...</p>\n";
echo "<div id='contents'>";
$cartName = trim($_POST['cartName']);
$cartType = $_POST['cartType'];
if(!isset($cartName) || $cartName == "" || $cartType == "")
die("Please fill out a cart name and cart type!");
$cartIssuer = trim($_POST['cartIssuer']);
$oldPath = $_POST['cartPath'];
$filename = $_POST['filename'];
//this is to say 01/03/1991 instead of 1/3/1991.
if($_POST['startDateMonth'] < 10)
$startDateMonth = "0".$_POST['startDateMonth'];
else
$startDateMonth = $_POST['startDateMonth'];
if($_POST['startDateDay'] < 10)
$startDateDay = "0".$_POST['startDateDay'];
else
$startDateDay = $_POST['startDateDay'];
if($_POST['endDateMonth'] < 10)
$endDateMonth = "0".$_POST['endDateMonth'];
else
$endDateMonth = $_POST['endDateMonth'];
if($_POST['endDateDay'] < 10)
$endDateDay = "0".$_POST['endDateDay'];
else
$endDateDay = $_POST['endDateDay'];
$startDate = $_POST['startDateYear'] ."-" .$startDateMonth ."-" .$startDateDay ." 00:00:00";
if(isset($_POST['noEndDate']))
$endDate = "0000-00-00 00:00:00";
else
$endDate = $_POST['endDateYear'] ."-" .$endDateMonth ."-" .$endDateDay ." 11:59:59";
if($_POST['startTime'] < 10)
$startTime = "0" . $_POST['startTime'] .":00:00";
else
$startTime = $_POST['startTime'] .":00:00";
if($_POST['endTime'] < 10)
$endTime = "0" .$_POST['endTime'] .":00:00";
else
$endTime = $_POST['endTime'] .":00:00";
if($delete)
echo "Delete mode is turned on.<br>";
else
echo "Delete mode is turned off - old files will be preserved.<br>";
echo "Moving files and updating track table...<br>";
$newPath = BASE_NEW . $filename;
if(!copy($oldPath, $newPath))
die("Could not copy: $oldPath to $newPath");
if($delete) {
if(!unlink($oldPath))
die("Could not delete: $oldPath");
}
else {
$rs = fopen(BASE_DIR ."import_todelete.txt", 'a');
fwrite($rs, $oldPath."\n");
fclose($rs);
}
$query = "INSERT INTO libcart (cartDateValid, cartDateInvalid, cartTitle, cartIssuer, cartType, cartFilename) VALUES('$startDate', '$endDate', '$cartName', '$cartIssuer', '$cartType', '$filename')";
$insert = mysql_query($query) or die(mysql_error());
$q = "SELECT * FROM libcart WHERE cartTitle = '$cartName'";
$thingy = mysql_query($q) or die(mysql_error());
$row = mysql_fetch_array($thingy, MYSQL_ASSOC);
$cartID = $row['cartID'];
addAction($user, 'libcart', $cartID, 'IMPORT', '');
echo "Complete: All operations finished! Successfully moved $oldPath to $newPath. <br>";
echo "</div>";
$netTime = microtime(true)-$time;
echo "<p>Time needed to execute: ".round($netTime,5)." seconds\n</p>";
// $cartFileName = $newpath . "\\" . $cartName . "." .$_POST['cartExt'];
?>