First visit page ad

Hello,

Do you know about first visit page AD / banner, when you visit the site, you will see this Ad page one time, can you provide me please a link to a free tutorial or script ?

I’m sure that there is relation between cookies and .htaccess , because we watch this page by visiting any link of the website, and not just the home page.

best regards


<?php
session_start();
if(false === array_key_exists('seen_ad', $_SESSION)){
    $_SESSION['seen_ad'] = true;
    #show ad
}
?>

can you give me an example, because I’m not very good in coding, a sample on the web, demo for example .

thanks AnthonySterling, you are all time someone very helpful over sitepoint forum.

Sure, visit here, you’ll get our ‘advert’, if you refresh the page, you’ll not. :wink:

Off Topic:

Thanks for the kind words

Thanks, this is exactly what I need, but how can I see the script? Because I just saw the messages.

It’s pretty much what I posted, but…


<?php
session_start();
if(false === array_key_exists('has_seen_ad', $_SESSION)){
    $_SESSION['has_seen_ad'] = true;
    echo '<h4>Hey, this is your first time here, come buy our stuffs.</h4>';
}else{
    echo 'Hey, you must have been here before, so you dont need to see our ad.';
}

2 questions please:

1: should I integrate the code in the header of each page ?
2: think that I have some HTML pages, what I should do in this case ? I mean
outside my php site

thanks again for your help