|
get one hit for one ip address
|
|
|
function ip_exists($ip){
|
|
|
global $mycon;
|
|
|
$query = "SELECT `ip` FROM `hits_ipaddress`";
|
select ip row from table
|
|
if($query_run = mysqli_query($mycon, $query)){
|
run this query on that database
|
|
$num_rows = mysqli_num_rows($query_run);
|
count the numbe rof rows in that executiion
|
|
//num_rows gives bow many rows or whats the row
|
|
|
if($num_rows == 0){
|
if there is no rows,w rite as false
|
|
return false;
|
|
|
} else {
|
if there is more than one row, it have to checek the present ip
address is match r not , if not match write this address
|
|
while($row = mysqli_fetch_array($query_run) ) {
|
while executes , it will get arrays, it will executes all
content in that array, go to every thing checks the below condition
|
|
$e_ip = $row['ip'];
|
we convert to arrrays, fetch that pointed array data or row,
assigns to $e_ip
|
|
if ($ip == $e_ip){
|
we got one ip , that ip and user ip is correct returs true
|
|
return true;}
|
false *true *true -- true it will add each boolean to next
|
|
|
same Ip address, hit and ip is not incrimented
|
|
}
|
if it is different ip addres returns false
|
|
}
|
while executes , it will get arrays, it will executes all
content in that array, go to every thing checks the below condition
|
|
}}
|
|
|
|
|
|
if (!ip_exists($user_ip))
|
function executes false, but because of oppsite sigm it becomes
true
|
|
{
|
wheenever it will execute when false is comes , false
oppsite true, so executs
|
|
update_count();
|
|
|
add_ip($user_ip);
|
it it equal , it never executs, if it is not equal it update
|
|
|
|
|
}
|
|
|
global
|
|
|
how to write
|
SELECT FROM
|
|
hwo to run query against database
|
mysqli_query
|
|
how to get number of rows
|
mysqli_num_rows
|
|
how to convert to row to array
|
mysqli_fetch_array(
|
|
$row[
|
|
Tuesday, 9 June 2020
get one hit for one ip address
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment