Get File MD5 Hash Using VB6

To get a file’s MD5 Hash using Visual Basic 6, download and add the following clsMD5 class to your VB project.

Download: clsMD5.zip

 

Add a command button (Command1), a text box (Text1) and use the following code:

Private Function GetFileMD5(ByVal FileName As String) As String
    Dim MD5 As New clsMD5, FF As Integer, Buff() As Byte
    Const BuffSize As Long = 2 ^ 16 ' (64 KBytes)

'    On Error GoTo ErrExit
    FF = FreeFile
    Open FileName For Binary Access Read As FF
        MD5.MD5Init

        Do Until Loc(FF) >= LOF(FF)
            If Loc(FF) + BuffSize > LOF(FF) Then
                ReDim Buff(LOF(FF) - Loc(FF) - 1)
            Else
                ReDim Buff(BuffSize - 1)
            End If

            Get FF, , Buff
            MD5.MD5Update UBound(Buff) + 1, Buff
        Loop

        MD5.MD5Final
        GetFileMD5 = MD5.GetValues
    Close FF

    Exit Function
ErrExit:
    Err.Clear
    GetFileMD5 = ""
End Function

Private Sub Command1_Click()
Text1.Text = GetFileMD5("c:\example.exe")
End Sub

Remove Link Underlines Using CSS

To remove underlining of hyperlinks you can use the following style code in the link’s A tag:

STYLE="text-decoration: none"

For example:

If you use

This is a link

you’ll get a link that looks like this ► This is a link

But if you use

This is a link

you’ll get a link that looks like this ► This is a link (No underlining)

Clear Browser Cache Using HTML or PHP

To clear the browser cached page or to force the browser to re-download the content of a page, you can place the following HTML code in the header tags (<head>) of the page. This code will ask the broswer to ignore any saved copies of the page, and to re-download page content.

HTML Code:





 

If you prefer working with PHP, you can do the exact same using this PHP code:

PHP Code:

header ("Expires: ".gmdate("D, d M Y H:i:s", time())." GMT");  
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");  
header ("Cache-Control: no-cache, must-revalidate");  
header ("Pragma: no-cache");

Open PHP as a Text File Using .htacess

Place this code in the .htaccess file to disable processing of PHP files in a folder. This will remove the PHP handlers in Apache forcing the browser to load the PHP file as a text file. You can use this to secure folders where upload is allowed to prevent executing uploaded PHP files.

RemoveHandler .php .phtml .php3
RemoveType .php .phtml .php3

Commenting HTML, CSS, PHP, Javascript, SQL & ASP

Use the tags below to enter comments or notes in your HTML, CSS, PHP, JavaScript or ASP code:


Language Single/Multi-Line Start with End with Example

HTML

Single & Multi-Line

<!–

–>

<!– This is an HTML Comment –>

PHP

Single Line

//

// This is a PHP Comment

PHP

Mutli-Line

/*

*/

/* This is

a PHP Comment */

JavaScript

Single Line

//

// This a JScript Comment

JavaScript

Mutli-Line

/*

*/

/* This is

a JavaScript Comment */

CSS

Single & Multi-Line

/*

*/

/*This is a CSS comment*/

ASP

Single & Multi-Line

‘ This is an ASP Comment

SQL

Single & Multi-Line

{

}

{ This is an SQL Comment }

SQL

Single

— (Two dashes)

— This is an SQL Comment

PHP: Country Name from IP Address

Here’s a PHP script that demonstrates an easy way to get a country name or code from IP address using pure PHP.

Included in the file:

GeoIP.dat: a binary databases of countries and IPs maintained by MaxMind.com. The database is updated monthly and has a 99.5% accuracy rate. You can always get the latest version here.

geoip.inc & sample.php: The PHP script.

Download: php-ip-to-country.zip ~ 627KB

Center Background Image Using CSS – One Line of Code

Here is a little snippet of CSS code that you can use to center a background image. The background image will be fixed in its center position even if you scroll up or down the page.

Place this CSS code in the HEAD section of your HTML code

 



 

Don’t forget to change background.jpg to the name of your background image file.

Download: Example Page example_center_background_css.zip