Jump to content

Lanselot

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Lanselot's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yes, I could put it some other ways, it's just annoying that it doesn't work as should. Actually its purpose is to generate non-consecutive/non-pattern filenames as to make it hard to guess(not that anything bad happens if someone does). Again, just annoyed. Thank you
  2. Agree, but that's why I put that loop in there...
  3. Well, the above code is in a function, and right before it's called the following is executed: $rscimage = getimagesize($base.'images/'.$file); if ($rscimage[2] > 2) { //Delete if not GIF,JPG unlink($base.'images/'.$file); } $result = rand_rename($file,$rscimage); //That's the function above Also in the original code(not simplified for posting), there's an escaped variable among the filename, maybe it has something to do?. Scopes are ok too.
  4. I have a code that's supposed to work in the following way: Generate a random number, check if a file exists with that number as filename. If it exists, then sum one to the number until a filename with that number doesn't exist. $new_name = rand(0,99999); $ext = substr($origen,-4,4); //Retrieves file extension while (file_exists($base.'images/'.$new_name.$ext)) { $new_name++; } Plain simple... well, the problem is that every some thousands, I get duplicated filenames, which shouldn't be possible. Am I missing any scenario? Thank you in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.