<?php
session_start();
include "db.php";

if(!isset($_SESSION['visitor_id'])){
$_SESSION['visitor_id']=session_id();
}

$session=$_SESSION['visitor_id'];
$ip=$_SERVER['REMOTE_ADDR'];

$conn->query("
INSERT INTO page_visits(session_id,ip_address)
VALUES('$session','$ip')
");

echo "ok";
?>