Jump to content

Error Message with Sessions


Fearpig

Recommended Posts

Hi Guys,

I am getting the following error when I try and use my login script, would someone take a look at this and suggest where I'm going wrong.....

 

Error:  :o

Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0

 

Login.php

<?php
include '../Connect_Product_Database.php';

$Password = $_POST['Password'];
$Username = $_POST['Username'];

//check that the user is calling the page from the login form and not accessing it directly 
//and redirect back to the login form if necessary 
if (!isset($Username) || !isset($Password)) { 
header( "Location: http://fer-post/internet/site_upload/" ); 
} 
//check that the form fields are not empty, and redirect back to the login page if they are 
elseif (empty($Username) || empty($Password)) { 
header( "Location: http://fer-post/internet/site_upload/" ); 
} 

//convert the field values to simple variables 
//add slashes to the username and md5() the password 
$Slash_User = addslashes($_POST['Username']); 
$MD5_Pass = md5($_POST['Password']); 


$sql="SELECT * FROM tbl_Users WHERE Username='$Slash_User'";
$Details=odbc_exec($conn,$sql);
if (!$Details)
       {exit("Error in SQL - User not found");}

$Stored_Password=odbc_result($Details,"Password");

if ($MD5_Pass == $Stored_Password) {


//----------Technical Logon----------
if ($Slash_User == 'technical') {

	//Starts a session and registers a variable
	session_start(); 
	session_register('Slash_User'); 

	include '../Navigation.php';	
	echo "<p class=BodyText1 align=center>Edit technical stuff!</p>";
	echo "<div  align=center><form action='Technical_Edit_Products.php' method='post'><input name='submit' type='submit' value='Edit Product Details'></form></div><br>";


//----------Training Logon----------		
}elseif($Slash_User == 'training'){

	//Starts a session and registers a variable
	session_start(); 
	session_register('Slash_User'); 

	echo "<p class=BodyText1 align=center>edit training stuff</p>";


//----------No Recognised User----------		
}else{

	include '../Navigation.php';
	echo "<p class=BodyText1 align=center>User not configured - Report this to IT.</p>";
	}


//----------No Recognised Password----------	
}else{

include '../Navigation.php';
echo "<p class=BodyText1 align=center>Password Not OK</p>";

}


?> 

 

If anyone could suggest whats causing this then I'd appreciate it!!

Link to comment
https://forums.phpfreaks.com/topic/59790-error-message-with-sessions/
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.