cookie for lava

Started on the old forum in August 2010 · view the original in the archive · old links redirect here

#cookie #remember-me-login #session

21 replies · 2,964 views · started 16 years ago · 1 min read

14 participants
jaidon20k Developer · 64 posts #1

pls can anybody tell how to use cookie and session for remember me login for lava script. thanks

something else Fellow · 2,296 posts #2

login.php

setcookie("sid", $value, time()+3600);//expires in 1 hour

collecting the cookie on other pages:

$sid = $_COOKIE["sid"];

logout page:

setcookie("sid", $value, time()-3600);//expired cookie 1 hour ago
wap_king Developer · 126 posts #3

does this work and is it secure?

something else Fellow · 2,296 posts #4

yeah works ... you are better off using $_SESSION with mobiles though .... safety wise .... safer than using sessions in url`s however you would need to make the COOKIE more secure by protecting it against sql/html injection etc.

WhyQ Newbie · 9 posts #5

Ok. So you mean

$sid =$_COOKIE [ "sid"];
 

wil be on every other page

something else Fellow · 2,296 posts #6

$sid = $_COOKIE["sid"]; on every page instead of $sid = $_GET["sid"];

WhyQ Newbie · 9 posts #10

You mean using cookie is not secure for lavalair

Jerson Developer · 70 posts #11

Session expired. You are not login haha lol. I cant install it on my lava

ewanz Developer · 187 posts #13

CreativityKills wrote: Using cookie is hardly secure too. Cross Site Requests is easier :)

can u give the example? how about if we sanity the cookie...

our lfe is simple words.... 😌 http://mygenkz.net ewanz06@yahoo.com

$output="i am NOoob....";
$newfile="ewanz.txt";
$file = fopen ($newfile, "w");
fwrite($file, $output);
fclose ($file); 
adex3g Developer · 181 posts #15

Can i use both $_session and $_cookie, how to using the both and also remember me

Added after 13 minutes:

Can i use both $_session and $_cookie, how to using the both and also remember me

have connected with http://adexchat.com ? Fun up with http://forum.adexchat.com

pmbguy Senior · 344 posts #17

ok, something like this in your core:

$sid = $_COOKIE["SESSIONID"]; $inTwoMonths = 60 * 60 * 24 * 60 + time(); $res = setcookie("SESSIONID", $sid, $inTwoMonths);

then

setcookie("SESSIONID", $sid, $inTwoMonths); at login

and

$backTwoMonths = time() - (60 * 60 * 24 * 60); $res = setcookie("SESSIONID", $sid, $backTwoMonths);

in logout

oh and remove $sid= $_GET['sid'] in all pages

bugmenot2 Newbie · 3 posts #18

Where in login.php do i put

setcookie("sid", $value, time()+3600);//expires in 1 hour

?

Cos in my login.php, i have this

$tm = time(); $xtm = $tm + (getsxtm()*60); $did = $uid.$tm; $res = mysql_query("INSERT INTO ibwf_ses SET id='".md5($did)."', uid='".getuid_nick($uid)."', expiretm='".$xtm."'");

  if($res)
  {
    $tolog=true;
    echo "<img src=\"../images/ok.gif\" alt=\"+\"/>You have logged in successfully as $uid

"; echo "Please Bookmark this page to avoid repeating the login proccess in the future

"; $idn = getuid_nick($uid);

        $lact = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$idn."'"));
         mysql_query("UPDATE ibwf_users SET lastvst='".$lact[0]."' WHERE id='".$idn."'");
  }else{
    //is user already logged in?
    $logedin = mysql_fetch_array(mysql_query("SELECT (*) FROM ibwf_ses WHERE uid='".$getuid_nick($uid)."'"));
    if($logedin[0]>0)
    {
      //yip, so let's just update the expiration time
      $xtm = time() + (getsxtm()*60);
      $res = mysql_query("UPDATE ibwf_ses SET expiretm='".$xtm."' WHERE uid='".getuid_nick($uid)."'");
      
      if($res)
      {
        $tolog=true;
        echo "<img src=\"../images/ok.gif\" alt=\"+\"/>You have logged in successfully as $uid

"; echo "Please Bookmark this page to avoid repeating the login proccess in the future

";

      }else{
        echo "<img src=\"../images/point.gif\" alt=\"!\"/>Can't login at the time, pls try later

"; //no chance this could happen unless there's error in mysql connection

      }
      
    }
    
  }

}

}

Please help. And please don't flame me, i know am a noob.

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close