SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Session

  1. #1
    SitePoint Addict einSTein's Avatar
    Join Date
    Aug 2006
    Posts
    276
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Session

    i have a login form but i want to register the username in a session to use it in the whole pages of the website and i wanna know how to use session

  2. #2
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    session_start();
    if (!
    session_is_registered('username')) {
      
    session_register('username');
      
    $_SESSION['username'] = $_POST['username'];


  3. #3
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Don't use session_register with $_SESSION
    http://us2.php.net/manual/en/functio...registered.php

    Code php:
    <?php
     
    session_start();
     
    if (!isset($_SESSION['key']) {
        $_SESSION['key'] = 'value';
    }
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •