How to enable register_globals on a host that has disabled it.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Breana
    New Member
    • Aug 2007
    • 117

    How to enable register_globals on a host that has disabled it.

    OMG, my users cant login now since 5 days ago my free host turned off Register Globals and when i try to turn it on it says "server misconfiguratio n"

    How can i fix this.....
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    I would recommend re-writing the code that requires register_global s to be enabled. It is a security risk, which is most likely the reason it was disabled on your server, and having your code depend upon it is very very bad!

    If, however, you are willing to risk it, check out the extract() function, which can be used to extract the super-globals at runtime, much like the register_global s property does.

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      I've edited the title of this thread to make it a little clearer.
      Please avoid using words like 'help' in your thread titles, as they make it less appealing to the Experts, as well as our other members.

      Check out the What makes a Good Thread Title part of the Posting Guidelines for tips on how to make good thread titles.

      Moderator

      Comment

      • Breana
        New Member
        • Aug 2007
        • 117

        #4
        Ok but how?

        I would recommend re-writing the code that requires register_global s to be enabled. It is a security risk, which is most likely the reason it was disabled on your server, and having your code depend upon it is very very bad!
        How do i re-rite it? Or where do i start the register globals requirement was in the code before i started...

        [PHP]<?php
        session_start() ;
        $login = $_REQUEST['login'];
        $password = $_REQUEST['password'];
        $sql = "select * from users where login = '$login' and password = '" . sha1($password) . "'";
        $result = mysql_query($sq l ,$db);

        if ($myrow = mysql_fetch_arr ay($result)) {

        do {

        $uid = $myrow["userid"];
        $uname = $myrow["login"];

        } while ($myrow = mysql_fetch_arr ay($result));

        $loggedin = true;
        $upwd = $password;
        $msg = "<p align='center'> <font size='2' face='Arial'><b r />
        <b>Welcome back</b>, You will be redirected in <font color='#FF0000' >3</font> seconds!<br />
        <br />
        <img src='images/ajax_loading.gi f' alt='Loading' width='32' height='32' /><br />
        <br />
        Or <a href='index.php '>Click here</a> if you don't want to wait!</font></p>";
        session_registe r("loggedin") ;
        session_registe r("upwd");
        session_registe r("uid");
        session_registe r("uname");

        } else {
        $loggedin = false;
        $upwd = "";
        $uid = "";
        $uname = "";
        $msg = "<img src='images/invalid.gif' width='402' height='107' /><br /><b><font color='#FF0000' >Sorry,</font></b> that ID or Password is not valid.<br /><br /><br />If you have forgotten your password <a href='forgot.ph p'>Reset Password</a>. <br />If you are a new user you will need to <a href='newuser.p hp'>Create A New Account!</a>";


        }

        session_registe r("loggedin") ;
        session_registe r("upwd");
        session_registe r("uid");
        session_registe r("uname");

        ?>[/PHP]

        What do i need to change?

        Comment

        • Breana
          New Member
          • Aug 2007
          • 117

          #5
          * Bump Topic Anyone....

          Comment

          • FrEaKmAn
            New Member
            • Aug 2007
            • 46

            #6
            what about using .htaccess to reactivate them again?

            Comment

            • Breana
              New Member
              • Aug 2007
              • 117

              #7
              No i tried it, "Internal Server Error"

              Plus he said it is bad so i guess i need to make it better :)

              Comment

              • mwasif
                Recognized Expert Contributor
                • Jul 2006
                • 802

                #8
                Use the following code in .htaccess
                Code:
                php_flag register_globals on

                Comment

                • Breana
                  New Member
                  • Aug 2007
                  • 117

                  #9
                  Internal Server Error
                  The server encountered an internal error or misconfiguratio n and was unable to complete your request.

                  Please contact the server administrator, [removed] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

                  More information about this error may be available in the server error log.

                  Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
                  Last edited by pbmods; Sep 21 '07, 12:08 AM. Reason: Removed email

                  Comment

                  Working...