SMF For Free Support Forum
Signup For Free Forum
March 21, 2010, 10:28:55 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to SMF For Free. The best free SMF Host
 
   Home   Help Search Arcade Gallery Login Register  

Pages: [1]
  Print  
Author Topic: [Code] Welcome Cookie  (Read 611 times)
0 Members and 1 Guest are viewing this topic.
JayB
SMF For Free Member
*
Offline Offline

Posts: 60


Please do not PM for support


View Profile
« 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:
<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...
Logged
Seldom Fail
SMF For Free Sponsors
*
Offline Offline

Posts: 1481


Please feel free to email me ;)


View Profile WWW
« 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?!
Logged

If at first you fail... call it Vista, sell it, and hope that no one notices



My Blog Wink
JayB
SMF For Free Member
*
Offline Offline

Posts: 60


Please do not PM for support


View Profile
« Reply #2 on: June 23, 2009, 05:09:29 pm »

Yes Basically.
Logged
Colette Brunel
SMF For Free Sr. Member
*
Offline Offline

Posts: 423



View Profile
« Reply #3 on: June 23, 2009, 05:15:12 pm »

Useless as you cannot edit the body tag on SMF For Free forums.
Logged
JayB
SMF For Free Member
*
Offline Offline

Posts: 60


Please do not PM for support


View Profile
« Reply #4 on: June 23, 2009, 05:20:11 pm »

Well some still might use it.
Logged
Colette Brunel
SMF For Free Sr. Member
*
Offline Offline

Posts: 423



View Profile
« Reply #5 on: June 23, 2009, 05:28:12 pm »

Probably on separate web pages, I guess.
Logged
JayB
SMF For Free Member
*
Offline Offline

Posts: 60


Please do not PM for support


View Profile
« Reply #6 on: June 23, 2009, 05:30:49 pm »

I Don't know just thought someone would find it useful SOMEHOW.
Logged
simply sibyl
Global Moderator
*
Offline Offline

Posts: 13309



View Profile WWW
« 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.   
Logged

JayB
SMF For Free Member
*
Offline Offline

Posts: 60


Please do not PM for support


View Profile
« Reply #8 on: June 23, 2009, 06:32:40 pm »

Well as I said MAYBE SOMEONE will want to use it.
Logged
FcDigital~DZines
SMF For Free Newbie
*
Offline Offline

Posts: 14


View Profile
« 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 Tongue
Logged



Pages: [1]
  Print  
 
Jump to:  



Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
ServerBeach Coupon
Page created in 0.331 seconds with 15 queries. (Pretty URLs adds 0.1s, 2q)