I Need Mini File Host Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • metulj
    replied
    Originally posted by digvijaydadhich View Post
    Spam removed & spammer ''killed''
    you maybe use it, but it's not your script for sure !
    and *.rar archive is password protected !

    and here is the original MFH_v1.5 script !
    Attached Files
    Last edited by metulj; 20.06.11, 15:37.

    Leave a comment:


  • digvijaydadhich
    replied
    Originally posted by ankitjain View Post
    Hi @ll
    I need a mini file host script.Plz give me if somebody have

    Regards
    Ankit
    Spam removed & spammer ''killed''
    Last edited by metulj; 20.06.11, 15:35.

    Leave a comment:


  • ankitjain
    Guest replied
    Thank you all for replying my topic so fast.Yes i need a script where people can login and register and then upload stuff.Also this script should be able to show last uploads by members.I want to start a file hosting company.Plz dont post scripts which use MYSQL database bcoz i dont know abt it.
    I will be very thankfull.

    Leave a comment:


  • WhiteWarrior
    replied
    na, my winrar progamme aint working lol anyway why?

    Leave a comment:


  • XXX
    Guest replied
    couldnt u just zip that or sumn bra?

    Leave a comment:


  • WhiteWarrior
    replied
    try this... dont know if its what your looking for...


    <?php

    ########### REQUIRED EDITS ########################################
    $require_login = 0; // set it to 0, no login will be required
    // define below if $require_login is 1
    $user = "user";
    $pass = "pass";

    ########### OPTIONAL EDITS ########################################
    $numpage = 10; // number of files listed per page
    $MAX_FILE_SIZE = "15000"; // in bytes!!
    $date_format = "m.d.Y-H:i:s 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[&#39;DOCUMENT_ROOT&#39;].dirname($_SERVER[&#39;PHP_SELF&#39;]);
    // or you may define your own
    //$userpath = "/home/yourusername/www/tmp/upload/img";
    // upload files to where your index.php is
    $httppath = "http://".$_SERVER[&#39;HTTP_HOST&#39;].dirname($_SERVER[&#39;PHP_SELF&#39;]);
    // or you may define your own
    //$httppath = "http://yourdomain.com/tmp/upload/img";

    // if uploaded file is an image, require a certain image dimension?
    $dim_requirement = null;
    //$dim_requirement = array(100, 70); // this means width no bigger than 100 pixels,
    // height no bigger than 70 pixels
    $require_exact_dim = 0; // make it to 1 to require the exact dim above
    $require_file_type = null; // enter the require file type if necessary
    // i.e. $require_file_type = "images/gif";
    // require all uploaded files to be only gif files
    $filename_limit = 0; // set this to a number if you wish to limit the number of
    // characters in the file name the user uploads

    $ignore_files = array(
    &#39;index.php&#39;,
    &#39;header.php&#39;,
    &#39;footer.php&#39;,
    &#39;readme.txt&#39;,
    &#39;error_log&#39;, // feel free to add to the list
    );


















    ###################################### DO NOT EDIT ############################################

    header("Cache-Control: no-cache");
    // Emular register_globals on
    if (!ini_get(&#39;register_globals&#39;)) {
    $superglobales = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET);
    if (isset($_SESSION)) {
    array_unshift($superglobales, $_SESSION);
    }
    foreach ($superglobales as $superglobal) {
    extract($superglobal, EXTR_SKIP);
    }
    }
    if($require_login == 1) {
    if($do == "logout") {
    setcookie(&#39;dodoupload_user&#39;, "");
    setcookie(&#39;dodoupload_pass&#39;, "");
    header("Location: ".$_SERVER[&#39;PHP_SELF&#39;]);
    }
    // is cookie set correctly?
    if($_COOKIE[&#39;dodoupload_user&#39;] == $user && $_COOKIE[&#39;dodoupload_pass&#39;] == md5($pass)) {
    define("DODOUPLOADOK", 1);
    } else {
    if(empty($do)) {
    include_once("header.php");
    load_login_form();
    } else if($do == "login") {
    if($_POST[&#39;username&#39;] != $user || $_POST[&#39;password&#39;] != $pass) {
    include_once("header.php");
    print_error("Error", "Invalid username and/or password.");
    } else {
    setcookie(&#39;dodoupload_user&#39;, $user);
    setcookie(&#39;dodoupload_pass&#39;, md5($pass), time()+31536000);
    define("DODOUPLOADOK", 1);
    }
    }
    }
    } else {
    define("DODOUPLOADOK", 1);
    } // end






    include_once("header.php");
    // load main switch if constant pass is defined
    if(defined("DODOUPLOADOK")) {
    switch($action) {
    case "uploadmulti_upload":
    case "upload":
    $uploaded_files = handle_uploaded_files("userfile");
    if(empty($uploaded_files)) {
    print_error("Error", "You didn&#39;t upload any file(s).");
    } else {
    $error = uploadfiles_error_checking($uploaded_files, $userpath, $MAX_FILE_SIZE, $dim_requirement, $require_exact_dim, $filename_limit, $require_file_type);
    if($error !== true)
    print_error("Error", $error);
    else {
    $output = upload_files($uploaded_files, $userpath);
    print_error("Success", "Following file(s) have been uploaded.

    ".$output, "Back Home", $_SERVER[&#39;PHP_SELF&#39;]);
    display_upload_form();
    }

    }
    break;
    case "uploadmulti":
    if($number <= 0)
    $number = 5;
    upload_multi_form($number);
    break;
    case "edit":
    if($delete == null) {
    print_error("Error", "You have not selected any files to delete.", "Back Home", $_SERVER[&#39;PHP_SELF&#39;]);
    } else {
    if(!$confirm) {
    echo "<h1>Delete Confirmation</h1>
    ";
    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)?
    \n";
    echo "
    • \n";
      foreach($delete as $doll) {
      echo "
    • <a href=\"$doll\" target=\"_blank\">$doll</a>\n";
      echo "<input name=\"delete[]\" value=\"$doll\" type=\"hidden\" />\n";
      }
      echo "
    \n";
    echo "</div><input type=\"submit\" name=\"confirm\" value=\"Yes, I&#39;m sure!\" class=\"bottombutton\" />\n";
    echo "</form>";
    } else {
    getrid($delete);
    }
    }
    break;
    default:
    if(!in_array($sortby, array(&#39;name&#39;, &#39;size&#39;, &#39;time&#39;))) {
    $sortby = "name";
    }
    if(!in_array($way, array(&#39;ASC&#39;, &#39;DESC&#39;))) {
    $way = "ASC";
    }
    $all_files = file_reading($userpath);
    display_upload_form();
    echo "
    \n";
    echo "
    \n";

    if(!$thispage)
    $thispage = 1;

    // getting the number of total entries
    $totalentries = count($all_files);

    $total_pages = ceil($totalentries/$numpage);


    $page_string = "<div class=\"othertext\">[ ";
    $page_symbol = ($_SERVER[&#39;PHP_SELF&#39;] == $_SERVER[&#39;REQUEST_URI&#39;]) ? "?" : "&";
    $page_symbol2 = ($page_symbol == "?") ? "\?" : $page_symbol;

    $page_string .= $pagelink = page_links($thispage, $total_pages, $_SERVER[PHP_SELF]."?sortby=$sortby&way=$way&thispage=%d");
    $page_string .= " ]\n";

    if($thispage != "showall") {
    $page_string .= " [ <a href=\"$_SERVER[PHP_SELF]?sortby=$sortby&way=$way&thispage=showall\">Show All</a> ]";
    } else {
    $page_string .= " [ Show All ]";
    }
    $page_string .= "</div>";
    ############ displaying #####################


    if($total_pages > 1) echo $page_string."
    ";
    displaypages($thispage, $numpage, $all_files);
    if($total_pages > 1) echo "
    ".$page_string;

    break;
    } // end of switch
    }
    dodo_rules();
    include("footer.php");

    function file_reading($userpath) {
    global $ignore_files, $sortby, $way;
    $handle = opendir($userpath);

    // This while loop is used to sort the array
    while ($file = readdir($handle))
    {
    if($file != &#39;.&#39; && $file != &#39;..&#39; && $file != $_SERVER[&#39;PHP_SELF&#39;] && (is_array($ignore_files) && !in_array($file, $ignore_files)) && !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);
    return $dolls;
    }




    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 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.gif\" 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.gif\" 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.gif\" 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.gif\" 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.gif\" 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.gif\" 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 formtext\">$name_sort_text_link $name_sort_link</td>\n";
    echo "<td align=\"center\" width=\"20%\" class=\"tableheader formtext\">$size_sort_text_link $size_sort_link</td>\n";
    echo "<td align=\"center\" width=\"45%\" class=\"tableheader formtext\">$time_sort_text_link $time_sort_link</td>\n";
    echo "<td align=\"center\" width=\"5%\" class=\"tableheader\"><input type=checkbox value=\"CheckAll\" onClick=\"doCheckAll(&#39;ID1&#39;)\" 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>\n";
    mini_template($index, $textcolor, $bgcolor);
    mini_template("<a href=\"$httppath/$dolls[$entry]\" target=\"_blank\">$dolls[$entry]</a>", $textcolor, $bgcolor);
    mini_template($filesizek, $textcolor, $bgcolor);
    mini_template($last_updated, $textcolor, $bgcolor);
    mini_template("<input type=checkbox name=delete[$entry] value=\"".$dolls[$entry]."\">", $textcolor, $bgcolor);
    echo "</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>\n";
    mini_template($index, $textcolor, $bgcolor);
    mini_template("<a href=\"$httppath/$dolls[$entry]\" target=\"_blank\">$dolls[$entry]</a>", $textcolor, $bgcolor);
    mini_template($filesizek, $textcolor, $bgcolor);
    mini_template($last_updated, $textcolor, $bgcolor);
    mini_template("<input type=checkbox name=delete[$entry] value=\"".$dolls[$entry]."\">", $textcolor, $bgcolor);
    echo "</tr>\n";

    }
    } // end of else if it&#39;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 mini_template($text, $textcolor, $bgcolor) {
    echo "<td align=\"center\" bgcolor=\"$bgcolor\" class=\"othertext\" style=\"color: $textcolor\">$text</td>\n";
    }



    function display_upload_form() {
    global $MAX_FILE_SIZE, $require_login;
    // display upload html

    echo "
    \n";
    echo "<table cellspacing=5 align=\"center\">\n";
    echo "<tr>\n";
    echo "<td>\n";
    if($require_login == 1)
    $logout = " -- <a href=\"".$_SERVER[&#39;PHP_SELF&#39;]."?do=logout\">Logout</a>";

    echo "<h1>Upload File: (Under ".$MAX_FILE_SIZE." Bytes) ".$logout."</h1>\n";
    echo "<form enctype=\"multipart/form-data\" action=\"".$_SERVER[&#39;PHP_SELF&#39;]."?action=upload\" method=\"post\">\n";
    echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"".$MAX_FILE_SIZE."\" />\n";
    echo "<input name=\"userfile[]\" TYPE=\"file\" class=\"input\" size=\"60\">
    \n";
    echo "<input type=\"submit\" VALUE=\"Send File\" class=\"bottombutton\"> <input name=\"overwrite_me[]\" value=\"1\" type=\"checkbox\"> Overwrite old file? <a href=\"".$_SERVER[&#39;PHP_SELF&#39;]."?action=uploadmulti\">Upload multiple files at once</a>\n";
    echo "</form>\n";
    echo "</td>\n";
    echo "</tr>\n";
    echo "</table>\n";


    } // end of function display_upload_form




    function upload_multi_form($number) {
    global $bgcolor_alt_array, $textcolor_alt_array, $MAX_FILE_SIZE;
    echo "<form ENCTYPE=\"multipart/form-data\" action=\"".$_SERVER[&#39;PHP_SELF&#39;]."?action=uploadmulti_upload\" method=\"post\">
    \n";
    echo "

    Upload $number files. All files should be under $MAX_FILE_SIZE bytes.
    \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(&#39;ID1&#39;)\" id=\"CID1\" name=\"CID1\"></td>\n";
    echo "<td class=\"tableheader\">Upload <input id=\"n\" name=\"number\" value=\"".$number."\" size=\"2\" maxlength=\"2\"> files \n";
    echo "<a href=\"#\" onclick=\"window.location=&#39;".$_SERVER[&#39;PHP_SELF&#39;]."?action=uploadmulti&number=&#39;+document.getEle mentById(&#39;n&#39;).value\">go!</a>\n";
    //echo "<a href=\"#\" onclick=\"window.location=&#39;index.php&#39;\">go !</a>\n";
    echo "</td>\n";
    echo "</tr>\n";
    for($i = 1; $i <= $number; $i++) {

    $j = str_pad($i, 2, "0", STR_PAD_LEFT);
    $l = $i - 1;


    $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[".$l."]\" value=\"1\"></td>\n";
    echo "<td class=\"othertext\" bgcolor=\"".$bgcolor."\" style=\"color: ".$textcolor.";\">File #".$j.": <input type=\"file\" name=\"userfile[".$l."]\" class=\"input\" size=\"48\" /></td>\n";
    echo "</tr>\n";
    }
    echo "</table>\n";

    echo "<p align=\"center\"><INPUT TYPE=\"submit\" VALUE=\"Send Files\" class=\"bottombutton\"></p></form>\n";
    }



    function figure_new_name($file_name, $abspath) {
    $name = explode(".", $file_name);

    if(is_file($abspath."/".$file_name)) {
    $i = 1;
    while(is_file($abspath."/".$name[0].$i.".".$name[1])) {
    $i++;
    }
    return $name[0].$i.".".$name[1];
    }
    return $file_name;
    }



    /* actually upload files */
    /* move one or more $tmp_name to real_name */
    function upload_files($uploaded_files, $abspath) {
    global $httppath;
    $output = "";
    for($i = 0; $i < count($uploaded_files[name]); $i++) {
    $file_name = $uploaded_files[name][$i];
    $file_overwrite = $uploaded_files[overwrite_me][$i];
    $file_tmp_name = $uploaded_files[tmp_name][$i];
    if($file_overwrite != 1)
    $file_name = figure_new_name($file_name, $abspath);
    move_uploaded_file ($file_tmp_name, $abspath."/".$file_name);
    $output .= "<a href=\"".$httppath."/".$file_name."\" target=\"_blank\">".$httppath."/".$file_name."</a>
    \n";
    }
    return $output;
    }




    function handle_uploaded_files($array_name) {
    global $$array_name, $_FILES;
    $newpoop = null;
    $index = 0;
    $total = count($_FILES[$array_name][name]);

    for($i = 0; $i < $total; $i++) {
    if(isset($_FILES[$array_name][error][$i]) && $_FILES[$array_name][error][$i] != 4) {
    $newpoop[name][$index] = $_FILES[$array_name][name][$i];
    $newpoop[error][$index] = $_FILES[$array_name][error][$i];
    $newpoop[size][$index] = $_FILES[$array_name][size][$i];
    $newpoop[type][$index] = $_FILES[$array_name][type][$i];
    $newpoop[tmp_name][$index] = $_FILES[$array_name][tmp_name][$i];
    $newpoop[overwrite_me][$index] = $_POST[&#39;overwrite_me&#39;][$i];
    $index++;
    }
    }

    return $newpoop;
    }


    function is_type($file_type, $require_file_type) {
    return strtolower($file_type) == strtolower($require_file_type);
    }


    /* array of the files uploaded and the name of the array */
    /* $size_requirement takes array of width and height and will check on images */
    function uploadfiles_error_checking($uploaded_files, $abs_path = null, $MAX_FILE_SIZE = 1048576, $size_requirement=null, $exact=0, $filename_limit = 0, $require_file_type=null) {
    for($i = 0; $i < count($uploaded_files[name]); $i++) {
    $file_error = $uploaded_files[error][$i];
    $file_size = $uploaded_files[size][$i];
    $file_name = "".$uploaded_files[name][$i]."";
    $file_type = $uploaded_files[type][$i];
    $file_tmp_name = $uploaded_files[tmp_name][$i];

    if($file_error == 1) {
    $error = "The uploaded file ".$file_name." exceeds the upload_max_filesize directive in php.ini.";
    } elseif($file_size > $MAX_FILE_SIZE || (isset($file_error) && $file_size == 0)) {
    $error = "The file ".$file_name." you are uploading is bigger than the maximum size allowed: ".$MAX_FILE_SIZE." bytes.";
    } elseif($file_error == 3) {
    $error = "The uploaded file ".$file_name." was only partially uploaded.";
    } elseif($filename_limit != 0 && strlen($file_name) > $filename_limit) {
    $error = $file_name." is longer than ".$filename_limit." characters. Please reduce the length of your file name!";
    } elseif(is_image($file_type) && isset($size_requirement) && size_pass($file_tmp_name, $size_requirement, $exact) === false) {
    $error = $file_name." does not have the correct dimension. It must ";
    $error .= ($exact == 1) ? "be exactly" : "not exceed";
    $error .= " ".$size_requirement[0]." x ".$size_requirement[1]." pixels.";
    } elseif($require_file_type == 1 && is_type($file_type, $require_file_type) === false) {
    $error = $file_name." must be in ".$require_file_type." format!";
    }
    }

    return (isset($error)) ? $error : true;
    }


    function is_image($filetype) {
    return (strstr($filetype, "image/"));
    }

    /* check size of the uploaded file if there is dimension requirement */
    function size_pass($file_tmp_name, $size_requirement, $exact=0) {
    $size = getimagesize($file_tmp_name);
    if($exact == 0) {
    return ($size[0] <= $size_requirement[0] && $size[1] <= $size_requirement[1]);
    } else {
    return ($size[0] == $size_requirement[0] && $size[1] == $size_requirement[1]);
    }
    }


    function getrid($delete) {
    global $userpath;
    if($delete != null) {
    $arrayindex = array_keys($delete);
    $index = 0;
    while($index < count($delete)) {
    $result = unlink($userpath."/".$delete[$arrayindex[$index]]);
    $result = 1;
    $index++;
    }
    if($result)
    print_error("List Updated", "File(s) have been deleted.", "Back Home", $_SERVER[&#39;PHP_SELF&#39;]);
    } else {
    print_error("Error", "Nothing to Delete.", "Back Home", $_SERVER[&#39;PHP_SELF&#39;]);
    }
    }




    function dodo_rules() {
    $version = "1.3";

    }


    function print_error($title, $message, $back_text="Back", $back_link="java script:history.back(1)") {
    $text = "<h1>$title</h1>\n
    <div class=\"othertext\">$message

    \n<a href=\"$back_link\">$back_text</a></div>";
    echo $text;
    }


    function load_login_form() {
    echo "<h1> </h1>\n";
    echo "<form action=\"".$_SERVER[&#39;PHP_SELF&#39;]."?do=login\" method=\"post\">\n";
    echo "
    \n";
    echo "Username:
    \n";
    echo "<input name=\"username\" size=\"20\">
    \n";
    echo "Password:
    \n";
    echo "<input name=\"password\" type=\"password\" size=\"20\">
    \n";
    echo "
    \n";
    echo "<input type=\"submit\" value=\"Login\" class=\"bottombutton\">\n";
    echo "</form>\n";
    }


    function page_links($current, $total, $format) {
    if($total == 1)
    return;

    if(empty($current) || $current == "showall") {
    $current = 1;
    }

    $buffer = 2;
    $out = "";
    $out .= "Page ".$current." of ".$total."\n";

    if($current > 1) {
    $out .= "<a href=\"" . sprintf($format, 1) . "\" title=\"View First Page\">&laquo;</a>\n";
    $out .= "<a href=\"" . sprintf($format, $current-1) . "\" title=\"Previous Page\">&lt;</a>\n";
    for($i = ($current - $buffer); $i < $current; $i++) {
    if($i < 1) {
    continue;
    }
    $out .= "<a href=\"" . sprintf($format, $i) . "\" title=\"Page ".$i."\">".$i."</a>\n";
    }
    }

    $out .= "<a href=\"" . sprintf($format, $current) . "\" title=\"Current Page\" id=\"current\">".$current."</a>\n";

    if($current < $total) {
    for($i = ($current + 1); $i <= ($current + $buffer); $i++) {
    if($i > $total) {
    break;
    }
    $out .= "<a href=\"" . sprintf($format, $i) . "\" title=\"Page ".$i."\">".$i."</a>\n";
    }
    $out .= "<a href=\"" . sprintf($format, $current+1) . "\" title=\"Next Page\">&gt;</a>\n";
    $out .= "<a href=\"" . sprintf($format, $total) . "\" title=\"View Last Page\">&raquo;</a>\n";
    }

    return $out;

    }



    ?>

    Leave a comment:


  • Lordx
    replied
    Explain mate for what you need and what you need..

    Leave a comment:


  • Guest
    Guest replied
    he means like a fileshare script,with login/reg where u upload and store files

    Leave a comment:


  • WhiteWarrior
    replied
    what you mean a "mini file host script" ??... something to upload stuff to like a uploader?

    Leave a comment:


  • ankitjain
    Guest started a topic I Need Mini File Host Script

    I Need Mini File Host Script

    Hi @ll
    I need a mini file host script.Plz give me if somebody have

    Regards
    Ankit
Working...
X