Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

How to Get Visitor Details Using PHP and MySQL

by
Category:php
php mysql
How to Get Visitor Details Using PHP and MySQL

In this tutorial we will show you how to get and display visitor details using PHP and MYSQL. We get details like visitor ip address, current visiting page, webpage visitor come from, time and date and what platform and browser. You may also like How to Block User From Visiting Website Using PHP and Multiple Image Upload in PHP.

PHP Code

<?php
    $ipaddress = $_SERVER['REMOTE_ADDR'];
    $page = "http://".$_SERVER['HTTP_HOST']."".$_SERVER['PHP_SELF'];

    $datetime = date("F j, Y, g:i a");
    $useragent = $_SERVER['HTTP_USER_AGENT'];

    echo "<p>IP Address : ".$ipaddress."</p>";
    echo "<p>Current Page : ".$page."</p>";
    echo "<p>Current Time : ".$datetime."</p>";
    echo "<p>Browser : ".$useragent."</p>";

    mysqli_query($con,"insert into slug (ip,page,Currenttime,Browser) values('$ipaddress','$page','$datetime','$useragent')");
 
?>

0 Comments


Html code work in comment box


Related Post