Jump to content

[PHP] Pastebin Script without using a DB

Lumi

So I was messing around the other day because I was bored and I felt like making an addition to my site.

 

also I know this isn't advanced by any means and I know there's a lot of things in it that could be better / proofed but it does work.

 

So I decided why not make and release a php pastebin without a DB.

 

How it works?

It just uses fwrite(); with regular "files".

 

script shit:

http://pastebin.com/Ye2zRJ0A

i want to die

Link to comment
Share on other sites

Link to post
Share on other sites

Why are you using mt_rand() and not a proper UUID. Even a timestamp would be better than mt_rand().

Link to comment
Share on other sites

Link to post
Share on other sites

Why are you using mt_rand() and not a proper UUID. Even a timestamp would be better than mt_rand().

I actually made a random string generator "rand.php" but I didn't include it in that paste, because I made the paste a couple days ago and felt like sharing it.

In rand.php it makes the string and checks the writes folder for an existing string.

i want to die

Link to comment
Share on other sites

Link to post
Share on other sites

I actually made a random string generator "rand.php" but I didn't include it in that paste, because I made the paste a couple days ago and felt like sharing it.

In rand.php it makes the string and checks the writes folder for an existing string.

But any randomness is silly. There is always a chance it will colide with an existing value, and just waste time creating a new value.

 

 http://www.php.net/manual/en/function.uniqid.php should be used instead.

Link to comment
Share on other sites

Link to post
Share on other sites

But any randomness is silly. There is always a chance it will colide with an existing value, and just waste time creating a new value.

 

 http://www.php.net/manual/en/function.uniqid.php should be used instead.

a random string generator that checks if it is already in use is what I use. There's no chance of colliding values. Thanks for the link to documentation on something I don't need to use though.

i want to die

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×