Archive for March 22nd, 2011
Generate a random password in PHP
Posted by MB in Uncategorized on March 22, 2011
Here’s a code snippet that will quickly generate a random password, using PHP. You can specify the characters set and the number of characters.
function generatePassword($length = 6, $chars = '23456789abcdefghijkmnpqrstuvwxyzABCDEFGHIJKMNPQRSTUVWXYZ') { $password = ''; $char_length = strlen($chars); for ($i = 0; $i < $length; $i++) { $num = rand() % $char_length; $password .= $chars[$num]; } return $password; }
Comments are welcome, as always. Have a faster way or a leaner function? Feel free to share!
Enabling and disabling the Administrator account in Windows 7
Posted by MB in Uncategorized on March 22, 2011
Windows 7, like Windows XP and Vista, has a built-in administrator account. This can be used for system recovery, resolving permissions issues, and logging in when a user’s profile is corrupt, among other things.
However, in Windows 7 the administrator account is disabled by default. This is actually a good thing, as XP had it enabled by default with no password — not very secure.
So how do you enable the administrator account?
Via command line:
At an administrator-level command prompt, enter the following command:
net user administrator /active:yes
This enables the administrator account. To disable it, simply do:
net user administrator /active:no
You can also set the administrator password by typing:
net user administrator __password__
substituting your desired password for __password__
.
That’s it.
Comments are welcome, as always.
Opening an Administrator-level command prompt in Windows Vista and 7
Posted by MB in Uncategorized on March 22, 2011
In order to open an Administrator-level command prompt in Vista and 7, do the following:
Click Start
In the Search Programs and Files box, type cmd
While holding ctrl and shift, press enter.
Windows UAC prompt may appear, depending on your settings. Click yes.
Comments are welcome, as always.