Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Unknown Error

  1. #1
    New Coder
    Join Date
    Jun 2007
    Posts
    60
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Unknown Error

    PHP Code:
    WarningUnknownYour script possibly relies on a session side-effect which existed until PHP 4.2.3Please be advised that the session extension does not consider global variables as a source of dataunless register_globals is enabledYou can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to offrespectivelyin Unknown on line 0 
    This only happens when I register the sessions for the first time, if I try to re-login with the sessions already registered, the error doesn't comes up.

    index.php

    PHP Code:
    <?php

    // Last Modified 16th August

    ob_start();

    include(
    'templates/header.php'); // Header template
    include('../config/config.php'); // Includes configuration files
    include('../lib/functions.php'); // Load all functions from Library

    include('templates/login.php'); // Login form

    $submit $_POST['log_in'];
    $posted_username sql_safe($_POST['username']);
    $posted_password sql_safe($_POST['password']);

    if(isset(
    $submit)){

    if(
    $posted_username == $username && $posted_password == $password){
        echo 
    "Logged in";
        
    session_register("username");
        
    session_register("password");
    }
    else {
        echo 
    "Wrong username or password";
    }

    }

    ?>
    Any idea what might be the problem since I'm not using any global variables?

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    except post.. i think those are global...

    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #3
    New Coder
    Join Date
    Jun 2007
    Posts
    60
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by whizard View Post
    except post.. i think those are global...

    Dan
    Care to be a little more constructive?

  • #4
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    try adding this to the top:
    ini_set('session.bug_compat_42','0');

    Edit: btw, I wasn't being sarcastic in my first post...


    HTH
    Dan
    Last edited by whizard; 08-16-2007 at 11:57 PM.
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #5
    New Coder
    Join Date
    Jun 2007
    Posts
    60
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Nevermind and Thanks.

  • #6
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,049
    Thanks
    2
    Thanked 317 Times in 309 Posts
    Don't use session_register(). It is depreciated and only works when register_globals are on (and your code will stop working on PHP6.)

    There is a big caution about this in the php manual section for that function - http://php.net/session_register
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •