Hi
I have an index.php file that looks like this:
<?php
$p = $_GET['p'];
if(is_null($p)) {
$p = 0;
}
include('connect.php'); //connects to database
$IP = $HTTP_SERVER_VARS['REMOTE_ADDR'];
$query = "INSERT INTO `visits` (`ip`, `page`) VALUES ('$IP', '$p')";
$result = mysql_query($query);
mysql_close($connect);
//Page redirection--------------------
if($p == 1 || $p == 0) {
include('main.php');
}
if($p == 2) {
include('folio.php');
}
?>
For some reason, the first time the page loads (where it should register p=0), it doesn't insert the data into the database. If I hit reload (F5), it does insert the data (with p=0).
Has anyone an idea why this is happening? Any response is appreciated.
Thanks.