PHP – How to Display REQUEST, POST, and SESSION Variables

Here is some quick and dirty PHP code to display all request variables available to a page. This is useful while debugging:

foreach($_REQUEST as $var=>$val)
{
   echo "$var=$val";
}

Replace _REQUEST with _POST or _SESSION and you can see those variables too.

Code

C# – How to Create an MD5 Hash

MD5 hashes are useful for when you need a string of characters that will always be generated given the same input. MD5 hashes are used to uniquely identify files based on their contents and they have also been used to store passwords in an “encrypted” format.

A word of caution on using MD5 hashing to store passwords in a database is that there exists searchable online databases of strings to MD5 hash mapping which allow someone to do a reverse lookup of what a password is by looking up the MD5 hash to plain text password mapping. So if you are relying solely on a straight MD5 hashing to store you password in a database you may want to consider doing something else such as applying a salt to the resultant hash string before you store it in the database.

Here is sample C# code to generate an MD5 hash from a string:

string password = "foo";
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] bs = System.Text.Encoding.UTF8.GetBytes(password);
bs = x.ComputeHash(bs);
System.Text.StringBuilder s = new System.Text.StringBuilder();
foreach (byte b in bs)
{
   s.Append(b.ToString("x2").ToLower());
}
password = s.ToString();

MD5 Algorithm

CentOS – How to Configure the Software Update Application to Use a Proxy Server

To get the Software Update application in CentOS to use a web proxy server, add the following line to the /etc/yum.conf file:

proxy=http://www.theProxyServer.com:port/

Replace “www.theProxyServer.com:port” with the URL and port number of the proxy service running on the proxy server. The “/” at the end is important so don’t forget to add it.

Ambit Cable Modem Web Interface

Time Warner Cable provides Ambit cable modems to their cable internet subscribers. You can get to the web-based interface by loading up the URL http://192.168.100.1 on a computer connected to your home network. If that doesn’t work, you may need to view that URL from a computer with the IP address 192.168.100.20. The default username/password for the web interface is: root/root

Ambit Cable Modem