Jump to content

Archived

This topic is now archived and is closed to further replies.

xyn

Cookies Problems.

Recommended Posts

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 [b]IN [/b]and [b]OUT [/b]of my website.

Below is my code:
[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>';
}

[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.