Advertise Here

Author Topic: [Code] Welcome Cookie  (Read 2671 times)

0 Members and 1 Guest are viewing this topic.

Offline JayB

  • SMF For Free Member
  • *
  • Posts: 60
  • Please do not PM for support
    • View Profile

  • Total Badges: 10
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 50 Posts
[Code] Welcome Cookie
« on: June 23, 2009, 08:27:43 am »
I know the pop up at when you go to the page are kinda annoying but some people like em so here is a welcome cookie


Headers:

Code: [Select]
<html>
<head>
<script type="text/javascript">
//Code Made By:JayB
function getCookie(c_name)
//..http://thepogohideout.mysmf.com
{
if (document.cookie.length>0)
  {
    c_start=document.cookie.indexOf(c_name + "=");
 if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1 ;
      c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length
     return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return ""
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+    ((expiredays==null) ? "" : "; expires="+exdate.toGMTString());
}

  function checkCookie()
{
username=getCookie('username');
if (username!=null && username!="")
  {
    alert('Hello and Welcome back, '+username+'!');
  }
else
  {
  username=prompt('Welcome visitor please type your name and hit enter.',"");
    if (username!=null && username!="")
    {
    setCookie('username',username,365);
    }
  }
}
</script>
</head>
<body onLoad="checkCookie()">
</body>
</html>

If it's your first visit to the forum then a text box will pop up and say "Welcome visitor please type your name and hit enter" once that's done what ever name you type in when you go back to that forum it will say Hello and Welcome back, USERNAME THAT YOU TYPED IN i hope some one finds this useful does take a while to make...

Offline Seldom Fail

  • Helpers
  • *
  • Posts: 2082
  • Helping for 3 years! :)
    • View Profile
    • My Site!

  • Total Badges: 26
    Badges: (View All)
    Sixth year Anniversary Fifth year Anniversary Apple User Search Poll Voter
Re: [Code] Welcome Cookie
« Reply #1 on: June 23, 2009, 03:54:36 pm »
Ok, so the code creates a pop up.... EVERYTIME you change from one page on the forum to another?!
<--- Donate to SMF For Free! :D

Offline JayB

  • SMF For Free Member
  • *
  • Posts: 60
  • Please do not PM for support
    • View Profile

  • Total Badges: 10
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 50 Posts
Re: [Code] Welcome Cookie
« Reply #2 on: June 23, 2009, 05:09:29 pm »
Yes Basically.

Offline Colette Brunel

  • SMF For Free Sr. Member
  • *
  • Posts: 424
    • View Profile

  • Total Badges: 17
    Badges: (View All)
    Poll Voter Level 4 Fourth year Anniversary Windows User Topic Starter
Re: [Code] Welcome Cookie
« Reply #3 on: June 23, 2009, 05:15:12 pm »
Useless as you cannot edit the body tag on SMF For Free forums.

Offline JayB

  • SMF For Free Member
  • *
  • Posts: 60
  • Please do not PM for support
    • View Profile

  • Total Badges: 10
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 50 Posts
Re: [Code] Welcome Cookie
« Reply #4 on: June 23, 2009, 05:20:11 pm »
Well some still might use it.

Offline Colette Brunel

  • SMF For Free Sr. Member
  • *
  • Posts: 424
    • View Profile

  • Total Badges: 17
    Badges: (View All)
    Poll Voter Level 4 Fourth year Anniversary Windows User Topic Starter
Re: [Code] Welcome Cookie
« Reply #5 on: June 23, 2009, 05:28:12 pm »
Probably on separate web pages, I guess.

Offline JayB

  • SMF For Free Member
  • *
  • Posts: 60
  • Please do not PM for support
    • View Profile

  • Total Badges: 10
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 50 Posts
Re: [Code] Welcome Cookie
« Reply #6 on: June 23, 2009, 05:30:49 pm »
I Don't know just thought someone would find it useful SOMEHOW.

Offline simply sibyl

  • Helpers
  • *
  • Posts: 14347
  • On hiatus
    • View Profile
    • The Tent Dwellers

  • Total Badges: 31
    Badges: (View All)
    Level 6 Poll Voter Webmaster Arcade Highscore Windows User
Re: [Code] Welcome Cookie
« Reply #7 on: June 23, 2009, 06:31:06 pm »
There are a few other codes very similar to this one in this Board actually. 
Personally I think they would annoy the heck out of members.   

Offline JayB

  • SMF For Free Member
  • *
  • Posts: 60
  • Please do not PM for support
    • View Profile

  • Total Badges: 10
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 50 Posts
Re: [Code] Welcome Cookie
« Reply #8 on: June 23, 2009, 06:32:40 pm »
Well as I said MAYBE SOMEONE will want to use it.

guest8279

  • Guest
Re: [Code] Welcome Cookie
« Reply #9 on: June 24, 2009, 08:55:11 pm »
Useless as you cannot edit the body tag on SMF For Free forums.

annd that, my friends, is why i suggested that in the suggestion forums :P

 

Related Topics

  Subject / Started by Replies Last post
21 Replies
12531 Views
Last post August 16, 2009, 09:16:42 pm
by [FailSafe]
8 Replies
4074 Views
Last post October 08, 2007, 10:37:44 am
by R u n e s c a p e
8 Replies
4336 Views
Last post November 15, 2007, 11:58:56 am
by simply sibyl
1 Replies
2056 Views
Last post November 12, 2008, 07:59:32 am
by simply sibyl
7 Replies
1377 Views
Last post January 18, 2009, 07:37:18 pm
by Crasy