Just started getting into the use of cookies. The following code will redirect users to a set URL should they view a preset number of pages. I'm a little concerned with the speed in which this executes though. Is there a better way, or this fine?
Code: [Select]public function onPrepareContent(&$article, &$params, $limitstart)
{
global $mainframe;
$content = $article -> text;
$current = JURI::current();
$duration = $this->params->get('duration');
$destination = $this->params->get('destination');
$max_count = $this->params->get('maxcount');
$site_id = 'aseihthaslhetlasiehtlasndlksahdlv';
$value = 1;
if(!(isset($_COOKIE["$site_id"])))
{
setcookie("$site_id", $value, time() + 60 * 60 * 24 * $duration);
}
if(isset($_COOKIE["$site_id"]))
{
$increment = TRUE;
if($_COOKIE["$site_id"] > $max_count)
{
$value = 1;
setcookie("$site_id", $value, time() + 60 * 60 * 24 * $duration);
$increment = FALSE;
header("Location: $destination");
}
if($increment)
{
$value = $_COOKIE["$site_id"];
$value++;
setcookie("$site_id", $value, time() + 60 * 60 * 24 * $duration);
/*$content = $_COOKIE["$site_id"];*/
}
}
$article -> text = $content;
}
void* and sizeof()
Hi,Using void* and sizeof is it possible to get the value of the object ?I understand that dereferencing a void pointer is not directly possible. Is there a way (like casting) or something else to get
What's best way to get a user's Word doc converted to simple html and images?
Hi all,I was just wondering if anybody has any experience of this.Basically, I'm building a site for a guy and he keeps throwing tonnes of content my way, all Word docs with tables, images, etc.The
Display data returned from Ajaxservices!!
I have a question about displaying results using ajax. I have part of the code below. $.ajax({ type: "POST", url: "AJAXServices.asmx/GetTechInfo", data: '{ "fieldName": ' +
Why is my row count 0?
Here's the MySQL query i'm running. It basically pulls data from 2 tables based on some data passed.Here are things i know.1. The data passed is passed correctly, and is correct as far as data goes.2.
Session login issue
I'm wondering how to fix a problem I'm having with a session-based login systemSay I go to http://www.website.comThe page that processes the login then returns the now-logged-in user to
Help with PHP Email Script
Hi guys,I'm a newbie to php and need help with the script below:At the moment when I receive the automated email of data, I'm not receiving any information with the form field names I receive blank
retrieving images from mysql database using php
So I've been trying to figure out how to store images in a mysql database, and as far as i can tell the images are stored but getting them out seems to be the problem. when i try to go to the page on
Php - mysql store data and use it later?
Hi, i' making a login page at the moment, however my username + password is stored many different places, and is kinda hard to get, so I have written this entire code:Code:
Pre-Fill out a PHP form...??
This is for work actually (geek squad). We have to fill out this online php form at work over and over again to set up these new laptops, we log on to this website and have to select all this stuff. I
Gridview Not updating in Update Panel
I have a gridview, three dropdown list boxes, and a button on my form. What is displayed in the gridview depends on the values entered in the dropdown list boxes. The button calls a stored procedure