Jump to content


Photo

Where does this file come from?


  • Please log in to reply
4 replies to this topic

#1 scottybwoy

scottybwoy
  • Members
  • PipPipPip
  • Advanced Member
  • 532 posts
  • LocationUK

Posted 07 August 2006 - 08:53 AM

If you look at this error :

PHP Warning: require_once(C:/Inetpub/wwwrootC:/Inetpub/wwwroot/database/classes/class.Message.php) [function.require-once]: failed to open stream: Invalid argument in C:\Inetpub\wwwroot\database\scripts\home\home.php on line 5 PHP Fatal error: require_once() [function.require]: Failed opening required 'C:/Inetpub/wwwrootC:/Inetpub/wwwroot/database/classes/class.Message.php' (include_path=';C:/Inetpub/wwwrootC:/Inetpub/wwwroot/database/library/PEAR;C:/Inetpub/wwwrootC:/Inetpub/wwwroot/database/library/php;C:/Inetpub/wwwrootC:/Inetpub/wwwroot/database/classes;;C:/Inetpub/wwwroot/database/classes;.;c:\php\includes;c:\Inetpub\wwwroot\PEAR') in C:\Inetpub\wwwroot\database\scripts\home\home.php on line 5

You can see it omits a ';' between '/wwwroot''C:/Inetpub' but these are the only two ini_sets I have :
$PATH         = $PEAR_DIR . ';' . $PHPLIB_DIR . ';' . $CLASSES;
   ini_set( 'include_path', ';' . $PATH . ';' . ini_get('include_path'));
and :
$CLASSES          = $REL_APP_PATH . '/classes';

   ini_set( 'include_path', ';' . $CLASSES . ';' . ini_get('include_path'));
And have checked php.ini and all looks fine, where could this error be comming from, although the error is solved, why the missing ';' ?

#2 scottybwoy

scottybwoy
  • Members
  • PipPipPip
  • Advanced Member
  • 532 posts
  • LocationUK

Posted 07 August 2006 - 10:12 AM

Ok I still think there is something wrong with my addresses as now I get Document Moved : Please click here, but here refers to :

c:/Inetpub/wwwroot/databaseC:/Inetpub/wwwrootC:/Inetpub/wwwroot/database/scripts/login/login.php?url=http://my-server.my.local

The login.php is actually in /scripts/login/login.php  but I don't understand why it's passing this URL to the browser because it's not a valid address.

Ok I'm going to post my code for home.php can anybody see where login.php is being called, as I'm a newbie and don't understand it very well.

<?php

   require_once "home.conf.php";

   require_once $INTRANET_USER_CLASS;

   /* Session variables must be defined before session_start() method is called */
   
   class IntranetUserHomeApp extends PHPApplication {

   function run()
      {
          
          if (! $this->authorize($this->getSessionField('SESSION_USERNAME')))
          {
             $this->alert('UNAUTHORIZED_ACCESS');
          }

          $this->uid = $this->getUID();

          // At this point user is authorized
          $this->displayHome();
     }

      function authorize()
      {
          return TRUE;
      }

   /*
      function updateMsgTrack()
      {
         $mid = $this->getRequestField('mid');

         $msgObj = new Message($this->dbi);
         $msgObj->updateTrack($this->uid, $mid);
         return true;
      }
   */

      function displayHome()
      {
          global $HOME_MNGR;
          global $HOME_TEMPLATE;
          global $THEME_TEMPLATE, $INTRANET_DIR;
          global $THEME_TEMPLATE_DIR, $REL_TEMPLATE_DIR;
          global $REL_TEMPLATE_DIR, $INTRANET_DIR;
          global $PHOTO_DIR, $DEFAULT_PHOTO, $REL_PHOTO_DIR;

          $Template = Template($HOME_TEMPLATE_DIR);

          $themeTemplate->set_file('fh', $THEME_TEMPLATE[$this->theme]);
          $themeTemplate->set_block('fh', 'mmainBlock', 'mmblock');
          
          $photoFile = sprintf("%s/photo%003d.jpg",$PHOTO_DIR, $this->getUID());
          $photo = file_exists($photoFile) ? sprintf("%s/photo%003d.jpg",$REL_PHOTO_DIR,$this->getUID()) : sprintf("%s/%s",$REL_PHOTO_DIR,$DEFAULT_PHOTO);
          $themeTemplate->set_var('PHOTO', $photo);

          $themeTemplate->set_var('TEMPLATE_DIR', $REL_TEMPLATE_DIR);

          $themeTemplate->set_var('LEFT_NAVIGATION', $this->themeObj->getLeftNavigation($THEME_TEMPLATE_DIR . '/' . dirname($THEME_TEMPLATE[$this->theme])));

          $template = new Template($this->getTemplateDir());
          $template->set_file('fh1', $HOME_TEMPLATE);
          $template->set_block('fh1', 'mainBlock', 'mblock');
          $template->set_block('mainBlock', 'msgBlock', 'msg');
          
          $template->set_var('msg', null);

          $now = time();

          $template->set_var(array(
                                   'NAME'         => $this->getName(),
                                   'CURRENT_DATE' => date('l M d Y', $now),
                                   'HOME_MNGR'    => $HOME_MNGR
                                   )
                            );
          
          global $LD_CATEGORY_NAV_DIR, $LD_CATEGORY_NAV_OUTFILE;
          
          $fp = fopen($LD_CATEGORY_NAV_DIR.'/'.$LD_CATEGORY_NAV_OUTFILE, "rb");
          $contents = fread ($fp, filesize ($LD_CATEGORY_NAV_DIR.'/'.$LD_CATEGORY_NAV_OUTFILE));
          
          $template->set_var('LD_NAV', $contents);

    /*
          $msgObj = new Message($this->dbi);
          $msgArr = $msgObj->getMessages($this->uid);
          $this->dump_array($msgArr); */
          global $USER_DB_URL;
          $user_dbi = new DBI($USER_DB_URL);
          
          if (!empty($msgArr))
          {
            foreach($msgArr as $msg)
            {
            	//$this->dump_array($msg);
                if ($msgObj->isViewable($msg->MSG_ID, $this->getUID()))
                {
             	   
             	   $userObj = new User($user_dbi, $msg->AUTHOR_ID);
             	   $auth = $userObj->getEMAIL();             	   
             	   $template->set_var('MSG_DATE', date("M-d-Y",$msg->MSG_DATE));
             	   $template->set_var('MSG_ID', $msg->MSG_ID);
             	   $template->set_var('MSG_TITLE', $this->unhtmlentities(stripslashes($msg->MSG_TITLE)));
             	   $template->set_var('MSG_AUTHOR', $auth);
             	   $template->set_var('MSG_CONTENTS', $this->unhtmlentities(stripslashes($msg->MSG_CONTENTS)));
             	   $template->set_var('TABLE_BGCOLOR', $msg->MSG_TYPE ? ADMIN_MSG_COLOR : STANDARD_MSG_COLOR);
             	   $template->parse('msg', 'msgBlock', true);
             	}   
            }
          }
          else
          {
             $template->set_var('msg', null);
          }

          $thisUser = new IntranetUser($this->dbi, $this->uid);

          $pref = $thisUser->getPreferences($this->uid);

          session_register('SESSION_AUTO_TIP_SHOWN');

          if (!empty($pref['autotip']) && !($this->getSessionField('SESSION_AUTO_TIP_SHOWN')))
          {
          	 $this->debug("Show tip window");
          	 $_SESSION["SESSION_AUTO_TIP_SHOWN"] = 1;
          	 $template->set_var('JS_TIP_SCRIPT', $this->popAutoTip());
          } else {
          	 $template->set_var('JS_TIP_SCRIPT', null);
          }

          $themeTemplate->set_var('SERVER_NAME', $this->get_server());
          $themeTemplate->set_var('BASE_HREF', $REL_TEMPLATE_DIR);
          $template->set_var('USER_NAME', ucfirst($thisUser->getName()));

          $themeTemplate->set_var('CONTENT_BLOCK', $template->parse('mblock', 'mainBlock'));
          $themeTemplate->parse('cnblock', 'contentBlock');
          $themeTemplate->parse('mmblock', 'mmainBlock');
          $themeTemplate->pparse('output', 'fh');

      }
      
      function unhtmlentities ($string)
      {
	$trans_tbl = get_html_translation_table (HTML_ENTITIES);
	$trans_tbl = array_flip ($trans_tbl);
	return strtr ($string, $trans_tbl);
      }


      function getName()
      {
      	 list($name, $host) = explode('@', $this->getEMAIL());
      	 return ucfirst($name);
      }

      function popAutoTip()
      {
      	  global $TIP_SCRIPT;

          if (! file_exists($TIP_SCRIPT)) return null;

      	  $fp = fopen($TIP_SCRIPT, "r");
      	  if ($fp)
      	  {
      	  	 $contents = fread($fp, filesize($TIP_SCRIPT));
      	  }

      	  return $contents;
      }

   }//class

   global $INTRANET_DB_URL;

   $thisApp = new IntranetUserHomeApp(
                                      array( 'app_name'            => $APPLICATION_NAME,
                                             'app_version'         => '1.0.0',
                                             'app_type'            => 'WEB',
                                             'app_db_url'          => $INTRANET_DB_URL,
                                             'app_auto_connect'    => TRUE,
                                             'app_auto_chk_session' => TRUE,
                                             'app_auto_authorize'  => FALSE,
                                             'app_debugger'        => $OFF
                                           )
                                      );

   $thisApp->buffer_debugging();
   $thisApp->run();
   $thisApp->dump_debuginfo();
?>
Let me know if you need any more scripts to help work out my problem.

#3 scottybwoy

scottybwoy
  • Members
  • PipPipPip
  • Advanced Member
  • 532 posts
  • LocationUK

Posted 09 August 2006 - 09:08 AM

I still don't understand where login.php comes into this home.php?

I have got a bit closer into understanding that it just brings in different templates within the same page, but where does it request them.  home.php is scripted in the above post, here is what I have edited of the first function that I believe calls the login page :

<?
   function run()
      {
          if (! $this->authorize($this->getSessionField('SESSION_USERNAME')))
          {
             $this->alert('UNAUTHORIZED_ACCESS');
          }

          $this->uid = $this->getUID();

          // At this point user is authorized
          $this->displayHome();
     }

      function authorize()
      {
          return TRUE;
      }

?>

And here is the getSession function from class.PHPApplcation.php
<?
function getSessionField($field, $default = null)
    {
    	return (! empty($_SESSION[$field] )) ? $_SESSION[$field] : $default;
    }
    
?>

Please refer above for any more info, needing help desperately
Thanks in advance

#4 scottybwoy

scottybwoy
  • Members
  • PipPipPip
  • Advanced Member
  • 532 posts
  • LocationUK

Posted 09 August 2006 - 12:57 PM

These parts may also help.
In class.PHPApplication.php
<?php
class PHPApplication {

     function PHPApplication($param = null)
     {

        global $ON, $OFF, $TEMPLATE_DIR;

        global $MESSAGES, $DEFAULT_LANGUAGE,
               $REL_APP_PATH,
               $REL_TEMPLATE_DIR;

        // initialize application
        $this->app_name 	= $this->setDefault($param['app_name'], null);
        $this->app_version 	= $this->setDefault($param['app_version'], null);
        $this->app_type 	= $this->setDefault($param['app_type'], null);
        $this->app_db_url 	= $this->setDefault($param['app_db_url'], null);
        //$this->debug_mode	= $this->setDefault($param['app_debugger'], null);

        $this->auto_connect 	= $this->setDefault($param['app_auto_connect'], TRUE);
        $this->auto_chk_session	= $this->setDefault($param['app_auto_chk_session'], TRUE);
        $this->auto_authorize 	= $this->setDefault($param['app_auto_authorize'], TRUE);
        
        $this->session_ok       = $this->setDefault($param['app_auto_authorize'], FALSE);

        $this->error		= array();
        $this->authorized	= FALSE;
        $this->language         = $DEFAULT_LANGUAGE;
        $this->base_url         = sprintf("%s%s", $this->get_server(), $REL_TEMPLATE_DIR);
        $this->app_path         = $REL_APP_PATH;
        $this->template_dir	= $TEMPLATE_DIR;
        //$this->messages	        = $MESSAGES;

        // start session

        if (strstr($this->get_type(), 'WEB'))
        {

            session_start();

            $this->user_id          = (! empty($_SESSION["SESSION_USER_ID"]))  ? $_SESSION["SESSION_USER_ID"] : null;
            $this->user_name        = (! empty($_SESSION["SESSION_USERNAME"])) ? $_SESSION["SESSION_USERNAME"]: null;;
            $this->set_url();

            if ($this->auto_chk_session) $this->check_session();

            if (! empty($this->app_db_url) && $this->auto_connect && ! $this->connect())
            {
                $this->alert('APP_FAILED');

            }

            if ($this->auto_authorize && ! $this->authorize())
            {
               $this->alert('UNAUTHORIZED_ACCESS');
            }

        }
     }

     function getNAME()
     {
	 $domain_user = explode("\\", $_SERVER['LOGON_USER']);
	 $name = $domain_user[1];

	 list($name, $host) = $name;
         return ucwords($name);
     }

     function check_session()
     {

        if ($this->session_ok == TRUE)
        {
            return TRUE;
        }

        if (!empty($this->user_name))
        {

            $this->session_ok = TRUE;

        } else {

            $this->session_ok = FALSE;

            $this->reauthenticate();
        }

        return $this->session_ok;
     }

     function reauthenticate()
     {
         global $AUTHENTICATION_URL;                  
         header("Location: $AUTHENTICATION_URL?url=$this->self_url");         
         
     }

     function getBaseURL()
     {
        return $this->base_url;
     }
?>

This is only half of it, (ignore the missing "}'s" )but I think it's the important bit for locating what I want to know.
This is in config.inc.php

<?php

$ROOT_PATH     = $_SERVER['DOCUMENT_ROOT'];
$INTRANET_DIR = $ROOT_PATH . '/database';
$SCRIPTS = $ROOT_PATH . $INTRANET_DIR . '/scripts';
$AUTHENTICATION_URL   = $SCRIPTS . '/login/login.php';

?>

Thanks for looking

#5 scottybwoy

scottybwoy
  • Members
  • PipPipPip
  • Advanced Member
  • 532 posts
  • LocationUK

Posted 09 August 2006 - 01:49 PM

Ha HA! Sort of solved.  I have cured my error of the missing ; and all my addresses are finding the files they require.  What had happeded way my concatonated variables setting directory paths were double up because I set them wrong in the first place, sorry for your time.

Although I would still like someone to look over the code I have entered above to help me understand where my login script is being called.  Thanks in advance.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users