How To Store Visitors Detail Using Php And Mysql-
Demo-store visitor Details in Mysql
Hello Friends Ajj Me Apko Btaunga Ki Php And Mysql Ka Use Karke User Ki Detail Ko Apne Database Me Kesee Store Kare.Is Code Ka Use Karke Ham Sare Detail Like Ip Address,Page (Ki User Dwara Kon Sa Page Access Kiya Gya Hai) User Access Time ,User Browser Detail Ham Database Me Store Kar Sakte Hai Jo Future Me Hmare Kam A Sakte Hai.
Create a file index.php
Index.php
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("F j, Y, g:i a");
$user = $_SERVER['HTTP_USER_AGENT'];
$page = "http://".$_SERVER['HTTP_HOST']."".$_SERVER['PHP_SELF'];
?>
<h1> Store user detail using Php and Mysql</h1>
ipaddress: <?php echo "$ip"; ?>
<?php echo "<br>";?>
pageurl: <?php echo "$page";echo "<br>";?>
date: <?php echo "$date";echo "<br>";?>
browserdetail: <?php echo "$user";
$con=mysqli_connect("localhost","root","","userdata");//enter your databse name here
mysqli_query($con,"insert into tablename (ip,page,Browser,Currenttime) values('$ip','$page','$date','$user')");
?>
Ab Aap Mysql Database Me Kisi Be Name Se Databse Bana Lijiye Or Wanha Ek Table Bnaiye Janha 5 Fileds Create Kar Lijiye,Id,Ip,Page,Browser,Currenttime) Ab Aap Yanha Code Me Connection Me Apne Databse And Table Ka Name Enter Karke Code Save Kar Dijiye Ab Jab Be App Code Ko Execute Karogge To Apke Pass Browser Me User Ki Detail Show Hogi Or Sath He User Ke Details Hmare Databse Me B Store Ho Jayegi
Apni website Me Kisi Be user Ka ip Address block kese kare-
sabse pehle aap mysql database me block_list name ka ek table bana lijiye wanha wo sare ip address add/insert kar lijiye jinhe aap block karna chahte holinkkkkkkkkkkkkk
<?php
$con=mysqli_connect("localhost","root","","verification");
$ip=$_SERVER['REMOTE_ADDR'];
$result = mysqli_query($con, "select * from block_list where ip = '".$ip."' ");
if(mysqli_num_rows($result)>0)
{
echo "Your ip is block by admin u can not access this website";
}else{
echo "welcome";//enter your website data here
}
?>
Me Ummid Karta Hu Ki Apko Ye Post Acchi Lagi Hogi.
Thank You
Team Gajabwap Web In Hindi
ConversionConversion EmoticonEmoticon