FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Error messages and php editing in a photo archive (fixed?)






Is this worth pursuing?
It should be easy to fix, here's how...
0%
 0%  [ 0 ]
It'll be difficult to fix, but less trouble in the end.
100%
 100%  [ 1 ]
You should get a whole new CMS rather than waste time in this hopless cause.
0%
 0%  [ 0 ]
Total Votes : 1

ocalhoun
So, I've installed this blog/photo gallery/forum software on my hosting account, and I've smoothed out the bugs that I'm capable of fixing, but I've got a big problem with the photo gallery.
After finally giving it permissions to all the files/folders it wanted, I expected it to work, but I just got a blank page with errors. Uh-oh.
The original error messages were:
Code:

Warning: parse_ini_file() has been disabled for security reasons in /home/ocalhoun/domains/onet.frih.net/public_html/walk/photo/includes/config.class.php on line 48

Warning: Invalid argument supplied for foreach() in /home/ocalhoun/domains/onet.frih.net/public_html/walk/photo/includes/config.class.php on line 51

Warning: parse_ini_file() has been disabled for security reasons in /home/ocalhoun/domains/onet.frih.net/public_html/walk/photo/includes/config.class.php on line 48

Warning: Invalid argument supplied for foreach() in /home/ocalhoun/domains/onet.frih.net/public_html/walk/photo/includes/config.class.php on line 51

Warning: singapore(includes/io_.class.php) [function.singapore]: failed to open stream: No such file or directory in /home/ocalhoun/domains/onet.frih.net/public_html/walk/photo/includes/singapore.class.php on line 176

Fatal error: singapore() [function.require]: Failed opening required 'includes/io_.class.php' (include_path='.:/usr/local/lib/php') in /home/ocalhoun/domains/onet.frih.net/public_html/walk/photo/includes/singapore.class.php on line 176

I noticed that while there was no io_.class.php, there was a io.class.php
So first I changed the name of the file, then tried the alternitive approach of editing the code to call for io.class.php instead:
Code:

    //require_once $basePath."includes/io_".$this->config->io_handler.".class.php"; //troubleshooting
   require_once $basePath."includes/io".$this->config->io_handler.".class.php"; //home-made line

Both had the same result:
Code:

<<warnings skipped to save space, but are identical to previous>>
Fatal error: Cannot instantiate non-existent class: sgio_ in /home/ocalhoun/domains/onet.frih.net/public_html/walk/photo/includes/singapore.class.php on line 180

So, I thought, perhaps the same superfluos underscore is the reason why I can't create sgIO_ class...
I change the code to create the sgIO class instead:
Code:

    $ioClassName = "sgIO".$this->config->io_handler; //edited: backup:    $ioClassName = "sgIO_".$this->config->io_handler

Now all the fatal error messages are gone (leaving the warnings), and I still only have a blank, white screen. I assume the warning messages have something to do with the blank screen (if they don't, I'm getting a new photo gallery that works, because that's too much troubleshooting for my tastes).
For a quick review, those warning messages are:
Code:


Warning: parse_ini_file() has been disabled for security reasons in /home/ocalhoun/domains/onet.frih.net/public_html/walk/photo/includes/config.class.php on line 48

Warning: Invalid argument supplied for foreach() in /home/ocalhoun/domains/onet.frih.net/public_html/walk/photo/includes/config.class.php on line 51

Warning: parse_ini_file() has been disabled for security reasons in /home/ocalhoun/domains/onet.frih.net/public_html/walk/photo/includes/config.class.php on line 48

Warning: Invalid argument supplied for foreach() in /home/ocalhoun/domains/onet.frih.net/public_html/walk/photo/includes/config.class.php on line 51


Any suggestions on how I could either change settings or change code to fix these warnings? (In other words, is there any way to relax the security problem just for that folder, or perhaps a way to rewrite the code to use different, non-security-violating functions?)
MrBlueSky
I didn't vote, because the option Maybe it isn't too hard to fix isn't available. Smile

Chances are the warnings are not too hard to fix, and as a result of that your script might work. Could you post config.class.php so we can see what might cause parse_ini_file() to fail? (It probably has something to do with frihosts-open_basedir settings)
ocalhoun
^ The code of config.class.php as requested:
Code:

<?php

/**
 * Config class.
 *
 * @author Tamlyn Rhodes <tam at zenology dot co dot uk>
 * @license http://opensource.org/licenses/gpl-license.php GNU General Public License
 * @copyright (c)2003-2005 Tamlyn Rhodes
 * @version $Id: config.class.php,v 1.8 2005/11/30 23:02:18 tamlyn Exp $
 */

/**
 * Reads configuration data from data/singapore.ini and stores the values
 * as properties of itself.
 *
 * @package singapore
 * @author Tamlyn Rhodes <tam at zenology dot co dot uk>
 * @copyright (c)2003, 2004 Tamlyn Rhodes
 */
class sgConfig
{

  /**
   * Implements the Singleton design pattern by always returning a reference
   * to the same sgConfig object. Use instead of 'new'.
   */
  function &getInstance()
  {
    static $instance;
    if(!is_object($instance))
      //note that the new config object is NOT assigned by reference as
      //references are not stored in static variables (don't ask me...)
      $instance = new sgConfig();
    return $instance;
  }
 
  /**
    * Parses an ini file for configuration directives and imports the values
    * into the current object overwriting any previous values.
    * @param string relative or absolute path to the ini file to load
    * @return boolean true on success; false otherwise
    */
   function loadConfig($configFilePath)
   {
     if(!file_exists($configFilePath)) return false;
    
     //get values from ini file
    $ini_values = parse_ini_file($configFilePath);

    //import values into object scope
    foreach($ini_values as $key => $value) $this->$key = $value;
 
    return true;
   }
}

?>

MrBlueSky
Hmm, strange. The warning suggests that parse_ini_file is disabled in php.ini. But it isn't. At least not on server 2. Do you have an account on server 1?
ocalhoun
^Nope, it's a server 2 account.
MrBlueSky
That's weird. I installed singapore on my account, following the given directions and it works ok:

http://www.mrbluesky.frih.net/test/singapore/

Did you change something or used non-standard directories?

-- edit --

By the way, it looks like your site is defaced..
ocalhoun
MrBlueSky wrote:


By the way, it looks like your site is defaced..


Er, I don't think it is; its still under construction.
(That's if you mean the www.onet.frih.net/walk url. What is the url of the page that looks defaced? (I've been hacked before, but everything looks like it should, though I haven't tested all of my sites, just the actively used ones.))

Also, the photo gallery has suddenly started working all on it's own!
Thank you for your help! (Or at least your attempts to help)
I do hate it when problems baffle me like this. I'll never know now when the gallery might go back to it's previous behavior, or how to fix it if it does.
MrBlueSky
ocalhoun wrote:


What is the url of the page that looks defaced?


http://www.onet.frih.net/

It says

Quote:


Cr1T1c4L HACKED YOUR SYSTEM

TheDefaced.ORG

...



Smile
Related topics
PHP Validation Class
I have a question about php configuration
NotePad Replacements
phpBB2 ERROR PLEASE HELP
Carl's Start-to-Finish Professional Website Tutorial
Fedora Core 5 Test 1 Review
PHP syntax
php upload issue
Error with PHP-Nuke 7.8
Error on php-nuke install, need assistance.
Hoe maak je een forum met phpBB 2.0 ???
Most Ridiculous Error Messages
Please can anyone help with a php script error/problem?
Error Messages
Reply to topic    Frihost Forum Index -> Scripting -> Website Software

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.