473,508 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cookies and login 'forever'

77 New Member
I want To offer a login Option, two Checkboxs, 1 labeled 'normal' the other labeled 'Forever'. I want to assign the check boxes to switch between the
cookie script below (normal) and An altered version of the cookie script 'forever' Which will not expire but require deletion from the users pc.

I need help to alter the cookie code below NOT to expire.

I need help to write a javascript to switch between the two according to user prefrence (checkbox checked)

The idea I have for the switching code will switch from one url to the other accordingly.
If the user checks 'normal' it will use the url below of the normal script below.
[since this is built in it must be over ridden if 'forever' checked'
If the user checks 'forever' it will use the url of the altered script (as yet undefined. I will host it) so the switching code must allow for me to add the forever cookies script url.

I want the 'forever' box checked by default.

Can some smart coder please please write these codes for me?

url of normal cookies script

http://static.1.ipbfree.com/external..._jq_cookies.js

normal cookies script

Expand|Select|Wrap|Line Numbers
  1.  
  2. jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
  3. var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
  4. expires='; expires='+date.toUTCString();}
  5. var path=options.path?'; path='+options.path:'';var domain=options.domain?'; domain='+options.domain:'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
  6. return cookieValue;}};
current quick login script (need checkboxs to right of this)

Expand|Select|Wrap|Line Numbers
  1. <form style="display: inline;" action="http://inny.ipbfree.com/index.php?act=Login&CODE=01&CookieDate=1" method="post"> <div align="center"><strong>Quick Log In</strong> <input class="forminput" size="20" name="UserName" onfocus="this.value=''" value="User Name" type="text"> <input class="forminput" size="20" name="PassWord" onfocus="this.value=''" value="ibfrules" type="password"> <input class="button" src="http://inny.ipbfree.com/uploads/ipbfree.com/inny/emo-up.gif" type="image"> </div> </form>
  2.  
Dec 8 '07 #1
3 3140
acoder
16,027 Recognized Expert Moderator MVP
The expire value is multiplied in the script to be the number of days. Change this to a reasonably large number to be 'forever'.

For the checkbox value, check the checked property.
Dec 10 '07 #2
Inny
77 New Member
Im not good with cookies, which is the expire value? which number do I change please?
Dec 10 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Im not good with cookies, which is the expire value? which number do I change please?
Are you calling a cookie function anywhere? The third argument is 'options' which contains among other things, the 'expires' number value.
Dec 11 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2796
by: windandwaves | last post by:
Hi Gurus I am basically sorry that I have to bother you about this. I am a PHP beginner and I have been studying sessions and cookies over the last few weeks. I have learned lots, but I am...
0
14665
by: Maverick | last post by:
Hello all, I read some good reviews about jakarta HTTPClient about its session and cookies management system and fancied giving it a try as a learning exercise but somehow I don't seem to be able...
0
1305
by: Ori | last post by:
Hi, In continue to another post which I have in this news group, I was able to find out some more details about the problem What is my problem? I currently build some kind of web-service...
2
1590
by: Netanel | last post by:
Hi, I have a site that I developed in ASP / VBScript. Some of the visitors are complaining that they can't get in into the system (using the login form of-course). My login form includes...
0
2194
by: Mach Runner | last post by:
I am implementing a secure website using the ASP.NET FormsAuthentication model. I have taken the simplest code examples from MSDN (login.aspx,default.aspx, web.config) but cannot get proper...
2
2226
by: john.lehmann | last post by:
Attacked is a piece of code which first hits the login page successfully and receives back login cookies. But then when I attempt to hit a page which is restricted to logged in users only, I fail....
3
1815
by: Phillip N Rounds | last post by:
I'm having trouble with using cookies to monitor the stages of login. I have a two stage Registration page ( register.aspx ) and my target page ( MyPage.aspx ) I'm using a cookie named LoginStatus...
4
2769
by: Jon Slaughter | last post by:
I have developed a technique to add and remove cookies after output... wondering if there is something else like this out there? Jon
9
38312
by: tanya.wang | last post by:
Hi, I have a website that would set two cookies when a user logs in successfully. <% response.cookies("login_status")="OK" response.cookies("login_id")="12345" 'This value is from database....
0
7229
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7129
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1566
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
428
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.