Fjen login i et upload script
Jeg har fundet et opload script som jeg kan kan li' men det bruger desværre login! Og jeg ønsker bare at man skal kunne gå ind og uploade uden at skulle logge ind!Er der nogen der kan fjerne login så det stadig virker?
Her er koden:
hvis I vil hente hele scriptet så er adr.
http://regretless.com/scripts/scripts.php#dodoupload
<?php
#####################################################################
# DODOUPLOAD VERSION 1.2 #
# Written in PHP #
# Released on March 03, 2005 under linkware #
# Created by Dodo http://pure-essence.net/ #
# Distributed through http://regretless.com/scripts/ #
# Please link either site if you use this script. #
# You may not redistribute this file without my written permission. #
# Feel free to modify this file to your need. #
# Please contact me http://pure-essence.net/domain/contact.php #
# if you wish to redistribute a modifed version of my script! #
# #
# ENJOY THE SCRIPT! #
#####################################################################
########### REQUIRED EDITS ########################################
$user = "user";
$pass = "pass";
########### OPTIONAL EDITS ########################################
$numpage = 8; // number of files listed per page
$MAX_FILE_SIZE = "150000"; // in bytes!!
$date_format = "m/d/Y g:i a"; // visit php.net/date for more info
$bgcolor_alt_array[] = "#0088BB"; // first table row bg color
$bgcolor_alt_array[] = "#0077BB"; // second table row bg color
// you can add more if you want
//$bgcolor_alt_array[] = ""; // third table row bg color
$textcolor_alt_array[] = "#FFFFFF"; // first table row text color
$textcolor_alt_array[] = "#FFFFFF"; // second table row text color
// you can add more if you want
//$textcolor_alt_array[] = ""; // third table row text color
// upload files to where your index.php is
$userpath = $_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF']);
// or you may define your own
$userpath = "upload/images";
// upload files to where your index.php is
$httppath = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
// or you may define your own
$httppath = "http://";
######################### END OF EDITING ######################################
## Apache server fix ##
foreach ($_POST as $key => $value) $$key = $value;
foreach ($_GET as $key => $value) $$key = $value;
foreach ($_SERVER as $key => $value) $$key = $value;
if ( ( !isset( $_SERVER[PHP_AUTH_USER] )) || (!isset($_SERVER[PHP_AUTH_PW]))
|| ( $_SERVER[PHP_AUTH_USER] != $user ) || ( $_SERVER[PHP_AUTH_PW] != $pass ) ) {
header( 'WWW-Authenticate: Basic realm="Private"' );
header( 'HTTP/1.0 401 Unauthorized' );
echo 'Authorization Required.';
exit;
} else {
include("header.php");
// this is for check all
?>
<script language="javascript">
ie = document.all?1:0
ns4 = document.layers?1:0
var SectionCheck = 1;
SectionArr = new Array();
function doGlobalCeckAll()
{
for (EBF=1;EBF<SectionCheck;EBF++)
{
var SectionID = "ID"+EBF;
doCheckCheckAll(SectionID);
}
}
function doCheckCheckAll(section)
{
var CBName = "C" + section;
if (ns4)
{
var WrkSec = document.SO;
var CheckCounter=0;
var Spos=0;
section = section.slice(2);
var IsChecked="";
for (SposI=1;SposI<section;SposI++)
{
Spos=Spos+SectionArr[SposI];
}
for (i=0;i<WrkSec.length;i++)
{
if (WrkSec.elements[i].name=="provider")
{
if ( (CheckCounter>=Spos) && (CheckCounter<Spos+SectionArr[section]) )
{
if (WrkSec.elements[i].checked==false)
IsChecked=1;
}
CheckCounter++;
}
}
if (IsChecked)
WrkSec.elements[CBName].checked=false;
else
WrkSec.elements[CBName].checked=true;
}
else
{
if (ie)
{
var WrkSec = document.all[section].all.tags("input");
var CBState = document.all[CBName];
}
else
{
var WrkSec = document.getElementById(section).getElementsByTagName("input");
var CBState = document.getElementById(CBName);
}
var IsChecked="";
for (i=1;i<WrkSec.length;i++)
{
if (WrkSec[i].checked==false)
IsChecked=1;
}
if (IsChecked)
CBState.checked=false;
else
CBState.checked=true;
}
}
function doCheckAll(section)
{
var CBName = "C" + section;
if (ns4)
{
var WrkSec = document.SO;
var CheckCounter=0;
var Spos=0;
section = section.slice(2);
for (SposI=1;SposI<section;SposI++)
{
Spos=Spos+SectionArr[SposI];
}
for (i=0;i<WrkSec.length;i++)
{
if (WrkSec.elements[i].name=="provider")
{
if ( (CheckCounter>=Spos) && (CheckCounter<Spos+SectionArr[section]) )
{
WrkSec.elements[i].checked=WrkSec.elements[CBName].checked;
}
CheckCounter++;
}
}
}
else
{
if (ie)
{
var WrkSec = document.all[section].all.tags("input");
var CBState = document.all[CBName].checked;
}
else
{
var WrkSec = document.getElementById(section).getElementsByTagName("input");
var CBState = document.getElementById(CBName).checked;
}
for (i=0;i<WrkSec.length;i++)
{
WrkSec[i].checked=CBState;
}
}
}
function icon(theicon) {
AddText(theicon);
}
</script>
<?
################## added decemeber 29, 2004 ##############################
function display_upload_form() {
global $MAX_FILE_SIZE, $_SERVER;
// display upload html
echo "<br /><table cellspacing=5 align=\"center\"><tr><td>\n
<h1>Upload File: (Under $MAX_FILE_SIZE Bytes)</h1>\n
<FORM ENCTYPE=\"multipart/form-data\" ACTION=\"$_SERVER[PHP_SELF]?action=upload\" METHOD=POST>\n
<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$MAX_FILE_SIZE\" />
<INPUT NAME=\"userfile\" TYPE=\"file\" class=\"input\" size=\"50\"><BR>\n
<INPUT TYPE=\"submit\" VALUE=\"Send File\" class=\"bottombutton\"> <span class=\"othertext\"><input name=\"overwrite_me\" value=\"yes\" type=\"checkbox\"> Overwrite old file? <a href=\"$_SERVER[PHP_SELF]?action=uploadmulti\">Upload multiple files at once</a></span>\n
</FORM>\n
</td></tr></table>\n";
} // end of function display_upload_form
function error_checking($file_name, $file_tmp_name, $file_error) {
global $MAX_FILE_SIZE, $userpath, $httppath;
if($file_error == 1) {
print_error("Error", "The uploaded file <b>$file_nam</b> exceeds the upload_max_filesize directive in php.ini.");
return false;
} elseif($file_error == 2) {
print_error("Error", "The file <b>$file_nam</b> you are uploading is bigger than the maximum size allowed: $MAX_FILE_SIZE bytes.");
return false;
} elseif($file_error == 3) {
print_error("Error", "The uploaded file <b>$file_nam</b> was only partially uploaded.");
return false;
} elseif($file_error == 3) {
print_error("Error", "No file <b>$file_nam</b> was uploaded.");
return false;
} else {
return true;
}
} // end of function error_checking
function upload_file($file_name, $file_tmp_name, $file_overwrite) {
global $MAX_FILE_SIZE, $userpath, $httppath;
if(is_file($userpath."/".$file_name) && !$file_overwrite) {
// figure out a new name
$file_name1 = figure_new_name($file_name);
} else {
$file_name1 = $file_name;
}
move_uploaded_file($file_tmp_name, $userpath."/".$file_name1) or die ("Could not copy");
$ans = "Your file <b>$file_name</b> is uploaded to <a href=\"$httppath/$file_name1\" target=\"_blank\">$httppath/$file_name1</a>";
return $ans;
} // end of function upload_file
################## end of added decemeber 29, 2004 #######################
if(!$action) {
if(!$sortby) {
$sortby = "name";
}
if(!$way) {
$way = "ASC";
}
################# FILE READING #######################################
// File handle variable to open current directory
$handle = opendir($userpath);
// This while loop is used to sort the array
while ($file = readdir($handle))
{
if($file != '.' && $file != '..' && $file != $_SERVER['PHP_SELF'] && $file != 'header.php' && $file != 'footer.php' && $file != 'readme.txt' && $file != 'index.php' && !is_dir($file))
{
$dolls[] = $file; // then add it to the array
$dolls_filesize[] = filesize($userpath."/".$file);
$dolls_updatetime[] = filemtime($userpath."/".$file);
}
}
if($dolls != null) {
$dolls = sort_correctly($dolls, $dolls_filesize, $dolls_updatetime);
}
closedir($handle);
################# END FILE READING #######################################
// display upload html
display_upload_form();
if(!$thispage)
$thispage = 1;
// getting the number of total entries
$totalentries = count($dolls);
// if the total entries is less than or equal the number per page
// then this is the only page
if($totalentries <= $numpage) {
$thispage = 1;
$totalpages = 1;
} else {
// otherwise find out total number of pages
$totalpages = $totalentries / $numpage;
/****************************************************************
if the total entries are a multiple of the number per page
then the total pages equal the integer division between the two
*****************************************************************/
if(($totalentries % $numpage) == 0)
$totalpages = $totalpages;
/****************************************************************
if the total entries are not a multiple of the number per page
then it's the the integer division between the two plus 1
****************************************************************/
else
$totalpages = $totalpages + 1;
}
if($totalpages != 1) {
$page_string = "<div class=\"othertext\">[ ";
for ($i = 1; $i <= $totalpages; $i++) {
$page_string .= "<a href=\"$_SERVER[PHP_SELF]?thispage=$i&sortby=$sortby&way=$way\">$i</a> ";
}
$page_string .= "] [ <a href=\"$_SERVER[PHP_SELF]?thispage=showall&sortby=$sortby&way=$way\">Show All</a> ]</div>";
}
############ displaying #####################
if($thispage == "showall") {
echo "<h1>Showing All Files</h1>".$page_string."<br />";
displaypages($thispage, $numpage, $dolls);
echo "<br />".$page_string."<h1>Showing All Files</h1>";
} elseif($totalpages == 1) {
echo "<h1> </h1>";
displaypages($thispage, $numpage, $dolls);
} else {
echo "<h1>Page $thispage</h1>".$page_string."<br />";
displaypages($thispage, $numpage, $dolls);
echo "<br />".$page_string."<h1>Page $thispage</h1>";
}
} // end of no ation
################## added decemeber 29, 2004 ##############################
if($action == "uploadmulti") {
$number = abs($number);
if(!$number) {
echo "<form action=\"$PHP_SELF?action=uploadmulti\" method=\"post\"><br />\n";
echo "<p>How many files would you like to upload?</p><input name=\"number\" size=\"3\" maxlength=\"3\" class=\"input\" /> <input type=\"submit\" value=\"Go!\" class=\"bottombutton\"></form>\n";
} else {
echo "<form ENCTYPE=\"multipart/form-data\" action=\"$PHP_SELF?action=uploadmulti_upload\" method=\"post\"><br />\n";
echo "<p>Upload $number files. All files should be under $MAX_FILE_SIZE bytes.<br />\n";
echo "Check the checkboxes to indicate that you wish to overwrite the old file(s).</p>\n";
echo "<table align=\"center\" width=\"500\" cellpadding=\"5\" cellspacing=\"1\" border=\"0\" class=\"table\" id=\"ID1\">\n";
echo "<tr>\n";
echo "<td class=\"tableheader\" width=\"1\" align=\"center\"><input type=checkbox value=\"CheckAll\" onClick=\"doCheckAll('ID1')\" id=\"CID1\" name=\"CID1\"></td>\n";
echo "<td class=\"tableheader\"><b>Uploads</b></td>\n";
echo "</tr>\n";
for($i = 1; $i <= $number; $i++) {
$j = str_pad($i, 3, "0", STR_PAD_LEFT);
$total_colors = count($bgcolor_alt_array);
// the bgcolor is figured out by the remainder of
// the row number divide by the total number of colors
$remainder = $i % $total_colors;
// whatever the value is
$bgcolor = $bgcolor_alt_array[$remainder];
$textcolor = $textcolor_alt_array[$remainder];
echo "<tr>\n";
echo "<td class=\"othertext\" bgcolor=\"".$bgcolor."\"><input type=\"checkbox\" name=\"overwrite_me[]\" value=\"yes\"></td>\n";
echo "<td class=\"othertext\" bgcolor=\"".$bgcolor."\"><span style=\"color: ".$textcolor.";\">File #".$j.": <input type=\"file\" name=\"userfile[]\" class=\"input\" size=\"48\" /></div></td>\n";
echo "</tr>\n";
}
echo "</table>\n";
echo "<p align=\"center\"><INPUT TYPE=\"submit\" VALUE=\"Send Files\" class=\"bottombutton\"></p></form>\n";
}
} // end of uploadmulti
if($action == "uploadmulti_upload") {
$ans = 1;
for($i = 0; $i < count($userfile); $i++) {
$file_name = $_FILES['userfile'][name][$i];
$file_error = $_FILES['userfile'][error][$i];
$file_tmp_name = $_FILES['userfile']['tmp_name'][$i];
$file_overwrite = $overwrite_me[$i];
// echo "<pre>";
// echo "file name $file_name; file error: $file_error; file temp name: $file_tmp_name;\n";
// echo "</pre>";
$ans = error_checking($file_name, $file_tmp_name, $file_error);
if(!$ans) {
break;
} else {
if(!empty($file_name)) {
$msg .= upload_file($file_name, $file_tmp_name, $file_overwrite);
$msg .= "<br />\n";
}
}
}
if(empty($msg)) {
print_error("Error", "No file selected.", "Back Home", $_SERVER['PHP_SELF']);
} else {
print_error("Success", $msg, "Back Home", $_SERVER['PHP_SELF']);
}
display_upload_form();
} // end of uploadmulti_upload
################## end of added decemeber 29, 2004 #######################
if($action == "upload") {
$file_name = $_FILES['userfile'][name];
$file_error = $_FILES['userfile'][error];
$file_tmp_name = $_FILES['userfile']['tmp_name'];
$file_overwrite = $overwrite_me;
if(empty($file_name)) {
print_error("Error", "No file selected.", "Back Home", $_SERVER['PHP_SELF']);
} else {
if(error_checking($file_name, $file_tmp_name, $file_error)) {
$msg = upload_file($file_name, $file_tmp_name, $file_overwrite);
print_error("Success", $msg, "Back Home", $_SERVER['PHP_SELF']);
display_upload_form();
}
}
} // end of upload
if($action == "edit") {
if($delete == null) {
print_error("Error", "You have not selected any files to delete.", "Back Home", $_SERVER['PHP_SELF']);
} else {
if(!$confirm) {
echo "<h1>Delete Confirmation</h1><br />";
echo "<form method=post action=\"$_SERVER[PHP_SELF]\">\n<input type=hidden name=action value=edit>\n";
echo "<div class=\"othertext\">Are you sure you want to delete the following file(s)?<br />\n";
echo "<ul>\n";
foreach($delete as $doll) {
echo "<li><a href=\"$doll\" target=\"_blank\">$doll</a></li>\n";
echo "<input name=\"delete[]\" value=\"$doll\" type=\"hidden\" />\n";
}
echo "</ul>\n";
echo "</div><input type=\"submit\" name=\"confirm\" value=\"Yes, I'm sure!\" class=\"bottombutton\" />\n";
echo "</form>";
} else {
getrid($delete);
}
}
} // end of edit
dodo_rules();
include("footer.php");
} // end of else
######################### functions #####################
function displaypages($thispage, $numpage, $dolls) {
global $bgcolor_alt_array, $textcolor_alt_array, $date_format, $sortby, $way, $userpath, $httppath;
$size_sort_text_link = "Size(kb)";
$time_sort_text_link = "Last updated";
$name_sort_text_link = "Files";
if($sortby == "name") {
if($way == "ASC") {
$name_sort_link = "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=$sortby&way=DESC\" title=\"Sort by Name Descendingly!\" ><img src=\"images/desc_order.png\" width=\"11\" height=\"10\" border=\"0\" alt=\"Sort by Name Descendingly!\" /></a>";
} else {
$name_sort_link = "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=$sortby&way=ASC\" title=\"Sort by Name Ascendingly!\" ><img src=\"images/asc_order.png\" width=\"11\" height=\"10\" border=\"0\" alt=\"Sort by Name Ascendingly!\" /></a>";
}
$size_sort_text_link = "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=size&way=ASC\" title=\"Sort by Size Ascendingly!\">Size(kb)</a>";
$time_sort_text_link = "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=time&way=ASC\" title=\"Sort by Last Update Time Ascendingly!\">Last updated</a>";
} elseif($sortby == "size") {
if($way == "ASC") {
$size_sort_link = "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=$sortby&way=DESC\" title=\"Sort by Size Descendingly!\" ><img src=\"images/desc_order.png\" width=\"11\" height=\"10\" border=\"0\" alt=\"Sort by Size Descendingly!\" /></a>";
} else {
$size_sort_link = "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=$sortby&way=ASC\" title=\"Sort by Size Ascendingly!\" ><img src=\"images/asc_order.png\" width=\"11\" height=\"10\" border=\"0\" alt=\"Sort by Size Ascendingly!\" /></a>";
}
$name_sort_text_link = "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=name&way=ASC\" title=\"Sort by Name Ascendingly!\">Files</a>";
$time_sort_text_link = "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=time&way=ASC\" title=\"Sort by Last Update Time Ascendingly!\">Last updated</a>";
} elseif($sortby == "time") {
if($way == "ASC") {
$time_sort_link = "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=$sortby&way=DESC\" title=\"Sort by Last Update Time Descendingly!\" ><img src=\"images/desc_order.png\" width=\"11\" height=\"10\" border=\"0\" alt=\"Sort by Last Update Time Descendingly!\" /></a>";
} else {
$time_sort_link = "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=$sortby&way=ASC\" title=\"Sort by Last Update Time Ascendingly!\" ><img src=\"images/asc_order.png\" width=\"11\" height=\"10\" border=\"0\" alt=\"Sort by Last Update Time Ascendingly!\" /></a>";
}
$name_sort_text_link = "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=name&way=ASC\" title=\"Sort by Name Ascendingly!\">Files</a>";
$size_sort_text_link = "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=size&way=ASC\" title=\"Sort by Size Ascendingly!\">Size(kb)</a>";
}
echo "<form method=post action=\"$_SERVER[PHP_SELF]\">\n<input type=hidden name=action value=edit>\n";
echo "<table width=\"500\" cellpadding=\"5\" cellspacing=\"1\" border=\"0\" align=\"center\" class=\"table\" id=\"ID1\">";
echo "<tr><td width=\"5%\" class=\"tableheader\"></td>\n";
echo "<td align=\"center\" width=\"25%\" class=\"tableheader\"><div class=\"formtext\">$name_sort_text_link $name_sort_link</div></td>\n";
echo "<td align=\"center\" width=\"20%\" class=\"tableheader\"><div class=\"formtext\">$size_sort_text_link $size_sort_link</div></td>\n";
echo "<td align=\"center\" width=\"45%\" class=\"tableheader\"><div class=\"formtext\">$time_sort_text_link $time_sort_link</div></td>\n";
echo "<td align=\"center\" width=\"5%\" class=\"tableheader\"><input type=checkbox value=\"CheckAll\" onClick=\"doCheckAll('ID1')\" id=\"CID1\" name=\"CID1\"></td></tr>\n";
if($thispage == "showall") {
for ($entry = 0; $entry < count($dolls); $entry++) {
// if the array element is empty, break out of the for loop
if($dolls[$entry] == "")
break;
$colornum++;
$total_colors = count($bgcolor_alt_array);
// the bgcolor is figured out by the remainder of
// the row number divide by the total number of colors
$remainder = $entry % $total_colors;
// whatever the value is
$bgcolor = $bgcolor_alt_array[$remainder];
$textcolor = $textcolor_alt_array[$remainder];
$index = $entry+1;
// Varible for file size
$filesize = filesize($userpath."/".$dolls[$entry])/1000;
$filesizek = number_format($filesize, 2);
// Variables for the time output
$last_updated1 = filemtime($userpath."/".$dolls[$entry]);
$last_updated = date($date_format,$last_updated1);
$dolls[$entry] = stripslashes($dolls[$entry]);
echo "<tr><td align=\"center\" bgcolor=$bgcolor><div class=\"othertext\" style=\"color: $textcolor\">$index</div></td>\n";
echo "<td align=\"center\" bgcolor=$bgcolor><div class=\"othertext\" style=\"color: $textcolor\">\n";
echo "<a href=\"$httppath/$dolls[$entry]\" target=\"_blank\"><span style=\"color: $textcolor\">$dolls[$entry]</span></a>\n";
echo "</td><td align=\"center\" bgcolor=$bgcolor>\n";
echo "<div class=\"othertext\" style=\"color: $textcolor\">$filesizek</div>\n";
echo "</td><td align=\"center\" bgcolor=$bgcolor>\n";
echo "<div class=\"othertext\" style=\"color: $textcolor\">$last_updated</div>\n";
echo "</td><td align=\"center\" bgcolor=$bgcolor>\n";
$dollvalue = $dolls[$entry];
echo "<input type=checkbox name=delete[$entry] value=\"$dollvalue\"></td></tr>\n";
}
} else {
for ($j = 0; $j < $numpage; $j++) {
$entry = ($thispage-1)*$numpage+$j;
// if the array element is empty, break out of the for loop
if($dolls[$entry] == "")
break;
$colornum++;
$total_colors = count($bgcolor_alt_array);
// the bgcolor is figured out by the remainder of
// the row number divide by the total number of colors
$remainder = $entry % $total_colors;
// whatever the value is
$bgcolor = $bgcolor_alt_array[$remainder];
$textcolor = $textcolor_alt_array[$remainder];
$index = $entry+1;
// Varible for file size
$filesize = filesize($userpath."/".$dolls[$entry])/1000;
$filesizek = number_format($filesize, 2);
// Variables for the time output
$last_updated1 = filemtime($userpath."/".$dolls[$entry]);
$last_updated = date($date_format,$last_updated1);
$dolls[$entry] = stripslashes($dolls[$entry]);
echo "<tr><td align=\"center\" bgcolor=$bgcolor><div class=\"othertext\" style=\"color: $textcolor\">$index</div></td>\n";
echo "<td align=\"center\" bgcolor=$bgcolor><div class=\"othertext\" style=\"color: $textcolor\">\n";
echo "<a href=\"$httppath/$dolls[$entry]\" target=\"_blank\"><span style=\"color: $textcolor\">$dolls[$entry]</span></a>\n";
echo "</td><td align=\"center\" bgcolor=$bgcolor>\n";
echo "<div class=\"othertext\" style=\"color: $textcolor\">$filesizek</div>\n";
echo "</td><td align=\"center\" bgcolor=$bgcolor>\n";
echo "<div class=\"othertext\" style=\"color: $textcolor\">$last_updated</div>\n";
echo "</td><td align=\"center\" bgcolor=$bgcolor>\n";
$dollvalue = $dolls[$entry];
echo "<input type=checkbox name=delete[$entry] value=\"$dollvalue\"></td></tr>\n";
}
} // end of else if it's not show all
echo "</table>\n";
echo "<table width=\"500\" cellpadding=\"5\" cellspacing=\"1\" border=\"0\" align=\"center\">";
echo "<tr><td align=\"center\"><input type=submit value=\"Delete Checked\" class=\"bottombutton\"></td></tr></table></form>";
} // end of the function
function print_error($title, $message, $back_text="Back", $back_link="java script:history.back(1)") {
$text = "<h1>$title</h1>\n<br /><div class=\"othertext\">$message<br /><br />\n<a href=\"$back_link\">$back_text</a></div>";
echo $text;
}
function figure_new_name($file_name) {
$name = explode(".", $file_name);
$i = 1;
while(is_file($name[0].$i.".".$name[1])) {
$i++;
}
return $name[0].$i.".".$name[1];
}
function getrid($delete) {
global $userpath;
if($delete != null) {
//print_r($delete);
$arrayindex = array_keys($delete);
$index = 0;
while($index < count($delete)) {
$result = unlink($userpath."/".$delete[$arrayindex[$index]]);
$index++;
}
if($result)
print_error("List Updated", "Files have been deleted.", "Back Home", $_SERVER['PHP_SELF']);
} else {
print_error("Error", "Nothing to Delete.", "Back Home", $_SERVER['PHP_SELF']);
}
}
function sort_correctly($dolls, $dolls_filesize, $dolls_updatetime) {
global $sortby, $way;
if($sortby == "name") {
if($way == "ASC") {
sort($dolls);
reset($dolls);
} else {
rsort($dolls);
reset($dolls);
}
} elseif($sortby == "size") {
if($way == "ASC") {
asort($dolls_filesize);
reset($dolls_filesize);
$right_keys = array_keys($dolls_filesize);
} else {
arsort($dolls_filesize);
reset($dolls_filesize);
$right_keys = array_keys($dolls_filesize);
}
} elseif($sortby == "update") {
if($way == "ASC") {
asort($dolls_updatetime);
reset($dolls_updatetime);
$right_keys = array_keys($dolls_updatetime);
} else {
arsort($dolls_updatetime);
reset($dolls_updatetime);
$right_keys = array_keys($dolls_updatetime);
}
}
if($right_keys != null) {
$new_dolls = array();
foreach($right_keys as $thekey) {
$new_dolls[] = $dolls[$thekey];
}
$dolls = array();
$dolls = $new_dolls;
}
return $dolls;
}
function dodo_rules() {
$version = "1.1";
echo "<br /><br /><center><div class=\"othertext\" style=\"font-size: 8.5pt\">DodoUpload Version $version.<br />Powered by <a href=\"http://regretless.com/scripts/\" target=\"_blank\">Dodo</a>, <a href=\"http://www.tabulas.com/~dodozhang21/gallery/album27396/\" target=\"_blank\">Bubo</a> & <a href=\"http://www.tabulas.com/~dodozhang21/gallery/album39075/\" target=\"_blank\">Misty</a>. <a href=\"https://www.paypal.com/xclick/business=luck@regretless.com&item_name=Feed%2BDodo%2Band%2BBubo&no_shipping=1&return=http%3A//regretless.com/scripts&cn=The%2Breason%2Bfor%2Byour%2Bdonation%2B%3A\" target=\"_blank\" title=\"Feed us!\">Feed us!</a></div></center>";
}
?>
