PHP Random Password Generator

Its very easy to make a random password generator in PHP.

$password = substr(md5(time()), 0, rand(4,8));

I got above code from Binyva's Blog

Four functions used here substr() md5() time() and rand()

If you wanna know about this functions please refer w3schools

Apache and Directory Listing

When you point your browser to a folder it should display the index.html or index.php file of that folder.

For example if you point your browser to http://mayuonline.com/test it should display the index.html file under the directory test.

I configured Apache to run on my local machine and I found that when I point my browser to a folder it lists the files in that folder, instead of pointing to index.php.

searched and found the solution for the problem.

  • Open your http.conf file in Notepad (which can be found in the folder where apache is installed)
  • Search for DirectoryIndex
  • You will find something like "DirectoryIndex index.html index.html.var"
  • Replace it with "DirectoryIndex index.html index.php index.html.var"
Now your browser will point to index.php files too

How to Turn Off MySQL Strict Mode

I'm helping my boss to set-up a Mambo CMS. When I was trying to insert a post, it was giving an error message. Later I found that I need to turn-off the strict mode of MySQL to avoid this error.

This can be done very easily. Run the following query

SET @@global.sql_mode= '';

Or else you can,

Open your "my.ini" file within the MySQL installation directory, and look for the text "sql-mode".
Find:

# Set the SQL mode to strict sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Replace with:

# Set the SQL mode to strict sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Reblog this post [with Zemanta]