How To user sessions in php5 & iis 6.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abdoelmasry
    New Member
    • Oct 2006
    • 104

    How To user sessions in php5 & iis 6.0

    Hi all
    i have problem while using sessions

    i was working with php4 on apache with This Functions:

    [PHP]session_start() ;
    session_registe r("username") ;
    $username="abdo elmasry";[/PHP]

    it was working good

    now
    im trying to use sessions in php5 on IIS 6.0

    I wanna Some Wote Help me
    Why this code Not Working:

    first Page:

    [PHP]<?php
    session_start() ;
    $_SESSION['username']="abdoelmasr y";
    ?>[/PHP]

    Second page:

    [PHP]<?php
    session_start() ;
    echo "$username" ;
    ?>[/PHP]

    ThX
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    echo "$username" ;
    This has nothing to do with PHP 5 or IIS 6.

    The username is NOT stored in $username!! What makes you think it is? You stored the username in $_SESSION['username'] so when yoiu want to display it you must do it from the spot where you saved it, i.e. the $_SESSION array.

    So you command should be

    [php]echo $_SESSION['username'];[/php]

    Ronald :cool:

    Comment

    • abdoelmasry
      New Member
      • Oct 2006
      • 104

      #3
      Yes U Have Real
      I tried The following code as you said

      first page:

      [PHP]<?php
      session_start() ;
      $_SESSION['username']="abdoelmasr y";
      ?>[/PHP]

      second page:

      [PHP]<?php
      session_start() ;
      echo $_SESSION['username'];
      ?>[/PHP]


      but it still not working
      i have checked the session creation path
      the session exactly created but i cann't read it

      i think it's some thing wrong in php.ini file

      Have You any idea

      Comment

      Working...