Fearpig Posted July 13, 2007 Share Posted July 13, 2007 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: 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 More sharing options...
sushant_d84 Posted July 13, 2007 Share Posted July 13, 2007 Goto file PHP.ini and find the directive there... register_globals. try to change its setting that is register_globals=Off/On and restart everthing ... and check it out...... If solved .....let me know Regards Sushant Link to comment https://forums.phpfreaks.com/topic/59790-error-message-with-sessions/#findComment-297246 Share on other sites More sharing options...
metrostars Posted July 13, 2007 Share Posted July 13, 2007 All I can think of is that you might have REGISTER_GLOBALS turned off in the ini. You could always try using $_SESSION['Slash_User'] = $Slash_User; as the method you used is not a preferred method. Link to comment https://forums.phpfreaks.com/topic/59790-error-message-with-sessions/#findComment-297254 Share on other sites More sharing options...
Fearpig Posted July 13, 2007 Author Share Posted July 13, 2007 Hello, I thought that setting Register_Globals = Off was a security risk? From another site I've found this fix... set session.bug_compat_warn = 0. Does this just suppress the error message? Link to comment https://forums.phpfreaks.com/topic/59790-error-message-with-sessions/#findComment-297290 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.