32 lines
884 B
PHP
32 lines
884 B
PHP
<?php
|
|
//Database Hit counter for php 5.0 doesnt work now, because of new version of php. myslql_result() doesnt exists...
|
|
|
|
require '/var/www/nikola/practice/exam110/connect.inc.php';
|
|
|
|
$user_ip = $_SERVER['REMOTE_ADDR'];
|
|
|
|
function ip_exists($ip)
|
|
{
|
|
global $user_ip; // Sa global omogucavamo da koristimo vrednost promenljive u funkciji
|
|
echo $user_ip;
|
|
}
|
|
|
|
function update_count()
|
|
{
|
|
global $con;
|
|
$query = "SELECT `count` FROM `hits_count` ";
|
|
if ($query_run = mysqli_query($con, $query)) {
|
|
if (mysqli_num_rows($query_run) > 0) {
|
|
// $count = mysql_result($query_run, 0,'count');
|
|
// $count_inc = $count + 1;
|
|
|
|
// $query_update = "UPDATE `hits_count` SET `count` = '$count_inc'";
|
|
// if ($query_update_run = mysqli_query($con, $query_update)) {
|
|
echo 'OK';
|
|
}
|
|
}
|
|
}
|
|
//}
|
|
|
|
update_count();
|