Base Path

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

kinggori
Forum Newbie
Posts: 11
Joined: Sun May 21, 2006 7:49 pm

Post by kinggori »

I get the error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/.interim/****/****.com/install/install.php on line 230

This is line 230:

Code: Select all

$err = "Base path " . $_POST['base_path'] " was not able to be opened...<br />";
Last edited by kinggori on Mon May 22, 2006 6:25 am, edited 1 time in total.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

It should be:

Code: Select all

$err = "Base path " . $_POST['base_path']  . " was not able to be opened...<br />";
\
(#10850)
kinggori
Forum Newbie
Posts: 11
Joined: Sun May 21, 2006 7:49 pm

Post by kinggori »

thanks christopher i changed that part and i can run install file



now when I fill in the form and click on Next Step I get at the top the errors:
Warning: readdir(): supplied argument is not a valid Directory resource in /home/.interim/****/****.com/install/install.php on line 232

Warning: closedir(): supplied argument is not a valid Directory resource in /home/.interim/****/****.com/install/install.php on line 236
Line 232 is:

Code: Select all

while ($file = readdir($handle)) {
Line 236 is:

Code: Select all

closedir($handle);
Last edited by kinggori on Mon May 22, 2006 6:26 am, edited 1 time in total.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Some line before line 232 should be:

Code: Select all

$handle = opendir('path/to/dir');
I should kindly and gently note that you should read the online PHP manual section for the Directory functions.
(#10850)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

opendir() is in there right before the area where he is having problems. His code is on the first page of this thread.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Then it really should be something like this for security and only pass the relative path from some absolute path you define:

Code: Select all

// check executable files inside base_path
  $dir = '/absolute/path/' . trim($HTTP_POST_VARS["base_path"], './');
  if ($handle = opendir($dir)) {
    while ($file = readdir($handle)) {
      echo $file . "...<br />";
      if ($file=="indexu_exe.idf") { $found_exe=true; }
    }
    closedir($handle); 
  } else {
    $err = "Base path " . $_POST['base_path']  " was not able to be opened...<br />";
  }
(#10850)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

The function we are looking at is part of an installer that came with an app the OP is trying to load. His problem is that the installer is asking for his Full URL and base path. But no matter what seems to be put into the installer, the installer is failing (returning the error that the file it is looking for is not in the root of the site) even though the OP stated that the file is there. The site that produced the app was not available when this thread got into the code of the installer, hence the reason for putting the installer code into this thread.

My thought would be to contact, if possible, the site that produced the app and ask the what the crap is going on. Short of that, I would make an attempt to retrieve a better error report from the installer as to why it can't find that one .idx file in the root folder.
kinggori
Forum Newbie
Posts: 11
Joined: Sun May 21, 2006 7:49 pm

Post by kinggori »

well thanks Everah and arborint for your help :)
I'll try finding out what the problem was from the script creators and I'll get back to you and let you know. The creators aren't very helpful though so if someone does figure out what the prob is please post it here.



Thank you for spending your precious time trying to help me out :D

btw. Everah I had a look at your blog and you have a great family :)

Cheers from the great white north :wink: and talk to you later guys
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

kinggori wrote:well thanks Everah and arborint for your help :) ...
btw. Everah I had a look at your blog and you have a great family :)
Your're welcome. I'm glad we were able to offer something to you. And thanks for the compliment on my family. They are the reason that I am a developer.

Don't hesitate to post back if the guys that gave you the app won't support it. I'm sure we can arrive at something to help you.
Post Reply