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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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