I can not log out

  • tastysite
  • Proficient
  • Proficient
  • User avatar
  • Posts: 349
  • Loc: Brighouse, West Yorkshire, England

Post 3+ Months Ago

I have been using my website and its login/out opeons on my local driver for agers and am still develeping parts of the site however everytime I try to log out it comes up with this
Quote:
Fatal error: Call to undefined function session_get_cookie_prams()
now it used to work and I haven't done anything with the code this is the php
Code: [ Select ]
session_start();
include('inc/functions.php');
if (!isset($_SESSION['name'])) {
    $conn = dbConnect();
    dbSelect();
    $user = $_POST['user'];
    $pass = sha1($_POST['pass']);
    $query = "select
        count(*)
        from
        tb_members
        where
        f_username='$user'
        and
        f_password='$pass'";
    $user="";
    $pass="";
    $count = @mysql_result(@mysql_query($query), 0);
 
    if (0 == $count) {
        // not in databace
    } else {
        // logged in!
        // store session data
        $_SESSION['name'] = $_POST['user'];
        $_SESSION['start'] = time();
    }
}
 
 
if(isset($_GET['page'])){
$page = $_GET['page'];
} // makes php swich case work
 
 
 
if ($page == "logout"){
    // Log out - Destroy Session
    $CookieInfo = session_get_cookie_prams();
    if ((empty($CookieInfo['domain'])) && (empty($CookieInfo['secure']))) {
        setcookie(session_name(), '', time()-3600, $CookieInfo['path']);
    } elseif (empty($CookieInfo['secure'])) {
        setcookie(session_name(), '', time()-3600, $CookieInfo['path'], $CookieInfo['domain']);
    } else {
        setcookie(session_name(), '', time()-3600, $CookieInfo['path'], $CookieInfo['domain'], $CookieInfo['secure']);
    }
    unset($_COOKIE[session_name()]);
    $_SESSION{'name'} = null;
    session_destroy();
}
  1. session_start();
  2. include('inc/functions.php');
  3. if (!isset($_SESSION['name'])) {
  4.     $conn = dbConnect();
  5.     dbSelect();
  6.     $user = $_POST['user'];
  7.     $pass = sha1($_POST['pass']);
  8.     $query = "select
  9.         count(*)
  10.         from
  11.         tb_members
  12.         where
  13.         f_username='$user'
  14.         and
  15.         f_password='$pass'";
  16.     $user="";
  17.     $pass="";
  18.     $count = @mysql_result(@mysql_query($query), 0);
  19.  
  20.     if (0 == $count) {
  21.         // not in databace
  22.     } else {
  23.         // logged in!
  24.         // store session data
  25.         $_SESSION['name'] = $_POST['user'];
  26.         $_SESSION['start'] = time();
  27.     }
  28. }
  29.  
  30.  
  31. if(isset($_GET['page'])){
  32. $page = $_GET['page'];
  33. } // makes php swich case work
  34.  
  35.  
  36.  
  37. if ($page == "logout"){
  38.     // Log out - Destroy Session
  39.     $CookieInfo = session_get_cookie_prams();
  40.     if ((empty($CookieInfo['domain'])) && (empty($CookieInfo['secure']))) {
  41.         setcookie(session_name(), '', time()-3600, $CookieInfo['path']);
  42.     } elseif (empty($CookieInfo['secure'])) {
  43.         setcookie(session_name(), '', time()-3600, $CookieInfo['path'], $CookieInfo['domain']);
  44.     } else {
  45.         setcookie(session_name(), '', time()-3600, $CookieInfo['path'], $CookieInfo['domain'], $CookieInfo['secure']);
  46.     }
  47.     unset($_COOKIE[session_name()]);
  48.     $_SESSION{'name'} = null;
  49.     session_destroy();
  50. }

long I know any thoughts on the problem? (to be honest I have not got a clue what all that does I didn't do it a friend did so sorey if its easy!)
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

Change session_get_cookie_prams() to session_get_cookie_params()
  • tastysite
  • Proficient
  • Proficient
  • User avatar
  • Posts: 349
  • Loc: Brighouse, West Yorkshire, England

Post 3+ Months Ago

thanks that worked! :)
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

tastysite wrote:
thanks that worked! :)

Yup... you may have accidentally changed that without noticing it... that sometimes happens to me :roll:
  • jeckmartin
  • Newbie
  • Newbie
  • jeckmartin
  • Posts: 5

Post 3+ Months Ago

thnks i was aslo looking for this.

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 94 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.