Reply
one time message, then gone
Old 04-18-2007, 06:07 PM one time message, then gone
Novice Talker

Posts: 11
Hello,

Could someone direct me to +howto/tutorial on:

I built a site and I want it to display a page with message saying "Welcome to......I hope you enjoy your stay etc etc etc." and at the bottom of such message a checkbox with "Do not display this message again and go directly to page." Any idea how to do something like that?
kargul is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 04-18-2007, 06:13 PM Re: one time message, then gone
Novice Talker

Posts: 11
I forgot to mention - the user should not see the rest of the content before that message. Thanks.
kargul is offline
Reply With Quote
View Public Profile
 
Old 04-18-2007, 07:28 PM Re: one time message, then gone
Republikin's Avatar
Super Moderator

Posts: 3,191
It really depends a lot on how you currently have your site set up but the most simple of answers is to set up a splash page and have it set/check for a cookie with the value of the check box in it. If the cookie is set then you know that they don't want to see the page thus you could redirect them to another page otherwise, if the cookie is not set then don't redirect.
Republikin is offline
Reply With Quote
View Public Profile
 
Old 04-18-2007, 08:43 PM Re: one time message, then gone
Novice Talker

Posts: 11
Republikin, do you think the method you described is somewhere well documented as I have only little experience with PHP?
kargul is offline
Reply With Quote
View Public Profile
 
Old 04-18-2007, 09:33 PM Re: one time message, then gone
Republikin's Avatar
Super Moderator

Posts: 3,191
http://www.websitepublisher.net/article/php_cookies/

Read that to learn about cookies, the rest is really just simple if/else statements.

Let me know if you have any more specific questions.
Republikin is offline
Reply With Quote
View Public Profile
 
Old 04-18-2007, 09:43 PM Re: one time message, then gone
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
Wireless Audio
Posts: 2,320
Name: Keith Marshall
Location: West Hartford, CT
Use this as your main index entry page (do not add anything else to, just create the two alternative page: skip_splash_index.html and show_splash_index.html):

index.php
PHP Code:
<?php
  
  
if (isset($_POST['skip_splash'])) {
    
    
setcookie('skip_splash', (bool)$_POST['skip_splash'], time()+60*60*24*1095'/'false0);
    
$_COOKIE['skip_splash'] = (bool)$_POST['skip_splash'];
  }
  
  if (isset(
$_COOKIE['skip_splash']) && (bool)$_COOKIE['skip_splash']) {
    
    require(
'skip_splash_index.html');
    
  } else {
    
    require(
'show_splash_index.html');
  }
  
?>

And add this to your show_splash_index.html page to add the skip form:

show_splash_index.html
HTML Code:
<form name="skip_splash_form" action="index.php" method="post">
  <input type="checkbox" name="skip_splash" id="skip_splash" />
  <label for="skip_splash">
    Skip this splash page on my next visit
  </label>
  <input type="submit" name="submit" value="Submit" />
</form>
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to one time message, then gone
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.15020 seconds with 12 queries