Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    pleas look at this, PLEAS !

    PHP Code:
    <?php


    include("./config.php");
    include(
    "./header.php");

    $filename $_FILES['upfile']['name'];
    $filesize $_FILES['upfile']['size'];
    $filecrc md5_file($_FILES['upfile']['tmp_name']);

    $bans=file("./bans.txt");
    foreach(
    $bans as $line)
    {
      if (
    $line==$filecrc."\n"){
        echo 
    "That file is not allowed to be uploaded.";
       
        die();
      }
      if (
    $line==$_SERVER['REMOTE_ADDR']."\n"){
        echo 
    "You are not allowed to upload files.";
       
        die();
      }
    }

    $checkfiles=file("./files.txt");
    foreach(
    $checkfiles as $line)
    {
      
    $thisline explode('|'$line);
      if (
    $thisline[0]==$filecrc){
        echo 
    "Pleas rename file and try again.";
       
        die();
      }
    }

    if(isset(
    $allowedtypes)){
    $allowed 0;
    foreach(
    $allowedtypes as $ext) {
      if(
    substr($filename, (- (strlen($ext)+1) )) == ".".$ext)
        
    $allowed 1;
    }
    if(
    $allowed==0) {
       echo 
    "That file type is not allowed to be uploaded.";
      
       die();
    }
    }

    if(isset(
    $categorylist)){
    $validcat 0;
    foreach(
    $categories as $cat) {
      if(
    $_POST['category']==$cat || $_POST['category'] = ""){ $validcat 1; }
    }
    if(
    $validcat==0) {
       echo 
    "Invalid category was chosen..";
      
       die();
    }
    $cat $_POST['category'];
    } else { 
    $cat ""; }

    if(
    $filesize==0) {
    echo 
    "You didn't pick a file to upload.";
    include(
    "./footer.php");
    die();
    }

    $filesize $filesize 1048576;

    if(
    $filesize $maxfilesize) {
    echo 
    "The file you uploaded is too large.";
    include(
    "./footer.php");
    die();
    }

    $userip $_SERVER['REMOTE_ADDR'];
    $time time();

    if(
    $filesize $nolimitsize) {

    $uploaders fopen("./uploaders.txt","r+");
    flock($uploaders,2);
    while (!
    feof($uploaders)) { 
    $user[] = chop(fgets($uploaders,65536));
    }
    fseek($uploaders,0,SEEK_SET);
    ftruncate($uploaders,0);
    foreach (
    $user as $line) {
    @list(
    $savedip,$savedtime) = explode("|",$line);
    if (
    $time $savedtime + ($uploadtimelimit*60)) {
      
    fputs($uploaders,"$savedip|$savedtime\n");
    }
    }
    fputs($uploaders,"$userip|$time\n");

    }

    $passkey rand(100000999999);

    if(
    $emailoption && isset($_POST['myemail']) && $_POST['myemail']!="") {
    $uploadmsg "Your file (".$filename.") was uploaded.\n Your download link is: "$scripturl "download.php?file=" $filecrc "\n Thank you for using our service!";
    mail($_POST['myemail'],"Your Uploaded File",$uploadmsg,"From: admin@yoursite.com\n");
    }

    if(
    $passwordoption && isset($_POST['pprotect'])) {
      
    $passwerd md5($_POST['pprotect']);
    } else { 
    $passwerd md5("");}

    if(
    $descriptionoption && isset($_POST['descr'])) {
      
    $description strip_tags($_POST['descr']);
    } else { 
    $description ""; }

    $filelist fopen("./files.txt","a+");
    fwrite($filelist$filecrc ."|"basename($_FILES['upfile']['name']) ."|"$passkey ."|"$userip ."|"$time."|0|".$description."|".$passwerd."|".$cat."|\n");

    $movefile "./storage/" $filecrc;
    move_uploaded_file($_FILES['upfile']['tmp_name'], $movefile);

    echo 
    "Your file was uploaded!<br />";
    echo 
    "Your download link is: <input style=\"width:240;\" type=\"text\" value=\"" $scripturl "download.php?file=" $filecrc "\">";
    include(
    "./footer.php");
    ?>
    & this is error, that i get

    Code:
    Fatal error: [] operator not supported for strings in C:\appache\www\upload\upload.php on line 86

  • #2
    Regular Coder
    Join Date
    Jun 2005
    Posts
    804
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Please read the posting guidelines and use more descriptive thread titles.

    Which is line 86?

  • #3
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    here:
    Code:
    $user[] = chop(fgets($uploaders,65536));

  • #4
    Regular Coder
    Join Date
    Jun 2005
    Posts
    804
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Somewhere before that line, $user is being set as a string variable. You should probably just use a different name for that array.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •