Session...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sa

    Session...

    Hi, all

    i must say that i'm new in using sessions and i though i understood the
    meaning work of them..
    but i have such script that don't do properly what i want.

    Its really a simple store of a variable counter...

    i firstly use:

    session_start() ;

    $f=fopen("count ","rb");
    $count = fread($f,5000);
    fclose($f);

    if(session_is_r egistered($coun t)){
    $count = $count + 1;
    }
    session_registe r("count");


    but it never jump the if...meaning that is always registered...
    some help?
    thank you



  • Alvaro G Vicario

    #2
    Re: Session...

    *** Sa wrote/escribió (Mon, 09 May 2005 21:51:46 GMT):[color=blue]
    > session_start() ;
    >
    > $f=fopen("count ","rb");
    > $count = fread($f,5000);
    > fclose($f);
    >
    > if(session_is_r egistered($coun t)){
    > $count = $count + 1;
    > }
    > session_registe r("count");[/color]

    You are using deprecated functions. You'd better read and write session
    data using the $_SESSION associative array.

    <?

    session_start() ;

    .....

    if(isset($_SESS ION['count'])){
    $_SESSION['count']++;
    }else{
    $_SESSION['count']=0;
    }

    ?>


    --
    -- Álvaro G. Vicario - Burgos, Spain
    -- http://bits.demogracia.com - Mi sitio sobre programación web
    -- Don't e-mail me your questions, post them to the group
    --

    Comment

    • Alvaro G Vicario

      #3
      Re: Session...

      *** Alvaro G Vicario wrote/escribió (Tue, 10 May 2005 12:47:34 +0200):[color=blue]
      > }else{
      > $_SESSION['count']=0;
      > }[/color]

      Sorry, I didn't really check what your script does. I guess this doesn't
      make sense xD


      --
      -- Álvaro G. Vicario - Burgos, Spain
      -- http://bits.demogracia.com - Mi sitio sobre programación web
      -- Don't e-mail me your questions, post them to the group
      --

      Comment

      • Sa

        #4
        Re: Session...

        Yes, it was right this the trouble.
        Deprecated functions.
        Now all is working.
        My script is a simple counter.
        Thank you for the hint.

        cheers


        Comment

        • Sa

          #5
          Re: Session...

          Yes, it was right this the trouble.
          Deprecated functions.
          Now all is working.
          My script is a simple counter.
          Thank you for the hint.

          cheers


          Comment

          Working...