It looks like you're new here. If you want to get involved, click one of these buttons!
<?php
define('QUADODO_IN_SYSTEM', true);
require_once('header.php');
$username = $qls->user_info['username'];
?>
<?php
function generate_number_string($length) {
$real_number = '';
// List of numbers to include in the name
$numbers = array('1', '2', '3', '4', '5', '6', '7', '8', '9');
for ($x = 0; $x < $length; $x++) {
$real_number .= $numbers[array_rand($numbers)];
}
return $real_number;
}
$un = generate_number_string(9);
?>
<?php
if (!empty($_FILES)) {
if($_REQUEST['folder'] == \"/\") {
$path = \"/location/diffren/$username/rootfiles/$un\";
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $path . '/';
} else {
$path = \"/location/diffren/$username/rootfolders\";
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $path . $_REQUEST['folder'] . '/';
}
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
$filename = $_FILES['Filedata']['name'];
mkdir(\"/location/diffren/$username/rootfiles/$un\");
move_uploaded_file($tempFile,$targetFile);
echo \"1\";
// } else {
// echo 'Invalid file type.';
// }
}
?>
<script type=\"text/javascript\">
$(document).ready(function() {
$(\"#uploadify\").uploadify({
'uploader' : 'upload/example/scripts/uploadify.swf',
'script' : 'upload/example/scripts/uploadify.php',
'cancelImg' : 'upload/cancel.png',
folder :'/',
'queueID' : 'fileQueue',
'auto' : false,
'multi' : true
});
$(\"#company\").change(function () {
var path = $(this).val();
$(\"#uploadify\").uploadifySettings('folder', path);
});
});
</script>
Destination to Upload Files:
<select id=\"company\" name=\"company\">
<option value=\"/\">Home</option>
<option>Test</option>
<option>Test2</option>
<option>Tedfst</option>
<option>Tedfgsst</option>
<option>Tdfgsest</option>
</select>
$(\"#uploadify\").uploadify({
'uploader' : 'upload/example/scripts/uploadify.swf',
'script' : 'upload/example/scripts/uploadify.php',
'cancelImg' : 'upload/cancel.png',
folder :'/',
'queueID' : 'fileQueue',
'auto' : false,
'multi' : true,
'scriptData': {'session_name': '<?= session_id(); ?>'}
});
<?php
$username = session_id($_GET['session_name']);
session_start();
if ($_SESSION['mydata'] != $username) {
header(\"HTTP/1.0 404 Not Found\");
exit;
}
?>
<?php
if (!empty($_FILES)) {
if($_REQUEST['folder'] == \"/\") {
$path = \"/location/diffren/$username/rootfiles/$un\";
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $path . '/';
} else {
$path = \"/location/diffren/$username/rootfolders\";
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $path . $_REQUEST['folder'] . '/';
}
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
$filename = $_FILES['Filedata']['name'];
mkdir(\"/location/diffren/$username/rootfiles/$un\");
move_uploaded_file($tempFile,$targetFile);
?>
if ($_SESSION['mydata'] != 'whatever') {
header(\"HTTP/1.0 404 Not Found\");
exit;
}
<?php
session_start();
$_SESSION['mydata'] = session_id();
?>
<?php
session_start();
$_SESSION['mydata'] = $username;
?>
$(\"#uploadify\").uploadify({
'uploader' : 'upload/example/scripts/uploadify.swf',
'script' : 'upload/example/scripts/uploadify.php',
'cancelImg' : 'upload/cancel.png',
folder :'/',
'queueID' : 'fileQueue',
'auto' : false,
'multi' : true,
'scriptData': {'session_name': '<?= session_id(); ?>'}
});<?php
define('QUADODO_IN_SYSTEM', true);
require_once('header.php');
$username = $qls->user_info['username'];
session_start();
$_SESSION['mydata'] = $username;
?>
<?php
$username = session_id($_POST['session_name']);
session_start();
if ($_SESSION['mydata'] != $username) {
header(\"HTTP/1.0 404 Not Found\");
exit;
}
?>
$(\"#uploadify\").uploadify({
'uploader' : 'upload/example/scripts/uploadify.swf',
'script' : 'upload/example/scripts/uploadify.php',
'cancelImg' : 'upload/cancel.png',
folder :'/',
'queueID' : 'fileQueue',
'auto' : false,
'multi' : true,
'scriptData': {'session_name': '<?= session_id(); ?>', 'user_name': <?= $username ?>} // pass the username as script data.
});'scriptData': {'session_name': '<?= session_id(); ?>', 'user_name': <?= $username ?>} 'scriptData': {'session_name': '<?= session_id(); ?>', 'user_name': '<?= $username ?>'} $(\"#uploadify\").uploadify({
'uploader' : 'upload/example/scripts/uploadify.swf',
'script' : 'upload/example/scripts/uploadify.php',
'cancelImg' : 'upload/cancel.png',
folder :'/',
'queueID' : 'fileQueue',
'auto' : false,
'multi' : true,
'scriptData': {'session_name': '<?= session_id(); ?>', 'user_name': <?= $username ?>}
});<?php
define('QUADODO_IN_SYSTEM', true);
require_once('header.php');
$username = $qls->user_info['username'];
?>
<?php
session_start();
$_SESSION['mydata'] = md5(session_id());
?>
<?php
// The rest of the code for adding_files.php is just JavaScript, and the HTML to call out the Uploadify.
?>
$(\"#uploadify\").uploadify({
'uploader' : 'upload/example/scripts/uploadify.swf',
'script' : 'upload/example/scripts/uploadify.php',
'cancelImg' : 'upload/cancel.png',
folder :'/',
'queueID' : 'fileQueue',
'auto' : false,
'multi' : true,
'scriptData': {'session_name': '<?= session_id(); ?>', 'user_name': '<?= $username ?>'}
});<?php
function generate_number_string($length) {
$real_number = '';
// List of numbers to include in the name
$numbers = array('1', '2', '3', '4', '5', '6', '7', '8', '9');
for ($x = 0; $x < $length; $x++) {
$real_number .= $numbers[array_rand($numbers)];
}
return $real_number;
}
?>
<?php
// This portion of code is for security checking
$session = $_POST['session_name'];
session_id($session); // re-establish the session
session_start();
if ($_SESSION['mydata'] != md5($session)) { // Test to see if what is stored in the SESSION is valid. Make sure you change 'mydata' to what ever you set it to in the above php code
header(\"HTTP/1.0 404 Not Found\");
exit;
}
?>
<?php
$un = generate_number_string(9);
// Get the values passed via scriptData
$username = $_POST['user_name']; // You shouldn't need to test if $username exists because to get to the upload page, as I understand it the user has already logged on and is valid.
// I did not edit the remaining script, so it's not relevant to be shown.
?>
<?php
// This portion of code is for security checking
$session = $_POST['session_name'];
session_id($session); // re-establish the session
session_start();
if ($_SESSION['mydata'] != md5($session)) { // Test to see if what is stored in the SESSION is valid. Make sure you change 'mydata' to what ever you set it to in the above php code
header(\"HTTP/1.0 404 Not Found\");
exit;
}
?>
$(\"#uploadify\").uploadify({
'uploader' : 'uploadify/scripts/uploadify.swf',
'script' : 'my_upload_file.php',
...
'scriptData' : {
'id': '6',
'sid': '<?php print session_id(); ?>',
}
});<?php
// Very important to retrieve as early as possible all the REQUEST, GET, POST, FILES ... variables that you might need.
// If you do not do so, setting the session id later will (most of the time in my case) reset all the form variables.
$id = $_REQUEST[\"id\"]; //The session ID that you have set in JavaScript using PHP.
$tempFile = $_FILES[...]; //## ...
...
$foobar1 = $_GET[...];
$foobar2 = $_POST[...];
session_id($id);
// From this point on, your session will be restored.
// So anything that had being placed in the session using $_SESSION['foo'] = 'bar' will be accessible as usual