Xanco Posted April 5, 2013 Share Posted April 5, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/276580-random-string-with-html-at-the-end/ Share on other sites More sharing options...
exeTrix Posted April 5, 2013 Share Posted April 5, 2013 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'; Quote Link to comment https://forums.phpfreaks.com/topic/276580-random-string-with-html-at-the-end/#findComment-1423116 Share on other sites More sharing options...
requinix Posted April 5, 2013 Share Posted April 5, 2013 uniqid mt_rand Quote Link to comment https://forums.phpfreaks.com/topic/276580-random-string-with-html-at-the-end/#findComment-1423131 Share on other sites More sharing options...
Xanco Posted April 5, 2013 Author Share Posted April 5, 2013 Thanks everyone Quote Link to comment https://forums.phpfreaks.com/topic/276580-random-string-with-html-at-the-end/#findComment-1423136 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.