Simple Random Password Generator

11232_1127502322347_1670876517_265475_2130746_n

This is a simple script that will generate a random alphanumeric password with customizeable lenght.

[ad name=”In Post”]
Usage is as follows:

The example above will return a random password with 5 characters. If you want a random password with more characters replace the five with another number (the limit is 32, enforced by the md5() function). If you don’t set the password lenght, the function will return an 8 character password by default.

Set PHP Script Timeout

Clock Icon

Most of the times the PHP script timeout is set by default by your hosting company to 30 seconds. This means that after 30 seconds of running, your script is immediately killed, which means that all the actions are not completed successfully (if they take more than 30 seconds).

You may easily increase this limit though (or decrease it, e.g to stop abusive users from running abusive code through a possible PHP exploit). One of the ways is to set the time limit inside the php.ini file, if you have access to it.

Another way is to use the set_time_limit() directive at the beginning of your PHP script. The function accepts one parameter, which is the amount of seconds the script is allowed to run. Note that this directive will have no effect if your PHP’s safe_mode is turned on.

The usage is like this:

The above code will set the PHP timeout to 60 seconds. If you want to use larger values (e.g an hour), you can easily use a matematical formula like 60*60 for 60 minutes or 5*60 for five minutes and so on.

[ad name=”In Post (LU)”]

If you want to remove the timeout completely (your script will run forever until it’s manually killed through the task manager), you can use set_time_limit(0).