-2

Where can I find code demonstrating the "remember me" feature of logins?

I tried here, one can click html or javascript, and see each.. and put it in an html page http://www.javascriptbank.com/remember-me.html which I did http://pastebin.com/KkjCeGJM but the "remember me" function seems to have nothing behind it.

I don't know much javascript.. I just want to have a complete code demonstration that I can run. Where can I find one? It's such a classic feature!

barlop
  • 12,887
  • 8
  • 80
  • 109

2 Answers2

0

Depending on your server-side language - I suggest you look into Cookies, which enable the login remember feature.

A google search for "login remember me cookie" together with your server-side language should yield good results.

Tom Teman
  • 1,975
  • 3
  • 28
  • 43
  • @SamHuckaby lol. Well, for future generations, here is a relevant SO answer to the original question: http://stackoverflow.com/questions/244882/what-is-the-best-way-to-implement-remember-me-for-a-website – Tom Teman Mar 14 '15 at 14:35
0

Hey, buddy just have a look at this source code hope it can help u through of what you are looking for!

function newCookie(name,value,days) {

 var days = 10;    // the number at the left reflects the number of days for the cookie to last

  // modify it according to your needs

 if (days) {

   var date = new Date();

   date.setTime(date.getTime()+(days*24*60*60*1000));

   var expires = "; expires="+date.toGMTString(); }

   else var expires = "";

   document.cookie = name+"="+value+expires+"; path=/"; }


function readCookie(name) {

   var nameSG = name + "=";

   var nuller = '';

  if (document.cookie.indexOf(nameSG) == -1)

    return nuller;


   var ca = document.cookie.split(';');

  for(var i=0; i<ca.length; i++) {

    var c = ca[i];

    while (c.charAt(0)==' ') c = c.substring(1,c.length);

  if (c.indexOf(nameSG) == 0) return c.substring(nameSG.length,c.length); }

    return null; }


function eraseCookie(name) {

  newCookie(name,"",1); }


function toMem(a) {

    newCookie('theName', document.form.name.value);     // add a new cookie as shown at left for every

    newCookie('theEmail', document.form.email.value);   // field you wish to have the script remember

}

function delMem(a) {

  eraseCookie('theName');   // make sure to add the eraseCookie function for every field

  eraseCookie('theEmail');


   document.form.name.value = '';   // add a line for every field

   document.form.email.value = ''; }


function remCookie() {

document.form.name.value = readCookie("theName");

document.form.email.value = readCookie("theEmail");

}

// Multiple onload function created by: Simon Willison

// http://simon.incutio.com/archive/2004/05/26/addLoadEvent

function addLoadEvent(func) {

  var oldonload = window.onload;

  if (typeof window.onload != 'function') {

    window.onload = func;

  } else {

    window.onload = function() {

      if (oldonload) {

        oldonload();

      }

      func();

    }

  }

}

addLoadEvent(function() {

  remCookie();

});
Peter Ajtai
  • 56,972
  • 13
  • 121
  • 140
iSearch
  • 19
  • 1
  • 1
    4 spaces before a line formats as code. Select a block and press `ctr-k` to do this. – Peter Ajtai Oct 01 '10 at 01:46
  • I think I might have a similar thing in my pastebin link. But as the previous answer said , the "remember me" work is done server side. I think as the previous answer said, it's probably just a basic thing with cookies.. that i'd find knowing a little server side stuff. googling maybe ssjs(server side javascript) cookies, or asp cookies – barlop Oct 01 '10 at 22:56
  • 1
    What about the copyright? /* This script and many more are available free online at The JavaScript Source!! http://javascript.internet.com Cookie script - Scott Andrew Popup script, Copyright 2005, Sandeep Gangadharan */ – Ross May 03 '12 at 07:31