Some websites require access control, and sometimes you may need to generate a password for a user. Here’s a simple function that can do just that.
The $base-variable contains the characters allowed in the password. The supplied string may be changed, but the selected charaters should exist on all keyboards (as far as I know). When calling the function, you can specify the lenght of the password you want. Simple, right?
In the book “the Davinci Code” there was a fun little device called a cryptex.. A Cryptex has 6 dials with 6 letters on each, and only one combination producing a word will open it. The most straight forward way to crack it would be to try every combination one by one, but there’s a substantial number of combinations and we know only those which a valid words is a candidate.
There are some odd functions hidden in PHP. One of them is the decbin function, which makes it easy to convert between decimal and binary numbers.
If you’re bore don a rain day, you could use this function to make a simple binary clock, here’s a few lines to get you started: echo "Hours: ".decbin(date("H"))." "; echo " Minutes:".decbin(date("i"))." "; echo " Seconds:".decbin(date("s"));
See the binary clock output (and the source of the page).
A great strength in PHP is that it’s so accessible, that almost anyone can get access to a PHP site and often will download “applications” for their site such as discussion boards, photo galleries and others. While it may easy to download such applications, it often happens that the people trying to get things to work, doesn’t read the requirements section of the install.txt or readme.txt file, and thus never get the application running and doesn’t understand what the problem was and how to fix it.
While trying to respect the notion that URLs dont change, moving to a completely different engine for a website is bound to cause many URL changes. I’ve been trying to redirect old broken URLs to their new destination, and one of the tools was the 404 Notifier plugin for Wordpress.
The idea is that you configure it to send you a mail every time a 404 error occur. I did that and configured it to mail me at my GMail address (with endless storeage).