Showing posts with the label MYSQL

What is MD5 ?

MD5 stands for 'Message Digest algorithm 5'. MD5 algorithm is used as a cryptographic hash function or a file fingerprint. Often used to encrypt password in databse, MD5 can also generate a fingerprint file to ensure that a file is the same after a transfer for example. A MD5 hash is composed of 32 hexadecimal characters. Enter a word in the MD5 encrypter form above to know the corresponding MD5 hash.

What is a MD5 hash? MD5 (Message Digest algorithm, 5th version) is an algorithm which converts a given sequence of characters into another unique sequence of characters, with a fixed length, called "hash". For instance, the MD5 hash of the word "admin" is "21232f297a57a5a743894a0e4a801fc3". These hashes are mostly used to validate file integrity, to encrypt sensitive data (like passwords), and to generate unique identifiers. Is it secure? MD5 hashes are theoretically impossible to reverse directly, ie, it is not possible to retrieve the original st…

How to connect to Database using PHP

How to connect to Database:

Here we will know about the database connectivity on PHP.

Firstly we have to check database credential of the server,

Usually They are as following:
For Local Server (i.e. XAMPP/ WAMPP etc.)
Server: localhost
Username: root
Password:   (blank)
For Server  (i.e. cpanel, window etc)
Server: localhost  or domain name of the website
Username: can be created by Hosting panel using Database wizard (Cpanel) or Option proided on the same
Password:  same as above

We have to create a database to connect with a particular database for a particular  website or Program.

Now we will define all on a variable:
$databaseserver = "localhost";   // can be changed as required
$databaseuser =  "dbadmin";   // as exapmle I have taken it dbadmin
$databasepassword = "W3help@123";  // as exapmle,  use password as strong, use Capital, small, Number and special Character. Probability of such password guessing is less
$databasename = "wehlpdatabase…

Visitor Count for Website in PHP

Here I am writing a small program in PHP for  checking how much user have visited our website using COOKIES, MYSQL and IP address of the user.
First we have to create cookies for the new user.

This the code we will use for that: (I have make a cookies for 30 days)

Secondly we have to create a table on database to store the number of Visitors.
I have created a table i.e. usercounter with following attribute:  (Initially Insert value with o and 1 on useripid )

useripid   (INT type - AUTO-INCREMENT)lastaddress   (VARCHAR    -   Last visitor IP)userqua   (INT)   (Counter for visitor)  (Initially 0)lastmodified   (TIMESTAMP)   (Last modified time for database) Now we have to check whether user are coming on website for first time or He has already visited. if(isset($_COOKIE['ipaddress'])) { // check is the same ip if($_COOKIE['ipaddress']==$_SERVER['REMOTE_ADDR']) {  // nothi…