Jump to content

loggin out issues


Kieran_Smith

Recommended Posts

Im having issues with logging out of a my website. I have successfully managed to log in. I am using sessions to do it and have been using session_unregister, which I believe is not depreciated. I have tried using unset but I am now getting the error  

 Parse error: syntax error, unexpected '"authenticatedUser"' (T_CONSTANT_ENCAPSED_STRING) in C:\wamp\www\ShreddedNutrition\HTML\Logout.php on line 8

this is my log out code

<?php

  session_start();

  $appUsername = $_SESSION["authenticatedUser"];
  $_SESSION["message"] =  "You Have Logged out";
 
  unset("authenticatedUser");

  // Relocate back to the login page
  header("Location: Login.php");
  //session_destroy();   
?>  

and this is to log in

<?php
include 'db.inc';
session_start();
$UserEmail =$_POST["EmailAddress"];
   $UserPassword =$_POST["Password"];
   $query = "SELECT * FROM members WHERE EmailAddress = '$UserEmail' 
	         AND  password = '$UserPassword' "; 
		 
	$connection = mysql_connect($hostname, $username, $password) or die ("Unable to connect!"); 
	mysql_select_db($databaseName) or die ("Unable to select database!"); 
	$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); 
	// see if any rows were returned 
	if (mysql_num_rows($result) > 0) { 
       $_SESSION["authenticatedUser"] = $UserEmail;
         // Relocate to the logged-in page
        header("Location: Index.php");
    } 
    else 
	  {
	   $_SESSION["message"] = "Could not connect log in as $UserEmail " ;
       header("Location: Login.php");
      }    
mysql_free_result($result); 
mysql_close($connection); 
 
?>

Link to comment
https://forums.phpfreaks.com/topic/288629-loggin-out-issues/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.