Tuesday, 9 June 2020

how to chcek coming ip addrress is existed ip or new ip

how to chcek coming ip addrress is existed ip or new ip
function ip_exists($ip){
write a function to know the ip is exists or not
global $mycon;
$query = "SELECT `ip` FROM `hits_ipaddress`";
select the ip from database
if($query_run = mysqli_query($mycon, $query)){
execute query against database
$num_rows = mysqli_num_rows($query_run);
find the number of rows in this column
//num_rows gives bow many rows or whats the row
if($num_rows == 0){
if the number of rows is zero
// null or zero
hit increased and add ip address
update_count();
add_ip($ip);
//if number of rows is not equal to zero
} else {
if it is notw equalt o zero
while($row = mysqli_fetch_array($query_run) ) {
get the how many rows, till that rows execute this command
$e_ip = $row['ip'];
get the ipaddress of present
if ($ip != $e_ip){
customer ip and this ip is not equal
update_count();
upadate
add_ip($ip);}
}
it will check for each and every row data and gives if it is true , it prints, second llopp, if it is true it wll prints, measn same ip it will print so many times
}
}}
global
how to write 
SELECT FROM
hwo to run query against database
mysqli_query
how to get number of rows
 mysqli_num_rows(
execute if it is new, write this,if it is eqiual do this
if 
else while if 
how to convert to row to array
mysqli_fetch_array(



No comments:

Post a Comment