session with time limit

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jadoo
    New Member
    • Mar 2007
    • 8

    session with time limit

    I have probem with session the code is as given below .this genrates error :

    Fatal error: Call to undefined function: session_cache_e xpire() in c:\apache\htdoc s\phppgm\employ ee files\authentic ate.php on line 6

    //code
    <?
    session_cache_l imiter('private ');
    $cache_limiter = session_cache_l imiter();
    session_cache_e xpire(15);
    $cache_expire = session_cache_e xpire();
    session_start() ;
    ?>

    <?php
    if(!$uname or !$password )
    {
    echo("Enter all fields");
    exit();
    }
    if($uname and $password)
    {
    $_SESSION['password']=$_POST['password'];
    session_registe r($uname,$passw ord);
    $result=session _is_registered( $uname);
    $result.=sessio n_is_registered ($password);
    require("mym.ph p");
    $conn=mysql_con nect("localhost ",$user,$pw d)
    or die(mysql_error ());
    $rs=mysql_selec t_db($database, $conn)
    or die(mysql_error ());
    $sql="Select * from $table where uname=\"$uname\ " and password=\"$pas sword\" ";
    $rs=mysql_query ($sql)
    or die(mysql_error ());
    $num=mysql_num_ rows($rs)
    or die("User Name or Password may be wrong.So Try Again");

    if($num!=0)
    {
    echo("<b>Welcom e you are successfuly logged in $uname</b>");
    if(!isset($_SES SION['password']))
    {
    $msg = "Your session is expired.Please re enter the password";
    header("Locatio n: HomePage.php?ms g=".$msg);
    }
    else {
    // remaining code to display the form
    }
    { ?>
  • michaelb
    Recognized Expert Contributor
    • Nov 2006
    • 534

    #2
    Could you check on the version of PHP you're running?
    The cache_expire manual should give you an idea whether this function is available with your version.

    You could also try function_exists

    Comment

    • jadoo
      New Member
      • Mar 2007
      • 8

      #3
      Hai,
      Thanks for your responce,when i try function_exists it gives the following result:

      functions are not available.

      so what i should do to use session with time limit.Please help.

      Comment

      • michaelb
        Recognized Expert Contributor
        • Nov 2006
        • 534

        #4
        According to the documentation function_exists should return a boolean.
        I wonder if there's something wrong with your PHP installation.
        Let's try to execute phpinfo() and post the result here.

        Comment

        • jadoo
          New Member
          • Mar 2007
          • 8

          #5
          Originally posted by michaelb
          According to the documentation function_exists should return a boolean.
          I wonder if there's something wrong with your PHP installation.
          Let's try to execute phpinfo() and post the result here.

          u r right it return boolean value .it echo that msg because of following code.

          <?
          if (function_exist s('session_cach e_expire')) {
          echo " functions are available.<br />\n";
          } else {
          echo " functions are not available.<br />\n";
          }
          session_cache_e xpire(15);
          $cache_expire = session_cache_e xpire();
          session_start() ;
          ?>


          i dont know how should i use session in my script.Actualy iwant that my forms r expired in 15 minuts after loging user.so what i should do?

          Comment

          • jadoo
            New Member
            • Mar 2007
            • 8

            #6
            Originally posted by jadoo
            u r right it return boolean value .it echo that msg because of following code.

            <?
            if (function_exist s('session_cach e_expire')) {
            echo " functions are available.<br />\n";
            } else {
            echo " functions are not available.<br />\n";
            }
            session_cache_e xpire(15);
            $cache_expire = session_cache_e xpire();
            session_start() ;
            ?>


            i dont know how should i use session in my script.Actualy iwant that my forms r expired in 15 minuts after loging user.so what i should do?

            No one give me responce for my problem .what u all doing.Please tell me how can i send new problem

            Comment

            Working...