Jump to content

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]
Link to comment
https://forums.phpfreaks.com/topic/13122-cookies-problems/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.