Create a password protect webpage

Login

Random Loading

You can load random stuff by using this code. For this example, I load random color code: $selectnumber = rand (1, 5); if($selectnumber==1) $pagebg=”#ffffff”; if($selectnumber==2) $pagebg=”#cccccc”; if($selectnumber==3) $pagebg=”#aaaaaa”; if($selectnumber==4) $pagebg=”#99cc33″; if($selectnumber==5) $pagebg=”#e7e7e7″;

Converting Between Timezones

PHP comes with an in-built function to display time in your required format, but what if you want to display date and time according to user’s timezone, that’s where PEAR package Date comes in. Let’s see how we can convert a date in GMT to IST.

Get Visitor IP Address

Put this code in some HTML page. When the user opens that page, the command echo will write its IP address to the page.