Jump to content

Random string with .html at the end


Xanco

Recommended Posts

Hello peoples.

 

Right, this is what I'm trying to do; I'm trying to make a php script that generates a html file. I've almost got it. I just need to finish giving the html file a name. The name will be a random number, but I need it to have .html at the end (obviously). Anybody know how I can do that?

 

Here's what I tried (might give you some idea of what I'm doing):

 $file = rand()AND".html";
 $file = rand()+".html";
 $file = rand()".html";

 

 - Thanks, Xanco

Link to comment
https://forums.phpfreaks.com/topic/276580-random-string-with-html-at-the-end/
Share on other sites

I don't like rand because it can produce the same result. If I'm creating a "random" file name I'll usually use something like this:

 

$fileName = md5( time() . ' some crazy string just to keep the hackers on their toes ' );

echo $fileName . '.html';

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.