I am trying to capture the current date a user is on my website, but only when they click on a particular link (in this case, surf.php).
<?php
$surf = $_GET['surf'];
if ($_SESSION['username'] != 'Admin')
echo "Welcome, ".$_SESSION['username']. "!<br /><a href='surf.php' name='surf'>Surf</a><br /><a href='sites.php'>Add Site</a><br /><a href='logout.php'>Logout</a>";
if ($surf){
include('inc/connect.php');
$lastsurfed = date("Y-m-d");
$currentdate = mysql_query("SELECT lastsurfed FROM users WHERE lastsurfed='$lastsurfed'");
$datecount = mysql_num_rows($datecount);
}
else
echo "Welcome, ".$_SESSION['username']. "!<br /><a href='surf.php'>Surf</a><br /><a href='sites.php'>Add Site</a><br /><a href='logout.php'>Logout</a><br /><a href='admin/index.php'>Admin Area</a>";
} else
header("Location: index.php");
?>
I must be doing something wrong. No errors are being returned. When clicking the link, it does not update the date inside my sql taable.