This is not entirely a PHP question although it is based in PHP.
I have been creating a site, where I want the visitors to see the visited links as "Crossed Out" using CSS. However, I also want this effect to disappear after about 18 hours, so I used a PHP cookie to read when the last time the user visited the site was, and change the CSS so that the "visited" links had the same "Style" as the regular links. This seemed to work, however when you visited a new page, all the old "visited" links showed up again. Can you get rid of these? Or is there some other method?
In the header:
[php]
if (isset($_COOKIE[<CookieName>]))
$timeup="1"; //Cookie is present, apply visited style;
else
{
setcookie(<CookieName>, "VisitedToday", time()+72000, "/", "<WebsiteName>");
$timeup="0"; //Cookie is not present. Set Cookie;
}
[/php]
In the CSS
[php]
<?php
if ($timeup=="1")
{
echo "
.mmenus a:visited
{
color: black; font-family: arial; background-color: white; display: block; border-bottom: 1px solid black; font: 11px Sans-serif; font-weight: bold; text-decoration: line-through; text-align: center; height: 14px;
}";
}
else
{
echo "
.mmenus a:visited
{
color: black; font-family: arial; background-color: white; display: block; border-bottom: 1px solid black; font: 11px Sans-serif; font-weight: none; text-decoration: none; text-align: center; height: 14px; font-size: 10px;
}";
} ?>
[/php]