Jump to content


Photo

Cookies Problems.


  • Please log in to reply
No replies to this topic

#1 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 28 June 2006 - 04:08 PM

Hii,

I've been trying to make a sort of hit counter with MYSQL i've tried to set a cookie which is timed for about 1 month however There is either a problem setting the cookie or viewing the cookie. It's like a hit coutner to see how many hits come IN and OUT of my website.

Below is my code:
if(!isset($_COOKIE['vibein'])){

setcookie("vibein", vibein, time() + (29 * 23 * 59 * 60) , "/affiliate/", zroxx.com, FALSE);

include("db.php");
$result = mysql_query("SELECT * FROM stats WHERE id='1'");
while($indata = mysql_fetch_row($result)){
$inn = $indata[2];
}
$total = $inn+1;

include "db.php";
$db = mysql_connect("localhost", $login, $pwd) or die(mysql_error());
mysql_select_db("zroxxco_affiliate") or die(mysql_error());
$query = "UPDATE `stats` SET `in` = '$total' WHERE `id`='1'" or die(mysql_error());
$result = mysql_query($query, $db) or die(mysql_error());

echo '<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="3;URL=URL_HERE">
<title>Re-directing...</title>
</head>';
}else{
echo '<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="3;URL=URL_HERE">
<title>Re-directing...</title>
</head>';
}






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users