Jump to content
Fórum Script Brasil
  • 0

In php, how does cookies work?


Question

3 answers to this question

Recommended Posts

  • 0

Well, i work with session a long time, try this at begining start of your code:

 

<?php
 session_time_limit(240); // this set a time limit for 4 hours
 session_name("LittleJoe"); // this parameter sets a name for your session, call this name every script you creat to share same session vars
 session_start(); // initialize the SESSION

 // remember, after you started a session, one file with a encrypted name was created in /tmp at server side not at visitor side more secure! =)

 if(isset($_SESSION['UserNameofVisitor'])) {
  $UserName = $_SESSION['UserNameofVisitor']; 
 } else {
  $UserName = '';
 }

 if(isset($_SESSION['PassCode'])) {
  $Password = $_SESSION['PassCode']; 
 } else {
  $Password = '';
 }
 
 if(!empty($UserName)) {
  $YourObject->login($UserName,$Password);
 } // another wise dont do nothing load default page at start and offer a login page

?>

As you see, every time you need set some targets at your html code, if logged return one thing, another one request to login if is not logged.

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Cloud Computing


  • Forum Statistics

    • Total Topics
      148692
    • Total Posts
      644525
×
×
  • Create New...