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;
}
displaying email without attracting a ton of spam
Hello,this is maybe the wrong place to ask.How would you display an email address on a website without attraciting all the spammers of the world to fill your mailbox ?does anybody use something
Refining of search Criteria
Dear FriendsI need a help, I have a search page which of cars related, which has different search criteria e.g. maker, model, color, displacement etc. when i give any search criteria and click the
How to store checkbox array in a session, and then be able to add to it?
I'm trying to store an array of checkbox values into a session array, sort of like a shopping cart, but I can't figure out how to not overwrite the sessions array each time new checkbox values are
Ignore html and bbcode?
I've created a function to limit the amount of text according to the amount of words.However it ruins html and bbcode tags.. . I only want it to have affect on everything else within $text but not
Creating web pages by php
Hello again,I was just wondering us there a way to use a php script to create a new web page. I guess the best example is something like YouTube where when a video is uploaded, it's assigned a new
how to remove in php string display
My code is
Using unserialize()
Hi there.I have some data in my database that is serialized.e.g. a:2:{i:0;s:9:"Test";i:1;s:4:"Another Test";}I'm unsure how to use unserialize to convert it into a string in the
"From field" in PHP email form
I used a wizard to create a PHP email form. I was able to customize it with the exception of the From field. I need the email that is sent to be "From" the email that the sender input.
Is there a way to override built in php functions without APD?
I am trying to use the rename_function()override_function() options that are built into the APD php extension. But I don't want to rely on that extension being loaded.This is another one of my
Linkage between two scripts
Okay say I have this for a link in a script:Code: <li><a href="#" onclick="ajaxpage('bio', 'content'); return