Jump to content

aussiefly

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Everything posted by aussiefly

  1. Yeah That didnt seem to help. There has to be somewhere in my code that is persisting these damn things... here is my header code for access to private areas: <?php ob_start(); session_start(); require_once($_SERVER['DOCUMENT_ROOT'].'/db_connect.php'); //check cookie if ($_SESSION['logged_in'] != 1 && isset($_COOKIE['login_cookie'])) { list($user, $pass) = explode('[]', $_COOKIE['login_cookie']); $qu = mysql_query("SELECT `user_password` FROM `members` WHERE `username` = '".addslashes($user)."'"); if (mysql_num_rows($qu) == 1) { $passw = mysql_fetch_object($qu); if ($passw->user_password == $pass) { $_SESSION['logged_in'] = 1; $_SESSION['username'] = $user; $_SESSION['password'] = $pass; } } } if(!isset($_SESSION['username']) && !isset($_SESSION['password'])) { $_SESSION['logged_in'] = 0; $user = "Guest"; // redirect user to login form header("Location: http://www.mysite.com/demo/login.php"); } ?>
  2. Hi Mad Techie! Thanks for the response mate I tried that and i'm still not having much luck. The session still seems to be active and I can still access the session variables. So my logout page now looks like: <? ob_start(); session_start(); $_SESSION['logged_in'] = 0; setcookie('login_cookie', "", time() - 60, '/', '.yoursite.com'); session_unset(); session_destroy(); header("Location: http://www.mysite/demo"); ?> Driving me nuts...and i know its got to be something im doing !
  3. hey guys! I'm trying to write a basic membership script...yes im a total noob and im having dramas with the sessions and cookies. For some reason I am unable to kill the session or delete the cookie. This is my logout code: <? ob_start(); $_SESSION['logged_in'] = 0; setcookie('login_cookie', "", time() - 60, '/', '.mysite.info'); session_destroy(); header("Location: http://www.mysite.info/demo"); ?> Now it works fine and doesnt throw an error BUT when I go back to the protected pages after logging out I can access it and it still says welcome USERNAME. The only way I can clear it is by manually deleting the cookies in IE. Anyone got any reasons why Session_destroy aisnt working and the cookie is staying put ???? Cheers from a total php loser
  4. looks like i solved it by placing the variable $email inside ' ' So it was just a syntax error...but dang it took me a bit to get it lol. Thanks anyway...ill keep cracking away. cheers
  5. Hi everyone! I'm a rank beginner with PHP and MYSQL and i'm trying to put together a members login script etc. At the moment i'm creating the reset your password part of the login page and i'm having trouble fetching some data out of the database. Heres my code: <?php require_once($_SERVER['DOCUMENT_ROOT'].'/db_connect.php'); // If submit button is pressed if(isset($_POST['submit'])) { if(!$_POST['email']) die("Error: You must enter your email address before proceeding."); } // Verify User Account exists with email address $email = $_POST['email']; $check_user = mysql_query("SELECT * FROM `members` WHERE user_email = $email "); $q = mysql_fetch_object($check_user); if(!$q) die("Reset Failure: An error occured, please verify that your email address is correct."); // Random Generate Password and store plain text in variable // Email User's email address with plaintext password // MD5 password and insert it into the member database ?> And i'm getting the mysql fetch object not a valid resource error. So I started looking at the query and tried to echo the results of it and its coming up blank and clearly coming back null. I'm guessing its something to do with my syntax of the query. So what am i doing wrong and how do i avoid this next time Cheers from a total php/mysql loser
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.