Grizzley g
New member
What basically happens is I'm trying to log the users' IP everytime they visit the page, but for some reason, for every visit, I have two entries in my table "track" instead of just one.
The code is as follows (I've chopped it down for easier viewing; please let me know if the placement of the code is wrong or if the code itself is faulty. I know that some PHP codes need to be placed at a certain place, but not very sure about that):
<?php
// OPEN CONNECTION
include ('db_connect_ip.php');
// INSERT INTO
$ip=$_SERVER['REMOTE_ADDR'];
?>
<!DOCTYPE>
<html >
<head>
<title></title>
</head>
<body>
<div id="page">
<table class="menu" id="navMenu"></table>
<div id="copy"></div>
<div id="intprot">
<?php
$function = "INSERT INTO track (ip) VALUES ('$ip')";
$carryout = mysql_query($function);
echo "Your IP address is $ip (locked and logged!)";
?>
</div>
<div id="enroll"></div>
</div>
</body>
</html>
The code is as follows (I've chopped it down for easier viewing; please let me know if the placement of the code is wrong or if the code itself is faulty. I know that some PHP codes need to be placed at a certain place, but not very sure about that):
<?php
// OPEN CONNECTION
include ('db_connect_ip.php');
// INSERT INTO
$ip=$_SERVER['REMOTE_ADDR'];
?>
<!DOCTYPE>
<html >
<head>
<title></title>
</head>
<body>
<div id="page">
<table class="menu" id="navMenu"></table>
<div id="copy"></div>
<div id="intprot">
<?php
$function = "INSERT INTO track (ip) VALUES ('$ip')";
$carryout = mysql_query($function);
echo "Your IP address is $ip (locked and logged!)";
?>
</div>
<div id="enroll"></div>
</div>
</body>
</html>