snippets / common.js unction - remember username/password

Language: Javascript - First posted by willowdan on 2008-02-6 07:15 (9 months, 2 weeks)
Link to the snippet: http://www.friendsnippets.org/snippet/177/

pls. add the functions in common.css

 1 var cookie_string;
2 var cookie_string0;
3
4 function getCookieUsrname ( cookie_string )
5 {
6 if (cookie_string!=null || cookie_string != '' || cookie_string != 'undefined'){
7
8 var comp = "username="
9 var username1 = document.cookie.split(';');
10
11 for(var i=0;i < username1.length;i++)
12 {
13 var check = username1[i];
14 while (check.charAt(0) == " ")
15 check = check.substring(1,check.length);
16 if (check.indexOf(comp) == 0)
17 return check.substring(comp.length,check.length);
18 }
19 return;
20 }
21 }
22
23 function getCookiePass ( cookie_string0 )
24 {
25 if (cookie_string0!=null || cookie_string0 != '' || cookie_string0 != 'undefined'){
26
27 var comp0 = "password="
28 var password1 = document.cookie.split(';');
29
30 for(var i=0;i < password1.length;i++)
31 {
32 var check = password1[i];
33 while (check.charAt(0) == " ")
34 check = check.substring(1,check.length);
35 if (check.indexOf(comp0) == 0)
36 return check.substring(comp0.length,check.length);
37 }
38 return;
39 }
40 }
In order to post a comment, you should have a friendsnippet account. Please sign-in.

0 comments

Feb '08
  • pls. add the functions in common.css

Common Tags



snippet History

Feb '08