Welcome to Geeklog, Anonymous Tuesday, November 28 2023 @ 06:31 pm EST

Geeklog Forums

Work around to register_globals and stories?


jfade

Anonymous
Hi everyone. I just moved to a new host and when I went to install geeklog, I was greeted by a message saying that register_globals needed to be on. Well, I couldn't enable it since I'm on shared hosting, so I installed anyway. The first problem I had was not being able to log in through the admin/moderation link. I found a way around by logging in through users.php. Once I was in I clicked on the stories section to make a new story and it wouldn't load. I tried loading it in a new window and that didn't work either. Then I tried clicking the edit link and it worked. I was able to edit and existing story. But I still wasn't able to make a new one. However, I later found by going to story.php?mode=edit I was able to make a new story. It seems to be the listing of the stories that's causing the problem. I contacted my host asking if they could enable register_globals, but they said they wouldn't for security reasons and gave me this snippet of code.
Text Formatted Code

<?php
// Emulate register_globals on
if (!ini_get('register_globals')) {
   $superglobals = array($_SERVER, $_ENV,
       $_FILES, $_COOKIE, $_POST, $_GET);
   if (isset($_SESSION)) {
       array_unshift($superglobals, $_SESSION);
   }
   foreach ($superglobals as $superglobal) {
       extract($superglobal, EXTR_SKIP);
   }
   ini_set('register_globals', true);
}
?>

 

I put this in the moderation.php file and I was now able to log in like normal in the admin section instead of using the users.php workaround. But even though I inserted this code into just about every php file I could find related to story.php, I still can't get a story list to come up, but it's a minor thing since I can edit existing ones by clicking the edit link in an existing story and by using the link to make a new one, but it's still something I'd like to fix, since everything else works fine. Any ideas anyone? Thanks in advance! Smile
 Quote

mach

Anonymous

why not have that bit of code execute at the beginning of lib-common.php, which is included on every page anyway. just an idea.
 Quote

Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
Why hacking Geeklog's files when can just use
htaccess?
 Quote

Status: offline

vinny

Site Admin
Admin
Registered: 06/24/02
Posts: 352
Location:Colorado, USA
That's funny. The code they gave you does the exact same thing as what happens when register globals is enabled. Hosting companies seem, in general, to be a little "funny" (and not "ha ha" funny, but "uh oh" funny).

Putting that snippet of code at the start of lib-common.php or else at the end of config.php would work just find (and you wouldn't have to edit 100s of php files).

The htaccess work around LWC linked to may not work for you depending on how the hosting company set things up (and from their response to you, I'm betting it probably will not work).

-Vinny
 Quote

jfade

Anonymous
Thanks for your replies everyone, I'll try the htaccess file tomorrow when I have a bit more time. Smile I did insert that code in lib-common and config, but it's still not listing properly. : But I will try some other files and see what happens and let you know. Smile Thanks again for the help! Very Happy
 Quote

goodwebhost

Anonymous
Quote by vinny: That's funny. The code they gave you does the exact same thing as what happens when register globals is enabled. Hosting companies seem, in general, to be a little "funny" (and not "ha ha" funny, but "uh oh" funny).

Putting that snippet of code at the start of lib-common.php or else at the end of config.php would work just find (and you wouldn't have to edit 100s of php files).

The htaccess work around LWC linked to may not work for you depending on how the hosting company set things up (and from their response to you, I'm betting it probably will not work).

-Vinny


probably that way bad injections can be somewhat prevented .

Also is the fact that not all the clients will be using these snippet as all other messageboards and cms now work with reg glob off

so far as how funny the hosting companies are - they are just abiding by what php.net says and what recoomendations are there in the php.ini file
 Quote

jfade

Anonymous
Sorry for taking so long to get back to you on the htaccess file, but it didn't work, nor did the code the host gave me, I still can't get to the story list, and it seems to have gotten worse as I can't edit stories normally via the link anymore, I have to use the SQL editor instead. Sad Is there something else that could be causing the problems, or is there any other code I could use to help? Thanks in advance! Smile
 Quote

All times are EST. The time is now 06:31 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content