SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Dec 2003
    Location
    South Korea
    Posts
    232
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A big annoyance... plz help me...

    Here's the thing: my website which i coded using HTML/PHP, was running on a Linux host. However, just a few days ago, i switched hosts. Although this new host gave me more space, and more bandwidth and overall better performance, i have one problem: Its a Windows Host. Now, because of this, i just found out that ALL of my variables i used, have to be assigned because Windows php is well - "different". This is a BIG BIG BIG annoyance for me because this means that i hve to go through every single one of my coding to see which variables haven't been assigned and whatnot. When i try to view my webpage now, wherever there is a unassigned variable, i get an error: Notice: Undefined variable, and my page doens't look proper. Another thing is, my page uses alot of variables from the url kind of thing. By this i mean, if i had:
    PHP Code:
    <?php
    echo $id;
    ?>
    and my url was: http://domain.com/index.php?id=BLAH

    then it would display: BLAH on the screen. With this new Windows server, it just displays that the variable was unassigned. This again really angers me because this means i have to change EVERYTHING.

    So on to my actual question, Is there a way that i can automatically assign the variables, or maybe, is there a way in which i can "work around the system" and still display PHP as it was in Linux... Or maybe there are programs that do that kind of thing... ANY Help on this problem would be FULLY appreciated. Thank you.

  2. #2
    Now with customized title Jump's Avatar
    Join Date
    Sep 2002
    Location
    The Restaurant at The End of The Universe
    Posts
    1,423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If BLAH used to be assigned to your variable $blah automatically, then you had register globals set to on.

    Now it must be set to off. So you need to use $_GET['BLAH'] instead. Which is better by the way.

    THat would have nothing to do with windows, it's a php.ini thing.

  3. #3
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    If you have a config file you use in all the files, try putting this code into it
    PHP Code:
    extract($_REQUEST); 
    However that may open up some security holes. It has nothing to do with the fact that your new host is running Windows, it's to do with register_globals, search for it in the PHP documentation or Google it and you'll find out exactly what I'm talking about.

  4. #4
    SitePoint Addict
    Join Date
    Dec 2003
    Location
    South Korea
    Posts
    232
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm thanks for the help, but i don't really understand the solutions. The thing is, i dont have a config file i use in all my files. With the register_globals thing. I read up on it on PHP.net, and its default is OFF. This must be what my host has it on. How can i change this to ON? Also, how can i access the php.ini file to change this in this case? My host however, isn't really my own, but i think its shared. i have a resellers account, so i don't know how this works. Please, once again, any help would be appreciated.

    UPDATE: I contacted my host, and they turned the register_globals to ON, but the problem is still intact. Can anyone tell me what im doing wrong???

  5. #5
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Well then as I posted, a desperate solution would be to put the code I posted at the top of each file.


Bookmarks

Posting Permissions

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