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
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';
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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