Modification to my CPG, cookie + popup script. Modification to my CPG, cookie + popup script.
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Modification to my CPG, cookie + popup script.

Started by opulence, May 01, 2005, 02:37:27 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

opulence

I'm looking for someone that will be able to modify my website / cpg + phpBB bridge, to fit the following need.

Here is my site: www.naughtylilcambrats.com

It's based on the 'Fruity' theme, though it has been modified quite a bit, and it's also bridged with a phpBB2.

What I need is for a popup to occur on each unique visitor's 5th click, 10th click, 15th click, and so forth onto my gallery (displayimage.php).

I believe this could be done by setting a cookie / session with each unique visitor, and a counter that adds to the cookie, when the cookie counter reaches 5, it orders the first popup, when it reaches 10, it orders the second popup, when it reaches 15, it orders the third popup/etc.

I had some success coding this myself outside of CPG, however I'm not familiar enough with the way CPG works in order to have the variables passed correctly just after the body tag for a popup.  Here is an example of it working: http://bytemedia.ca/brent.php - here's the code used:

<?
session_start();

if ($_SERVER['PHP_SELF'] == "/brent.php") {
if(!isset($_SESSION['c']) || !is_numeric($_SESSION['c'])){
}
if(++$_SESSION['c']==5){
$_POST['showPopup']=true;
}
}
?>


Placing this code at the top of displayimage.php seems to set the cookie properly - however trying to execute the 'showPopup' within the html body is where it becomes a little more difficult.  On my test - brent.php page (as opposed to displayimage.php) - the following code works if inserted right below the opening body tag:

<? if($_POST['showPopup']){ ?>
<script> alert("hi"); </script>
<? } ?>


However, when I take that code and try to put it into displayimage.php, it won't work.  I believe the reason for this is that displayimage.php actually uses template.html's body.  This makes things difficult for me, because not only does that mean trying to write a coppermine-specific variable (like the one's inclosed like this - {GALLERY}) it also means only having that {MY_POPUPCODE} variable that would have to be written, only used in displayimage.php even though it has to exist within template.html.

So basically, half of the coding is done/solved, what I need is for someone to make it work in CPG! :P  Feel free to contact me by replying here, as I'll be checking if someone does, and please name your price.

Regards,
Brent