-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.php
More file actions
37 lines (26 loc) · 866 Bytes
/
Copy pathprocess.php
File metadata and controls
37 lines (26 loc) · 866 Bytes
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
<?php
require("common.php");
if ( !isset($_SESSION['username']) || !isset($_SESSION['password']) ){
header("Location: index.php");
}
if ( is_uploaded_file($_FILES['uploadfile']['tmp_name']) ){
$filename = UPLOAD_DIR . $_FILES['uploadfile']['name'];
if ( move_uploaded_file($_FILES['uploadfile']['tmp_name'], $filename) ){
echo "<p>File uploaded.</p>";
$socket = init_socket();
if( $socket == false ){
die("Can't init connection.");
}
// dummy read to get rid of the 'banner'
read_socket($socket);
if( hgd_play($socket, $filename, $_SESSION['username'], $_SESSION['password']) ){
echo "Track queued. <a href=\"index.php\">Submit another one?</a>";
} else {
echo "There was a problem queueing the track, <a href=\"index.php\">Try again?</a>";
}
socket_close($socket);
} else {
die("Error uploading file.");
}
}
?>