Re: [PHP] Include Bug?
I get it... so instead I should use: include(/usr/home/sites/www.walkereffects.com/web/test/include.php) Thank you, Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED] On Friday, June 6, 2003, at 10:08 AM, Rasmus Lerdorf wrote: Uh, http://www.walkereffects.com/test/include.php is not a full path name, that is a URL. That will make an HTTP request to your web server for /test/include.php which will of course get parsed by PHP and you will only get the parsed output which means you won't see any variables or any PHP tags at all for that matter. This is doing exactly what you are asking it to do. -Rasmus On Fri, 6 Jun 2003, Steven Walker wrote: Hello, I have found troubling behavior using include() that looks like a bug. When I specify an include file by a full path name versus a relative path, PHP acts as though it has included the file, but variable and constant definitions in the include file are not coming through. My server is running PHP 4.3.1. Here is an example: I created a file called 'include.php', with the following contents: ? echo include.php opened br; //should print -only- if included, right? $testVar = test succeeded!; ? Then I created 'test.php', with the following contents: ? $testVar = not defined; //include.php should redefine this as 'test succeeded!' //include(http://www.walkereffects.com/test/include.php;); // full path include(include.php); // relative path echo $testVar; ? Using the relative path version of include outputs: include.php opened test succeeded! And using the full path results in: include.php opened not defined This doesn't seem right! Any ideas how I can work around this? Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Bug?
On Fri, Jun 06, 2003 at 10:19:10AM -0700, Steven Walker wrote: I get it... so instead I should use: include(/usr/home/sites/www.walkereffects.com/web/test/include.php) I would recommend using your .htaccess file, or ini_set, or something else to set your include_path variable to contain '/usr/home/sites/www.walkereffects.com/' or something like that. Your include() call can then just look like: ? include('web/test/include.php'); ? and it'll work from anywhere, regardless of where the file that's doing the including is located [1]. As a bonus, if you ever change hosts, or your host re-organizes its directory structure, and all of your includes rely on the include_path, simply re-set include_path, and your site works again. joel [1] Of course, the order of directories in your include_path matters, too. If it contains '.:/usr/home/sites/www.walkereffects.com/', then a file matching in the current working directory will take precedence over the one in your site root. So keep that in mind... -- [ joel boonstra | gospelcom.net ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Bug?
I would recommend using your .htaccess file, or ini_set, or something else to set your include_path variable Thanks Joel, that worked nicely. Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Question
Just a typo, but now I have other problems as well which I think have to do with paths and includes. If I am in the root directory on page main.html and click on a link that is in /other - because this is a restricted page I include main.html with an error (which right now doesn't display) - but now the paths are all screwed up. If I click on the same link again I get file not found. Hope I am explaining this right as this is really getting on my nerves. TIA - Original Message - From: James E Hicks III [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Sent: Thursday, March 27, 2003 4:15 PM Subject: RE: [PHP] Include Question If checklogin.php is only below, you shouldnn't get those errors. Anyway, is password just a typo below or does your code omit the $ too? if (!$name || !password) { $message = $enter_info; include (login.php); exit; } -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 4:07 PM To: James E Hicks III Subject: Re: [PHP] Include Question Because I would get the error - headers already sent etc. - Original Message - From: James E Hicks III [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Sent: Thursday, March 27, 2003 3:53 PM Subject: RE: [PHP] Include Question Why not try header(login.php) instead of include? James Hicks -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 3:47 PM To: PHP General Subject: [PHP] Include Question Hi, First, I fixed my other problem of the stack overflow by moving the files back to the root directory (although I would rather have them in a login directory). Anyway, I have a question regarding the include function. I have a login script in a file called login.php - in this file it includes checklogin.php and loginerrors.php. If the user inputs an incorrect login I assign $messages the appropriate error from loginerrors, then I re-include login.php where I want to show the error message, but no matter what I do the error message will not show up. Example. Login.php Enter your Name: Enter Your Password: if ($message) { echo $message; } Checklogin.php if (!$name || !password) { $message = $enter_info; include (login.php); exit; } Any help is appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include Question
If your include is located somewhere on the site you should refer to it as $_SERVER[DOCUMENT_ROOT]/pathtofile/filename.php so that your paths don't get messed up from chaning the includes etc. -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 2:28 PM To: James E Hicks III Cc: PHP General Subject: Re: [PHP] Include Question Just a typo, but now I have other problems as well which I think have to do with paths and includes. If I am in the root directory on page main.html and click on a link that is in /other - because this is a restricted page I include main.html with an error (which right now doesn't display) - but now the paths are all screwed up. If I click on the same link again I get file not found. Hope I am explaining this right as this is really getting on my nerves. TIA - Original Message - From: James E Hicks III [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Sent: Thursday, March 27, 2003 4:15 PM Subject: RE: [PHP] Include Question If checklogin.php is only below, you shouldnn't get those errors. Anyway, is password just a typo below or does your code omit the $ too? if (!$name || !password) { $message = $enter_info; include (login.php); exit; } -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 4:07 PM To: James E Hicks III Subject: Re: [PHP] Include Question Because I would get the error - headers already sent etc. - Original Message - From: James E Hicks III [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Sent: Thursday, March 27, 2003 3:53 PM Subject: RE: [PHP] Include Question Why not try header(login.php) instead of include? James Hicks -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 3:47 PM To: PHP General Subject: [PHP] Include Question Hi, First, I fixed my other problem of the stack overflow by moving the files back to the root directory (although I would rather have them in a login directory). Anyway, I have a question regarding the include function. I have a login script in a file called login.php - in this file it includes checklogin.php and loginerrors.php. If the user inputs an incorrect login I assign $messages the appropriate error from loginerrors, then I re-include login.php where I want to show the error message, but no matter what I do the error message will not show up. Example. Login.php Enter your Name: Enter Your Password: if ($message) { echo $message; } Checklogin.php if (!$name || !password) { $message = $enter_info; include (login.php); exit; } Any help is appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include() in included file
Hi Hubert, Check if there display_errors in your php.ini is set to Yes, and also take a look at your apache error log when you execute this page, probably you will see an error there. Best regards, Veniamin Goldin Interlogics, Inc. 15 2003 ., 12:34:35: HK Hello all! HK In index.php I include a file template.php using HK ?php HK // this is index.php file HK include('template.php'); ? HK Works fine. In template.php I'm using include function too HK ?php HK // this is template.php file HK echo 'before include'; HK include('header.php'); HK echo 'after include'; ? HK Works fine on all machines I installed it till now: Windows (NT, 98), Linux HK (some of them). But I installed it on FreeBSD and... surprise. When I call HK index.php, all I get is before include. No header.php content, no after HK include phrase. And there is no warning or error message. Has anybody got HK an idea what is wrong? Cheers, HK Hubi -- , Veniamin [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include dosn't after Provider-Change
You can't execute PHP from an HTML page. My guess is that your old provider had PHP parsing enabled for .html files, shich most don't. Oliver Witt wrote: Hallo, after a Provider-Change my counter-script dosn't work again. My entry is: ?php include (counter/rcounter.php) ; ? in an html-document. Is there an Error inside? My server show no error-messages... Thanx for Help. Olly -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include or function
On Fri, 2003-03-07 at 09:34, John Taylor-Johnston wrote: I have an *.inc with html, a rather long list of options. And you want to print out said list of OPTIONs several times with different ones selected each time? You could do it with an array and a function. The array would contain a list of keys and data (e.g. array (key = data)) where the keys would be the values for the option elements, and the data would be the labels (i.e. what's between the option start tag and end tag). The function would build the select by looping through the array and printing out the option elements. By comparing each key with a parameter you passed in to the function, it would know which option element to give the selected attribute to. Give it a try, and if you have any difficulty, look at: http://nikmakepeace.com/goodies/help/selectbuilder.php (.phps available) Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include files
At 01:34 26.02.2003, Kenneth Suralta said: [snip] How do I include external library files in PHP??? I would like to put the lines that are repeated in each php files, in a separate file. e.g. ?php $db_host = localhost; $db_port = 3306; $db_name = test; ... ? [snip] Haven't I heard that before? http://www.php.net/manual/en/function.include.php -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include files
if require is used to include the 'same file', say, twice that file will be loaded twice. This can of course cause errors (such as resulting from the redefinition of functions within this file). In contrast the require_once construct will only load a file 'once' irrespective of the number of times it is subsequently called to do so (thereby preventing such errors arising). I would imagine (but am not certain) that there may be a slight speed penalty in using require_once as opposed to require. David Jinky Otacan Cocalon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] the problem was solved by creating an include file and using using require() method i was just wondering what are the advantages and disadvantages of using require_once() instead of require()? thanx =) John W. Holmes wrote: How do I include external library files in PHP??? I would like to put the lines that are repeated in each php files, in a separate file. e.g. ?php $db_host = localhost; $db_port = 3306; $db_name = test; ... ? Just throw caution to the wind and try the include() function I'm not responsible for the consequences!!! Do not blame me if your file is included!! ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- Gravity can't be held responsible for people falling in love. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include files
How do I include external library files in PHP??? I would like to put the lines that are repeated in each php files, in a separate file. e.g. ?php $db_host = localhost; $db_port = 3306; $db_name = test; ... ? Just throw caution to the wind and try the include() function I'm not responsible for the consequences!!! Do not blame me if your file is included!! ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include files
How do I include external library files in PHP??? I would like to put the lines that are repeated in each php files, in a separate file. e.g. ?php $db_host = localhost; $db_port = 3306; $db_name = test; ... ? I find the include() function to be quite useful for including external files. Check out the relevant pages of the PHP Manual: www.php.net/include and www.php.net/include_once and www.php.net/require and www.php.net/require_once Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include files
Funny thing about online manuals. include() http://www.php.net/manual/en/function.include.php include_once() http://www.php.net/manual/en/function.include-once.php Please read: http://www.catb.org/~esr/faqs/smart-questions.html -Original Message- From: Kenneth Suralta [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 4:35 PM To: [EMAIL PROTECTED] Subject: [PHP] Include files How do I include external library files in PHP??? I would like to put the lines that are repeated in each php files, in a separate file. e.g. ?php $db_host = localhost; $db_port = 3306; $db_name = test; ... ? Kenneth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include files
the problem was solved by creating an include file and using using require() method i was just wondering what are the advantages and disadvantages of using require_once() instead of require()? thanx =) John W. Holmes wrote: How do I include external library files in PHP??? I would like to put the lines that are repeated in each php files, in a separate file. e.g. ?php $db_host = localhost; $db_port = 3306; $db_name = test; ... ? Just throw caution to the wind and try the include() function I'm not responsible for the consequences!!! Do not blame me if your file is included!! ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- Gravity can't be held responsible for people falling in love. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include
On Monday 24 February 2003 15:09, John Taylor-Johnston wrote: $_SERVER is outdated now isn't it? Read the docs please. This is one of the new 'super globals' and deprecates $HTTP_SERVER_VARS (or whatever it was called). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Tomorrow will be cancelled due to lack of interest. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include
On February 23, 2003 11:08 pm, John Taylor-Johnston wrote: Which variable should I use? _SERVER[HTTP_HOST] _SERVER[SERVER_NAME] HTTP_HOST Server_NAME Host Docs are your friend. or JUST TRY IT. leo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include
On Monday 24 February 2003 15:03, John Taylor-Johnston wrote: Hi, I have an index.html that I use on different URLs. Because of that, I want to create a causal reality. I want to if ?? = http://foo.ccl.flsh.usherb.ca/ include('./note.html'); if the URL is http://foo.ccl.flsh.usherb.ca/ but not if the URL is http://foo.compcanlit.ca/ What variable can I muster up to do this? print_r($_SERVER) to see what you can use. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Only adults have difficulty with childproof caps. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include
Which variable should I use? _SERVER[HTTP_HOST] _SERVER[SERVER_NAME] HTTP_HOST Server_NAME Host -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include
Jason, $_SERVER is outdated now isn't it? John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include() problems IGNORE PARENT
Never mind. Apparently I can't tell the difference between a capital and a lowercase B. time to crash methinks. leo On February 13, 2003 11:59 pm, Leo Spalteholz wrote: I just ran into a somewhat strange problem with an include failing. I have the following in my script: include(dirname(__FILE__)./LNScreens/LNScrMain.php); include(dirname(__FILE__)./LNDataBase/LNDataBase.php); The first file is included just fine, but the LNDataBase file fails (Failed opening for inclusion). My directory structure is: /LNDataBase LNDataBase.php /LNScreens LNScrMain.php index.php The file exists and it seems to be the exact same syntax as what I used to include the other file. What else could possibly be wrong? Thanks for any help, Leo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include today's date in a SQL statement?
Hi Brian, What would the SQL be to find a record where: start_date today = end_date ... WHERE start_date today AND today = end_date If you're asking how do I get today's date into an SQL statement, there are two ways: - use your DBMS's built-in function to get today's date - use PHP's date() function to format a timestamp as -MM-DD Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include today's date in a SQL statement?
Brian, $Today = // Date format that you use that can be compared to the date stored in the database. $Query = WHERE start_date $Today and end_date =$Today; I just showed the where statement of the query. You can add in any statement you want before that to select or manipulate data based on the results. Jonathan Pitcher Webmaster Capitol Federal Savings On Wednesday, February 5, 2003, at 09:14 AM, Brian Dunning wrote: What would the SQL be to find a record where: start_date today = end_date Thanks, - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include
On Tue, 4 Feb 2003, Bob Lockie wrote: I don't appear to be able to use this variable in an include directive because the variable is empty: include $_SERVER['DOCUMENT_ROOT'] Do I have the syntax incorrect? Please post the exact syntax as you did not as the above will provide a serious parse error. To test if a value exists, do: var_dump($_SERVER['DOCUMENT_ROOT']); Or phpinfo(). Now, going off a guess, try: include $_SERVER['DOCUMENT_ROOT'] . '/foo.php'; The following will NOT work in 4.3.0 as there is a bug when using the following syntax: echo $_SERVER['DOCUMENT_ROOT']; echo Er, $iam['inastringand'] buggy in 4.3.0; Note that the above gives a parse error in 4.2.3, a bogus E_NOTICE error in 4.3.0, and will work (no parse error) in 4.3.1. Now, the following always works: echo {$_SERVER['DOCUMENT_ROOT']}; echo So {$i['willalwayswork']} yeah!; Note: We are specifically talking about using arrays within strings where the array key is quoted. Regards, Philip P.s. Autoglobals, such a $_SERVER, became available in PHP in PHP 4.1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include
On 02/04/03 13:16 Philip Olson spoke thusly On Tue, 4 Feb 2003, Bob Lockie wrote: I don't appear to be able to use this variable in an include directive because the variable is empty: include $_SERVER['DOCUMENT_ROOT'] Do I have the syntax incorrect? Please post the exact syntax as you did not as the above will provide a serious parse error. include $_SERVER['DOCUMENT_ROOT']/visit_db.php; I am using 4.3.0, there is no release later. To test if a value exists, do: var_dump($_SERVER['DOCUMENT_ROOT']); Or phpinfo(). Now, going off a guess, try: include $_SERVER['DOCUMENT_ROOT'] . '/foo.php'; The following will NOT work in 4.3.0 as there is a bug when using the following syntax: echo $_SERVER['DOCUMENT_ROOT']; echo Er, $iam['inastringand'] buggy in 4.3.0; Note that the above gives a parse error in 4.2.3, a bogus E_NOTICE error in 4.3.0, and will work (no parse error) in 4.3.1. Now, the following always works: echo {$_SERVER['DOCUMENT_ROOT']}; echo So {$i['willalwayswork']} yeah!; Note: We are specifically talking about using arrays within strings where the array key is quoted. Regards, Philip P.s. Autoglobals, such a $_SERVER, became available in PHP in PHP 4.1.0 -- Sent from Mozilla and GNU/Linux. Powered by an AMD processor. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include
On Tue, 4 Feb 2003, Bob Lockie wrote: On 02/04/03 13:16 Philip Olson spoke thusly On Tue, 4 Feb 2003, Bob Lockie wrote: I don't appear to be able to use this variable in an include directive because the variable is empty: include $_SERVER['DOCUMENT_ROOT'] Do I have the syntax incorrect? Please post the exact syntax as you did not as the above will provide a serious parse error. include $_SERVER['DOCUMENT_ROOT']/visit_db.php; I am using 4.3.0, there is no release later. Then according to my post, this will not work and is affected by the mentioned bug. So, rewrite it. Regards, Philip To test if a value exists, do: var_dump($_SERVER['DOCUMENT_ROOT']); Or phpinfo(). Now, going off a guess, try: include $_SERVER['DOCUMENT_ROOT'] . '/foo.php'; The following will NOT work in 4.3.0 as there is a bug when using the following syntax: echo $_SERVER['DOCUMENT_ROOT']; echo Er, $iam['inastringand'] buggy in 4.3.0; Note that the above gives a parse error in 4.2.3, a bogus E_NOTICE error in 4.3.0, and will work (no parse error) in 4.3.1. Now, the following always works: echo {$_SERVER['DOCUMENT_ROOT']}; echo So {$i['willalwayswork']} yeah!; Note: We are specifically talking about using arrays within strings where the array key is quoted. Regards, Philip P.s. Autoglobals, such a $_SERVER, became available in PHP in PHP 4.1.0 -- Sent from Mozilla and GNU/Linux. Powered by an AMD processor. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include question
It would probably be best to include the absolute path to the images. so instead of: img src=file.gif use: img src='c:\project\htmls\file.gif' Is something like that possible? Otherwise at the very least you should use: img src='htmls\file.gif' HTH -Brad Ryan wrote: Hello all, I'm have a PHP script that works in a folder.. for the sake of clarity we'll call it c:\project In c:\project\htmls there are several HTML documents which refer to images in the project\htmls directory with tags like img src=file.gif In my PHP script in c:\project I include htmls/file.html and the HTML file renders alright from the script, but the image's path is c:\project\file.gif when the page is rendered, not c:\project\htmls\file.gif like it should be. Is there any way to change the working directory so when I include a file images are on the page, too? Thanks in advance! -- Ryan Cassin [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include question
No unfortunately something like that isn't possible... The HTML files are generated by a closed-source application. -Original Message- From: Brad Bonkoski [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 15, 2003 5:04 PM To: Ryan Cc: [EMAIL PROTECTED] Subject: Re: [PHP] include question It would probably be best to include the absolute path to the images. so instead of: img src=file.gif use: img src='c:\project\htmls\file.gif' Is something like that possible? Otherwise at the very least you should use: img src='htmls\file.gif' HTH -Brad Ryan wrote: Hello all, I'm have a PHP script that works in a folder.. for the sake of clarity we'll call it c:\project In c:\project\htmls there are several HTML documents which refer to images in the project\htmls directory with tags like img src=file.gif In my PHP script in c:\project I include htmls/file.html and the HTML file renders alright from the script, but the image's path is c:\project\file.gif when the page is rendered, not c:\project\htmls\file.gif like it should be. Is there any way to change the working directory so when I include a file images are on the page, too? Thanks in advance! -- Ryan Cassin [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include question
[EMAIL PROTECTED] (Brad Bonkoski) wrote: It would probably be best to include the absolute path to the images. so instead of: img src=file.gif use: img src='c:\project\htmls\file.gif' Is something like that possible? ??? forget this... this will only work on some browsers and as long as you keep the files exactly there. Otherwise at the very least you should use: img src='htmls\file.gif' img src=htmls/file.gif (slash instead of back slash). In c:\project\htmls there are several HTML documents which refer to images in the project\htmls directory with tags like img src=file.gif In my PHP script in c:\project I include htmls/file.html and the HTML file renders alright from the script, but the image's path is c:\project\file.gif when the page is rendered, not c:\project\htmls\file.gif like it should be. If you include a file into a php script like you do, the HTML-paths will be relative to that php script, not to the original HTML-file. PHP includes the file as is (imagine it puts the HTML code at the place of the include statement) The browser does not know that there is another HTML file, it only sees the output of the php script. Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include directory?
That depends on where you want to point it at :) In pear we always use something like : require_once 'Package/File.php' It's very usable to add the pear directory to php's include path, but only if you have it ;) Otherwhise, just don't think about that setting. Rad Craig wrote: Where should this point to? Mine points to c:\php4\pear and I dont' have a pear directory under \php4. Rad Craig -- When ipv6 and tcpa are there.. When this Palladium server wrecks.. I won't be able to drink my coffe then! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include/require vs performance
Is there, was there ever issue around including a lot files via include(). I am running things on a local server so it's hard to gauge. I don't understand that comment. includes/requires are always (well nearly anyway) local to the server regardless of where the request is coming from. So if you have a test box and it is fast enough for you, then go with it. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include/require vs performance
These files are parsed by the interpreter... They are not sent to the client, so I you are thinking bandwidth I dont see how it would affect it. Unless they all output a bunch of data. Of course there will be some overhead for PHP to interpret all that code. Mike *** REPLY SEPARATOR *** On 03/01/2003 at 8:25 AM Radek Zajkowski wrote: i am designing a small app that obviuosly works best when I have a lot of global files with functions, which cut down on editing. I will likely have a main page that will contain modules and also load all of the required includes like config etc. in total some 10 files will be reqested. Is there, was there ever issue around including a lot files via include(). I am running things on a local server so it's hard to gauge. Thansk in advance. R ___ Radoslaw Zajkowski http://www.finalbanana.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include/require vs performance
He likely ment that his local server is simply fast enough that any speed defference is unnoticeable, but on a shared host this might make some difference. Use include/require as you are more comfortable with it. Rasmus Lerdorf wrote: Is there, was there ever issue around including a lot files via include(). I am running things on a local server so it's hard to gauge. I don't understand that comment. includes/requires are always (well nearly anyway) local to the server regardless of where the request is coming from. So if you have a test box and it is fast enough for you, then go with it. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include/require vs performance
Sorry if this was not 100% clear. In a nutshell the app I'm making will be available for poeple to use. My feeling is that there will be users using shared servers, which under a stress tend to suck. The only thing in this one I'm doing that;s new to me is having some 20 includes loaded as I need them, sometimes up to 10 at a time, hence the concern. Thanks for all your responses, I got enough info to go on. ANother words, this should not be a problem. R http://sourceforge.net/projects/athena-research Is there, was there ever issue around including a lot files via include(). I am running things on a local server so it's hard to gauge. I don't understand that comment. includes/requires are always (well nearly anyway) local to the server regardless of where the request is coming from. So if you have a test box and it is fast enough for you, then go with it. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Radoslaw Zajkowski http://www.finalbanana.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include problem -- how to use an external 'template' file and still use PHP variables?
I have a similar question/problem. However, I want to use an external email template as it were, so that the sales guys can edit it as they like and simply shuffle the three variables around that they need $username, $password, $code (either with or without the ?php ? tags). I don't want them mucking around in my code and potentially screwing it up. Not to mention having a huge 'email' text in between those HTMLMESSAGE markers is ugly as hell and ends up making the color-coding in HomeSite all kinds of whack at the end of it. I tried to use: $message = HTMLMESSAGE include(/pathto/customer_email.php); HTMLMESSAGE; But $message has the literal string instead of including the file. Grr.. (wouldn't it make sence that an include() should be parsed FIRST with the contents put in place basically? This seems like a 'bug' not a feature. I also tried: $filename = /pathto/customer_email.php; $fd = fopen ($filename, r); $message = fread ($fd, filesize ($filename)); fclose ($fd); But all the $username, etc. are treated as literals and if I use ?=$username? in the customer_email.php the field is blank (like it's being parsed but doesn't have a value for it or something), instead of being converted to their actual PHP values. I also tried to put the global keyword in the customer_email.php file at the top. Is there no way to accomplish this? -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Use a here-doc: echo EOB br[$data] br $titulo br($user)br $intro br $texto brbr (comentarios=$contador)brbrhr size=1 width=90%br EOB; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include option and calling only part of a file.
I have one file with several sections of code which I have so far accessed using a good old fashioned - - if ($HTTP_GET_VARS['action'] == Update) - - however I now want to include this code within some other web pages, I thought I may be able to use the following code - - include(/modules.php?action=Update) - - however the code does not run. Hoping someone can help me out on a way to overcome this. I am running IIS 5, and PHP 4.2.3 When you include() a file, it has the same variable scope as the file it was included from. So, if you have the following code: $action = Update; include(modules.php); Then you can use $action in modules.php and it'll be set to Update. modules.php will have the same variables as the file that included it. I hope that helps... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include Problems
Isnt this supposed to be a friendly place where people who are having problem with PHP can ask questions without people like u throwing insults? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 12:47 PM To: Mike Bowers Subject: Re: [PHP] Include Problems Learn to quote GAMER - Original Message - From: Mike Bowers mailto:[EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, December 26, 2002 8:42 PM Subject: [PHP] Include Problems I have a file named header.php stored in the includes folder: Inside includes is anohter folder called editable. When I open my page for the first time (before it is cached) or after I edit my header file I get these errors: Warning: Failed opening 'editable/meta.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 52 Warning: Failed opening 'javascript.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 53 Warning: Failed opening 'editable/my_header.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 56 Is there any other command I can run iside my header.php file instead of include that will print the contents of the includes that the header has? Mike Bowers PlanetModz Gaming Network Webmaster [EMAIL PROTECTED] ViperWeb Hosting Server Manager [EMAIL PROTECTED] [EMAIL PROTECTED] All outgoing messages scanned for viruses using Norton AV 2002
Re: [PHP] Include Problems
Post the include statements from your header.php file. Mike Bowers wrote: Isnt this supposed to be a friendly place where people who are having problem with PHP can ask questions without people like u throwing insults? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 12:47 PM To: Mike Bowers Subject: Re: [PHP] Include Problems Learn to quote GAMER - Original Message - From: Mike Bowers mailto:[EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, December 26, 2002 8:42 PM Subject: [PHP] Include Problems I have a file named header.php stored in the includes folder: Inside includes is anohter folder called editable. When I open my page for the first time (before it is cached) or after I edit my header file I get these errors: Warning: Failed opening 'editable/meta.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 52 Warning: Failed opening 'javascript.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 53 Warning: Failed opening 'editable/my_header.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 56 Is there any other command I can run iside my header.php file instead of include that will print the contents of the includes that the header has? Mike Bowers PlanetModz Gaming Network Webmaster [EMAIL PROTECTED] ViperWeb Hosting Server Manager [EMAIL PROTECTED] [EMAIL PROTECTED] All outgoing messages scanned for viruses using Norton AV 2002 -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Problems
A couple of items which will help you get a better / friendlier response here. Don't send mail to the list in HTML format, and don't request a return reciept. HTH Mike Bowers wrote: Isnt this supposed to be a friendly place where people who are having problem with PHP can ask questions without people like u throwing insults? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 12:47 PM To: Mike Bowers Subject: Re: [PHP] Include Problems Learn to quote GAMER - Original Message - From: Mike Bowers mailto:[EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, December 26, 2002 8:42 PM Subject: [PHP] Include Problems I have a file named header.php stored in the includes folder: Inside includes is anohter folder called editable. When I open my page for the first time (before it is cached) or after I edit my header file I get these errors: Warning: Failed opening 'editable/meta.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 52 Warning: Failed opening 'javascript.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 53 Warning: Failed opening 'editable/my_header.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 56 Is there any other command I can run iside my header.php file instead of include that will print the contents of the includes that the header has? Mike Bowers PlanetModz Gaming Network Webmaster [EMAIL PROTECTED] ViperWeb Hosting Server Manager [EMAIL PROTECTED] [EMAIL PROTECTED] All outgoing messages scanned for viruses using Norton AV 2002 -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Problems
Mike Bowers wrote: I have a file named header.php stored in the includes folder: Inside includes is anohter folder called editable. When I open my page for the first time (before it is cached) or after I edit my header file I get these errors: *Warning*: Failed opening 'editable/meta.php' for inclusion (include_path='') in */home/groups/v/vw/vwportal/htdocs/includes/header.php* on line *52* Perhaps it is a permissions problem, after editing it (as whatever user you use to edit files), is the file readable by the user the webserver runs as? HTH Chris PS I'm sure it would be appreciated if you would be kind enough to post in plain text (not html), someone has to pay for archiving it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include Problems
It's not permissions. The files to be read as well as folders are all CHMOD 777 as I thought it was this originally. Thanks for your suggestion though. -Original Message- From: Chris Hewitt [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 1:11 PM To: Mike Bowers Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Include Problems Mike Bowers wrote: I have a file named header.php stored in the includes folder: Inside includes is anohter folder called editable. When I open my page for the first time (before it is cached) or after I edit my header file I get these errors: *Warning*: Failed opening 'editable/meta.php' for inclusion (include_path='') in */home/groups/v/vw/vwportal/htdocs/includes/header.php* on line *52* Perhaps it is a permissions problem, after editing it (as whatever user you use to edit files), is the file readable by the user the webserver runs as? HTH Chris PS I'm sure it would be appreciated if you would be kind enough to post in plain text (not html), someone has to pay for archiving it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Problems
You can try setting your include path in a .htaccess file in your web root, like this php_value include_path .:/path/to/include/directory Mike Bowers wrote: The includes are as follows: Include(editable/meta.php); Include(javascript.php); Include(editable/my_header.php); -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 12:58 PM To: Mike Bowers Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Include Problems Post the include statements from your header.php file. Mike Bowers wrote: Isnt this supposed to be a friendly place where people who are having problem with PHP can ask questions without people like u throwing insults? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 12:47 PM To: Mike Bowers Subject: Re: [PHP] Include Problems Learn to quote GAMER - Original Message - From: Mike Bowers mailto:[EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, December 26, 2002 8:42 PM Subject: [PHP] Include Problems I have a file named header.php stored in the includes folder: Inside includes is anohter folder called editable. When I open my page for the first time (before it is cached) or after I edit my header file I get these errors: Warning: Failed opening 'editable/meta.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 52 Warning: Failed opening 'javascript.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 53 Warning: Failed opening 'editable/my_header.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 56 Is there any other command I can run iside my header.php file instead of include that will print the contents of the includes that the header has? Mike Bowers PlanetModz Gaming Network Webmaster [EMAIL PROTECTED] ViperWeb Hosting Server Manager [EMAIL PROTECTED] [EMAIL PROTECTED] All outgoing messages scanned for viruses using Norton AV 2002 -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Problems
On Thu, 26 Dec 2002, Mike Bowers wrote: I have a file named header.php stored in the includes folder: Inside includes is anohter folder called editable. When I open my page for the first time (before it is cached) or after I edit my header file I get these errors: Warning: Failed opening 'editable/meta.php' for inclusion (include_path='') in Your include_path in php.ini is null, as indicated by the line above. What you're assuming will happen is that include will automatically look in the includes dir for files, so you have to set this: include_path=./includes I set mine: include_path = .:./:../:./include:../include g.luck, ~Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include Problems
This has worked. Thanks for your inout and help everybody. -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 1:13 PM To: Mike Bowers; [EMAIL PROTECTED] Subject: Re: [PHP] Include Problems You can try setting your include path in a .htaccess file in your web root, like this php_value include_path .:/path/to/include/directory Mike Bowers wrote: The includes are as follows: Include(editable/meta.php); Include(javascript.php); Include(editable/my_header.php); -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 12:58 PM To: Mike Bowers Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Include Problems Post the include statements from your header.php file. Mike Bowers wrote: Isnt this supposed to be a friendly place where people who are having problem with PHP can ask questions without people like u throwing insults? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 12:47 PM To: Mike Bowers Subject: Re: [PHP] Include Problems Learn to quote GAMER - Original Message - From: Mike Bowers mailto:[EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, December 26, 2002 8:42 PM Subject: [PHP] Include Problems I have a file named header.php stored in the includes folder: Inside includes is anohter folder called editable. When I open my page for the first time (before it is cached) or after I edit my header file I get these errors: Warning: Failed opening 'editable/meta.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 52 Warning: Failed opening 'javascript.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 53 Warning: Failed opening 'editable/my_header.php' for inclusion (include_path='') in /home/groups/v/vw/vwportal/htdocs/includes/header.php on line 56 Is there any other command I can run iside my header.php file instead of include that will print the contents of the includes that the header has? Mike Bowers PlanetModz Gaming Network Webmaster [EMAIL PROTECTED] ViperWeb Hosting Server Manager [EMAIL PROTECTED] [EMAIL PROTECTED] All outgoing messages scanned for viruses using Norton AV 2002 -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Problems
On Thursday 26 December 2002 12:06 pm, Mike Bowers wrote: It's not permissions. The files to be read as well as folders are all CHMOD 777 as I thought it was this originally. don't use 777. that makes the scripts writeable for everyone. any other user who can run scripts on that server can delete those scripts or replace them with something malicious. if any scripts on that server can be tricked into executing code as the webserver user (nobody, apache, www, whatever) then those files of yours can also be modified. you're probably just testing on a private server, in which case 777 is convenient (still a bad habit, but convenient). but remember to fix the permissions when you upload to a real server. better yet, switch to saner permissions even if only testing on a private server. *Warning*: Failed opening 'editable/meta.php' for inclusion (include_path='') in */home/groups/v/vw/vwportal/htdocs/includes/header.php* on line *52* looks like include_path in your php.ini is empty. if you have: ?php phpinfo(); ? what does the include_path section say? normally, you should have entries in there corresponding to directories where include files can be found. e.g., a good minimal include_path might be: include_path=.:..:/var/lib/www/standard_php_includes or something similar (i made up the last part, replace with wherever you put standard includes that you use). i like having the current directory and .. in there for obvious reasons. tiger -- Gerald Timothy Quimpo tiger*quimpo*org gquimpo*sni-inc.com tiger*sni*ph Public Key: gpg --keyserver pgp.mit.edu --recv-keys 672F4C78 Veritas liberabit vos. Doveryai no proveryai. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include problem
Use a here-doc: echo EOB br[$data] br $titulo br($user)br $intro br $texto brbr (comentarios=$contador)brbrhr size=1 width=90%br EOB; -Rasmus On Fri, 27 Dec 2002, Pag wrote: Hi, i am trying to make my work a little easier when editing the appearance of a news site i am building. As it is, everytime i want to change the looks of how each news appears, i have to edit inside the print(' '); which is annoying, because of the backslash with problem thing(when i need to have a inside a print, i need to put a \, you know), for example: i have: print(br[$data] br $titulo br($user)br $intro br $texto brbr (comentarios=$contador)brbrhr size=1 width=90%br); Cant i do something like having the code inside the print on an external file? so when i want to change something, i only edit that file, instead of dealing with the print itself, like this: [some command(s) that put the content of the external file looks.inc in variable $a] print ($a); I dont even know what to look for in the net. This problem is so i, later on, can code some sort of backend in the ways of greymatter, that people can change the looks of the news entries by themselves. Thanks. Pag -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include question
Variables don't get parsed in single quotes, use double quotes. RClark wrote: Hello all, I am passing a variable like so: a href=link.php?foo=bar.php On the link.php page, I have this simple code: ?php $job = $_GET['foo']; echo $job; // for error checking include 'path/to/$job'; ? The 'echo $job;' statement works just fine, but the outbout for the include statement looks like this: bar.php Warning: Failed opening 'scripts/$job' for inclusion (include_path='.:/usr/local/lib/php') in /usr/local/www/data-dist/link.php on line 142 Can I not use a $variable in an include 'something.php '; statement? Thanks in advance, Ron Clark -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include question
Hi, Friday, December 13, 2002, 12:07:05 AM, you wrote: R Hello all, R I am passing a variable like so: R a href=link.php?foo=bar.php R On the link.php page, I have this simple code: R ?php R $job = $_GET['foo']; R echo $job; // for error checking R include 'path/to/$job'; ? R The 'echo $job;' statement works just fine, but the outbout for the R include statement looks like this: R bar.php R Warning: Failed opening 'scripts/$job' for inclusion R (include_path='.:/usr/local/lib/php') in /usr/local/www/data-dist/link.php R on line 142 R Can I not use a $variable in an include 'something.php '; statement? R Thanks in advance, R Ron Clark You have to use double quotes like: include path/to/$job or add like this: include 'path/to/'.$job -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include question
Thanks! Works perfect with double quotes! RC -Original Message- From: Tom Rogers [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 12, 2002 8:21 AM To: Ronald Clark Cc: [EMAIL PROTECTED] Subject: Re: [PHP] include question Hi, Friday, December 13, 2002, 12:07:05 AM, you wrote: R Hello all, R I am passing a variable like so: R a href=link.php?foo=bar.php R On the link.php page, I have this simple code: R ?php R $job = $_GET['foo']; R echo $job; // for error checking R include 'path/to/$job'; ? R The 'echo $job;' statement works just fine, but the outbout for the R include statement looks like this: bar.php R Warning: Failed opening 'scripts/$job' for inclusion R (include_path='.:/usr/local/lib/php') in /usr/local/www/data-dist/link.php R on line 142 R Can I not use a $variable in an include 'something.php '; statement? R Thanks in advance, R Ron Clark You have to use double quotes like: include path/to/$job or add like this: include 'path/to/'.$job -- regards, Tom CONFIDENTIALITY NOTICE: The information contained in this ELECTRONIC MAIL transmission is confidential. It may also be privileged work product or proprietary information. This information is intended for the exclusive use of the addressee(s). If you are not the intended recipient, you are hereby notified that any use, disclosure, dissemination, distribution [other than to the addressee(s)], copying or taking of any action because of this information is strictly prohibited.
Re: [PHP] Include?
The passwd file is frequently world-readable so programs that rely on it don't need root permissions. Now if you can view /etc/shadow, then that would be a problem since that's where the actual passwords are stored (encrypted). On Thu, 2002-12-12 at 12:53, Shawn McKenzie wrote: It seems that if I create a php file in my dir at my hosting provider and do include('/etc/passwd'); then wow, I see the contents of etc/passwd! Is this expected behavior??? I am looking at creating a script that takes a var in the url and includes the requested file. The purpose would be for only URLs (myscript.php?page=http://mysite.com/dir/cool.html, or relative URLs (myscript.php?page=/dir/cool.html). Can I do this without allowing someone to include files by filesystem reference??? Thanks! Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Adam Voigt ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc signature.asc Description: This is a digitally signed message part
Re: [PHP] Include?
Shawn McKenzie wrote: Is this expected behavior??? Settings such as safe_mode come into play. There is a difference between what a webhost provider expects from someone trusted with an account, and what is expectd of a user of your website. The best advice I've heard is to assume a user of your site is a hacker who wants to bring your site down. ... (myscript.php?page=http://mysite.com/dir/cool.html, or relative URLs (myscript.php?page=/dir/cool.html). Can I do this without allowing someone to include files by filesystem reference??? ...so check and validate any user input. If you decide that it is not a good idea to allow a user to specify /etc/passwd (as all user names are stored there), then check and reject such things (commonly any absolute path). Regards Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include file with parameters
On Tuesday 12 November 2002 15:55, Fikret CAN wrote: hello PHP developers, I am going to convert a site that works with frames to the equivalent with includes. I have several template files whic behaves according to query string parameters. I don't want to make big changes, just make it work. ?php include(tmplt1.php?var1=val1var2=val2); ? Try this way: ?php $var1=val1; $var2=val2; include(tmplt1.php); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include file with parameters
On Tuesday 12 November 2002 15:55, Fikret CAN wrote: hello PHP developers, I am going to convert a site that works with frames to the equivalent with includes. I have several template files whic behaves according to query string parameters. I don't want to make big changes, just make it work. ?php include(tmplt1.php?var1=val1var2=val2); ? You don't need to pass vars to an include file. Whatever variables are available to the main script at the time of the include() are available to the included file. It's the same as copying that code into your main file at that point. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include: Warning: Failed opening
Warning: Failed opening '/common.php' for inclusion (include_path='.:/www/htdocs/php:/www/htdocs') in /www/htdocs/php/includetest.php on line 3 Take out the forward slash in your include. '/common.php' means to look in the root directory for the file, while if you just put 'common.php' or './common.php' it'll look in the same directory as includetest.php. Or, provide a full path to the file '/www/htdocs/php/common.php'. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include http
In order to use your PHP script (authentication features etc) you need to have the all files within the same server. As of including files, virtually - yes, yo can use include for remote files, but you will not be able to execute the remote PHP code. You will only include the output. ie: include('www.google.com'); includes you google's homepage, not the Terrabytes of their database access :) -- Maxim Maletsky [EMAIL PROTECTED] www.PHPBeginner.com // where PHP Begins Dan Healy [EMAIL PROTECTED] wrote... : Hi, I wrote a program to authenticate users. I would like to place a few lines at the top a webpage that would call this program. Some web pages will be on the same server as the authentication program, others will not. Can I use include/require of do I need to use fopen? The program returns true or false upon account validation, so I am not sure how I can use fopen I have tried the following so far and cannot get it to work ? php ini_set(include_path,http://myserver/scripts;); $foo=require(/ndsauth.php); if(!$foo) { exit; } ? Any suggestions would be appreciated Thanks Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include
You can include as many files as you want (or manage to), but you can declare functions only once. So include your files declaring functions using require_once(); Matias Silva wrote: This might sound like a dumb question but I just need verification so that I can convince myself that I'm going insane! I have this error in which I include 3 files (common_html.inc, common_db.inc, common_functions.inc) well I have a clean() function in the common_functions.inc file. But it seems that it is not getting called and then my script crashes. If I comment out the clean() function then it works. The clean() function is just for added security. Is there a maximum number of times you can include different files? -Matias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Include Help
On line 6, I have the list of musicians in the song. Example (ignore the quotes): Doyle Lawson -- lead vocal; Dale Perry - - bass vocal Is there a way to make it so that, when I include line 6 in my PHP template, the ; will be replaced with a line break so I get one musician per line in the HTML output? You could use str_replace on the line you've just read... http://www.php.net/str_replace Lines 7 and so on are the lyrics. The text file has one line per line (makes sense, right?) and a blank line between sections of the song. I have the script set up to read all the lines from 7 on, but it jumbles them all together, ignoring the line breaks. Is there a way to script PHP to add the line breaks, or should the line break HTML just be inserted everywhere needed in all my separate files? Use nl2br: http://www.php.net/nl2br This function replaces all \n (newlines) with BR\n (HTML break with newline) HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Part 2
Is this to pull the rows out of a database?? You could start with a simple example, which is just a basic config setting, and use the $myrow array in your sql while loop to do a lot of the work. ? // set your column names $colsToSelect = 'title, format, category'; // select $sql = SELECT {$colsToSelect} FROM tablename LIMIT 2; $result = mysql_query($sql); while($myrow = mysql_fetch_array($result)) { foreach($myrow as $key = $value) { echo {$key}: {$value}br /\n; } echo br /\n; } ? For the above query, this would echo something like: title: contents of titlebr / format: contents of format br / category: contents of category br / br / title: contents of titlebr / format: contents of format br / category: contents of category br / br / The next from there, to get more control over your rows might be an array with the columns you wish to query... Justin French on 29/09/02 4:06 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote: What I was wanting to do was store the myrows under let say, db_info.inc file. So that I can add or delete what myrows I want to call on. I am thinking this what I need to do... Function row ($row) { //These are the rows to call on... $title = $myrow[title]; $format = myrow[format]; $category =$myrow[category]; } This way I can add more myrow to call upon at a later date or delete for that matter. I hope that helps... Chuck On 9/29/02 1:48 AM, Justin French [EMAIL PROTECTED] wrote: Not sure I fully understand, but usually this stuff calls for either a function, or an included file of code... in your case, sounds like a function is required, but I may not fully understand... Regards, Justin on 29/09/02 3:29 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote: Ok, I am trying to make my design a lot easier. I want to know if I can do this... I want to set up in my php page this... $rows; Under my db_info.inc I want to store this so that I can add delete from it. $row = $title = myrow[title]; $format = myrow[format]; $category = myrow[category]; Am I wrong to try this way? Do I need to set it up as fuction to call on? Chuck Payne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Part 2
Chuck PUP Payne wrote: By the way I have time this but what is happen and maybe this will clear up things. That certainly made things clear. :-) I only calling this first myrow call titles. It's not going on to the other two. Now in my php page I have this... $myrow = mysql_fetch_array($result); $row; Now this doesn't work. No kidding. What is the line $row; supposed to do exactly? But this does. $myrow = mysql_fetch_array($result); $title = $myrow[title]; $format = $myrow[format]; $category =$myrow[category]; Yes, this looks better. You should place your array keys in quotes, such as $myrow[title]. I don't see how this relates at all to your example above. So want I wanted to do but I am see you can was to make $row be called from db_info.inc so that if lets say I wanted to add ratings I can add it to the db_info.inc. It's best to either include your code and reference file names or leave them out entirely. You sound like you assume we are looking at your screen and know what db_info.inc is. The reasoning for this is about 50 pages and I am getting tried of change each one I like to be able to change just one file. You know make it easier. Better design. I think you have the right idea. I really have no idea what the question is, but you should maybe consider the include() function to help you out. For example, you could have a script fetch_row.inc like this: $myrow = mysql_fetch_array($result); $title = $myrow[title]; $format = $myrow[format]; $category =$myrow[category]; Then every time you wanted to fetch a row from a result set consisting of these columns, you could just do this: include(/path/to/fetch_row.inc); Maybe that helps? I'm not really understanding what code you are repeating 50 times. Happy hacking. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include...
Chuck, It is likely that either: 1. That file does not exist. 2. PHP does not have read privileges on that file. Chris Chuck PUP Payne wrote: I am trying to start using inc files. But I am this this error Warning: Failed opening '/local/htdocs/movies/style.inc' for inclusion (include_path='.:/usr/share/php') in /local/htdocs/movies/lmenu.php on line 3 I have this in my lmenu.php Include (/local/htdocs/movies/style.inc); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Part 2
Not sure I fully understand, but usually this stuff calls for either a function, or an included file of code... in your case, sounds like a function is required, but I may not fully understand... Regards, Justin on 29/09/02 3:29 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote: Ok, I am trying to make my design a lot easier. I want to know if I can do this... I want to set up in my php page this... $rows; Under my db_info.inc I want to store this so that I can add delete from it. $row = $title = myrow[title]; $format = myrow[format]; $category = myrow[category]; Am I wrong to try this way? Do I need to set it up as fuction to call on? Chuck Payne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include...
Chuck \PUP\ Payne wrote: Hi, I am trying to start using inc files. But I am this this error Warning: Failed opening '/local/htdocs/movies/style.inc' for inclusion (include_path='.:/usr/share/php') in /local/htdocs/movies/lmenu.php on line 3 I have this in my lmenu.php Include (/local/htdocs/movies/style.inc); So can't someone telling me what I am doing wrong. I thought .inc where easy. Chuck Payne PHP gets lost a lot with regards to where it is. Try Include (style.inc); With what you have, assuming lmenu.php is in /local/htdocs/movies, it is likely looking for /local/htdocs/movies/local/htdocs/movies/style.inc It is finicky! John Hinton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include Part 2
-Original Message- From: Chuck PUP Payne [mailto:[EMAIL PROTECTED]] Sent: Sunday, September 29, 2002 1:29 AM To: PHP General Subject: [PHP] Include Part 2 Ok, I am trying to make my design a lot easier. I want to know if I can do this... I want to set up in my php page this... $rows; Under my db_info.inc I want to store this so that I can add delete from it. $row = $title = myrow[title]; $format = myrow[format]; $category = myrow[category]; Am I wrong to try this way? Do I need to set it up as fuction to call on? Yes, you are wrong. How wrong you are, I cannot tell, because I have no idea what you are saying... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Part 2
What I was wanting to do was store the myrows under let say, db_info.inc file. So that I can add or delete what myrows I want to call on. I am thinking this what I need to do... Function row ($row) { //These are the rows to call on... $title = $myrow[title]; $format = myrow[format]; $category =$myrow[category]; } This way I can add more myrow to call upon at a later date or delete for that matter. I hope that helps... Chuck On 9/29/02 1:48 AM, Justin French [EMAIL PROTECTED] wrote: Not sure I fully understand, but usually this stuff calls for either a function, or an included file of code... in your case, sounds like a function is required, but I may not fully understand... Regards, Justin on 29/09/02 3:29 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote: Ok, I am trying to make my design a lot easier. I want to know if I can do this... I want to set up in my php page this... $rows; Under my db_info.inc I want to store this so that I can add delete from it. $row = $title = myrow[title]; $format = myrow[format]; $category = myrow[category]; Am I wrong to try this way? Do I need to set it up as fuction to call on? Chuck Payne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Part 2
By the way I have time this but what is happen and maybe this will clear up things. I only calling this first myrow call titles. It's not going on to the other two. Now in my php page I have this... $myrow = mysql_fetch_array($result); $row; Now this doesn't work. But this does. $myrow = mysql_fetch_array($result); $title = $myrow[title]; $format = $myrow[format]; $category =$myrow[category]; So want I wanted to do but I am see you can was to make $row be called from db_info.inc so that if lets say I wanted to add ratings I can add it to the db_info.inc. The reasoning for this is about 50 pages and I am getting tried of change each one I like to be able to change just one file. You know make it easier. Better design. Sorry it 2:30am and Jolt cola is not working and I am LD. So sorry if this is not clear. Chuck Payne On 9/29/02 2:06 AM, Chuck PUP Payne [EMAIL PROTECTED] wrote: What I was wanting to do was store the myrows under let say, db_info.inc file. So that I can add or delete what myrows I want to call on. I am thinking this what I need to do... Function row ($row) { //These are the rows to call on... $title = $myrow[title]; $format = $myrow[format]; $category =$myrow[category]; } This way I can add more myrow to call upon at a later date or delete for that matter. I hope that helps... Chuck On 9/29/02 1:48 AM, Justin French [EMAIL PROTECTED] wrote: Not sure I fully understand, but usually this stuff calls for either a function, or an included file of code... in your case, sounds like a function is required, but I may not fully understand... Regards, Justin on 29/09/02 3:29 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote: Ok, I am trying to make my design a lot easier. I want to know if I can do this... I want to set up in my php page this... $rows; Under my db_info.inc I want to store this so that I can add delete from it. $row = $title = myrow[title]; $format = myrow[format]; $category = myrow[category]; Am I wrong to try this way? Do I need to set it up as fuction to call on? Chuck Payne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include() from another sub-domain
If these domains are on the same physical server, include them directly via the full filesystem path. If they are actually on different physical machines, you will need to configure those other machines to let you get the non-parsed PHP code through them. Your problam right now is that the site2.mydomain.com machine is executing the PHP and only giving you the parsed result. You need to configure Apache to not parse the file with PHP when requested by your script. -Rasmus On 19 Aug 2002, Greg Macek wrote: Hello, I've searched the list and the manual and am still a bit confused. Here's what I'd like to do. We have a bunch of internal sites that all use the same username/password. One is already setup with a function to authenticate this to a database. However, each login page is coming from a different sub-domain, such as site1.mydomain.com. The login functions resides in a PHP file on site2.mydomain.com. So it does this: ? // This page on site1.mydomain.com include (http://site2.mydomain.com/functions.php;); if (loginUser($username,$password)) { // do stuff here // redirect } else { ... } ? Right now my local script doesn't find the function I'm trying to use. What am I missing here? Is it not possible to include a php file (and its functions and variables) across domains? - Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include() from another sub-domain
Well, that would make sense. Now is this something I need to configure in the Apache or the PHP config file? On Mon, 2002-08-19 at 14:27, Rasmus Lerdorf wrote: If these domains are on the same physical server, include them directly via the full filesystem path. If they are actually on different physical machines, you will need to configure those other machines to let you get the non-parsed PHP code through them. Your problam right now is that the site2.mydomain.com machine is executing the PHP and only giving you the parsed result. You need to configure Apache to not parse the file with PHP when requested by your script. -Rasmus On 19 Aug 2002, Greg Macek wrote: Hello, I've searched the list and the manual and am still a bit confused. Here's what I'd like to do. We have a bunch of internal sites that all use the same username/password. One is already setup with a function to authenticate this to a database. However, each login page is coming from a different sub-domain, such as site1.mydomain.com. The login functions resides in a PHP file on site2.mydomain.com. So it does this: ? // This page on site1.mydomain.com include (http://site2.mydomain.com/functions.php;); if (loginUser($username,$password)) { // do stuff here // redirect } else { ... } ? Right now my local script doesn't find the function I'm trying to use. What am I missing here? Is it not possible to include a php file (and its functions and variables) across domains? - Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include() from another sub-domain
Apache On 19 Aug 2002, Greg Macek wrote: Well, that would make sense. Now is this something I need to configure in the Apache or the PHP config file? On Mon, 2002-08-19 at 14:27, Rasmus Lerdorf wrote: If these domains are on the same physical server, include them directly via the full filesystem path. If they are actually on different physical machines, you will need to configure those other machines to let you get the non-parsed PHP code through them. Your problam right now is that the site2.mydomain.com machine is executing the PHP and only giving you the parsed result. You need to configure Apache to not parse the file with PHP when requested by your script. -Rasmus On 19 Aug 2002, Greg Macek wrote: Hello, I've searched the list and the manual and am still a bit confused. Here's what I'd like to do. We have a bunch of internal sites that all use the same username/password. One is already setup with a function to authenticate this to a database. However, each login page is coming from a different sub-domain, such as site1.mydomain.com. The login functions resides in a PHP file on site2.mydomain.com. So it does this: ? // This page on site1.mydomain.com include (http://site2.mydomain.com/functions.php;); if (loginUser($username,$password)) { // do stuff here // redirect } else { ... } ? Right now my local script doesn't find the function I'm trying to use. What am I missing here? Is it not possible to include a php file (and its functions and variables) across domains? - Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include() from another sub-domain
What I would do is change the include filename to something like functions.inc like I do. This way the server won't try and run it for you. --- Brad Dameron Network Account Executive TSCNet Inc. www.tscnet.com Silverdale, WA. 1-888-8TSCNET -Original Message- From: Greg Macek [mailto:[EMAIL PROTECTED]] Sent: Monday, August 19, 2002 12:29 PM To: [EMAIL PROTECTED] Subject: [PHP] include() from another sub-domain Hello, I've searched the list and the manual and am still a bit confused. Here's what I'd like to do. We have a bunch of internal sites that all use the same username/password. One is already setup with a function to authenticate this to a database. However, each login page is coming from a different sub-domain, such as site1.mydomain.com. The login functions resides in a PHP file on site2.mydomain.com. So it does this: ? // This page on site1.mydomain.com include (http://site2.mydomain.com/functions.php;); if (loginUser($username,$password)) { // do stuff here // redirect } else { ... } ? Right now my local script doesn't find the function I'm trying to use. What am I missing here? Is it not possible to include a php file (and its functions and variables) across domains? - Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include opens source, but it shouldn't
[snip] why does include always opens my included file although it is defined as a variable Example: $file=include(/myfile/myfile.txt/); shouldn't it only be opend by typing echo $file; [/snip] The include() opens the file to place it in the variable, in other words include means READ INTO. Therfore $file=READ INTO THIS FILE(/myfile/myfile.txt/); HTH! Jay Im really easy to get along with, once you people learn to worship me *** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort Conference Center * * New Braunfels, Texas* * San Antonio Area PHP Developers Group * * Interested? Contact [EMAIL PROTECTED] * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include opens source, but it shouldn't
Can't you use a fopen('$file','r+'); or some like this instead? Otherwise, I don't use vars to store includes in. I always use constructs like this: include('/path-to-file/file-name.inc.php'); But what happens when you put a file via fopen() driektive into an array? - Will it be parsed later on? Schura - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: 'Harry.de' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, August 15, 2002 6:25 PM Subject: RE: [PHP] include opens source, but it shouldn't [snip] why does include always opens my included file although it is defined as a variable Example: $file=include(/myfile/myfile.txt/); shouldn't it only be opend by typing echo $file; [/snip] The include() opens the file to place it in the variable, in other words include means READ INTO. Therfore $file=READ INTO THIS FILE(/myfile/myfile.txt/); HTH! Jay I'm really easy to get along with, once you people learn to worship me *** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort Conference Center * * New Braunfels, Texas* * San Antonio Area PHP Developers Group * * Interested? Contact [EMAIL PROTECTED] * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include opens source, but it shouldn't
It will probably behave the same way include does, which is correct behavior. $file=include(whatever) is telling php to store the result from include in the $file variable, not storing a command in it. You could do $file='include()', and then you would wind up with a variable with whatever text you assigned to it. This is covered in the manual, Jason -Original Message- From: Sascha Braun [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 15, 2002 10:31 AM To: PHP Mailingliste; Jay Blanchard Subject: Re: [PHP] include opens source, but it shouldn't Can't you use a fopen('$file','r+'); or some like this instead? Otherwise, I don't use vars to store includes in. I always use constructs like this: include('/path-to-file/file-name.inc.php'); But what happens when you put a file via fopen() driektive into an array? - Will it be parsed later on? Schura - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: 'Harry.de' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, August 15, 2002 6:25 PM Subject: RE: [PHP] include opens source, but it shouldn't [snip] why does include always opens my included file although it is defined as a variable Example: $file=include(/myfile/myfile.txt/); shouldn't it only be opend by typing echo $file; [/snip] The include() opens the file to place it in the variable, in other words include means READ INTO. Therfore $file=READ INTO THIS FILE(/myfile/myfile.txt/); HTH! Jay I'm really easy to get along with, once you people learn to worship me *** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort Conference Center * * New Braunfels, Texas* * San Antonio Area PHP Developers Group * * Interested? Contact [EMAIL PROTECTED] * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include opens source, but it shouldn't
[snip] What is in the file? Do you have a print($file) or echo somewhere? Does the included file have print() or echo() in it? No, in the file is only html [/snip] There you go ... HTML will be parsed by the browser and displayed. So it is doing exactly what it is supposed to do. HTH! Jay Im really easy to get along with, once you people learn to worship me *** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort Conference Center * * New Braunfels, Texas* * San Antonio Area PHP Developers Group * * Interested? Contact [EMAIL PROTECTED] * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include opens source, but it shouldn't
[snip] [snip] What is in the file? Do you have a print($file) or echo somewhere? Does the included file have print() or echo() in it? No, in the file is only html [/snip] There you go ... HTML will be parsed by the browser and displayed. So it is doing exactly what it is supposed to do. [/snip] Are you wanting to place the file into the variable so that you can echo it out later? That is an extra step that you do not need. Just place the include() function where you want it to appear. HTH! Jay *** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort Conference Center * * New Braunfels, Texas* * San Antonio Area PHP Developers Group * * Interested? Contact [EMAIL PROTECTED] * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include opens source, but it shouldn't
[snip] Are you wanting to place the file into the variable so that you can echo it out later? That is an extra step that you do not need. Just place the include() function where you want it to appear. But what do if i want echo it out later - That's exactly what i want do [/snip] You mean more than once? Then do the include again... ?php some stuff here more stuff include(/myfile/myfile.txt/); more stuff other stuff this stuff include(/myfile/myfile.txt/); that stuff the other stuff ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include opens source, but it shouldn't
What happens to a javascript, which only is able to hold code snippets in one lined vars (if u understand what i mean); But my Content, comming from my Database (HTML) is longer than a javascript line. And I put it there for in an php variable? It will be the same, or? Schura (O;? - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: 'Jay Blanchard' [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, August 15, 2002 7:03 PM Subject: RE: [PHP] include opens source, but it shouldn't [snip] [snip] What is in the file? Do you have a print($file) or echo somewhere? Does the included file have print() or echo() in it? No, in the file is only html [/snip] There you go ... HTML will be parsed by the browser and displayed. So it is doing exactly what it is supposed to do. [/snip] Are you wanting to place the file into the variable so that you can echo it out later? That is an extra step that you do not need. Just place the include() function where you want it to appear. HTH! Jay *** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort Conference Center * * New Braunfels, Texas* * San Antonio Area PHP Developers Group * * Interested? Contact [EMAIL PROTECTED] * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include opens source, but it shouldn't
[snip] Only on demand. I'd like to define the variable without showing the file $var=include(); do something else echo $var; [/snip] Since the included file outputs headers you cannot do what it is you wish to do AFAIK. When I do includes, and having looked at other's code I can say that I am in good company, where HTML is involved and I need to use it again I just call another include() function. I do this for navigation items, footers, headers, and other odd items. Jay Im just working here till a good fast-food job opens up *** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort Conference Center * * New Braunfels, Texas* * San Antonio Area PHP Developers Group * * Interested? Contact [EMAIL PROTECTED] * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include opens source, but it shouldn't
From: Jay Blanchard [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 15, 2002 1:19 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] include opens source, but it shouldn't [snip] Only on demand. I'd like to define the variable without showing the file $var=include(); do something else echo $var; [/snip] Harold, is this what you're looking for: $var = readf('file.html'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include/require and the HTML Code
Maybe something wrong with the return? I was thinking about return What?. (U understand me?) in Javascript a simple return does nothing. maybe you can just leave the return out of your script. - Original Message - From: Mike Eales [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 14, 2002 10:44 AM Subject: [PHP] Include/require and the HTML Code Hi, Can anybody tell me why I get a Parse error: parse error, unexpected '}' in /usr/local/apache/htdocs/logbook/Functions.inc on line 17 for the following code: Appreciate any help. Using PHP 4.2.2 and Apache 1.3.26 on Redhat 7.3 x86 (The stuff is not part of the code. index.php and Functions.inc exists in the same dir) File: index.php ? require('./Functions.inc'); HtmlHeader(); # Do things HtmlFooter(); ? End of file File: Functions.inc function HtmlHeader() { ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN htmlhead meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 titleLogBook/title /head body bgcolor=#FF text=#00 link=#FF vlink=#80 alink=#FF ? return; } --- This is line 17, the error point.. function HtmlFooter() { ? /body /html ? return; } End of file Thanks Mike. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include/require and the HTML Code
Can anybody tell me why I get a Parse error: parse error, unexpected '}' in /usr/local/apache/htdocs/logbook/Functions.inc on line begin and end your include files with ? and ? ? function HtmlHeader() { ? bllaalla ? return; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include/require and the HTML Code
Mike, i had no problems with this.. !-- index.php -- ? include('Functions.inc'); HtmlHeader(); ? # Do things ? HtmlFooter(); ? !-- Functions.inc-- ? function HtmlHeader() { ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN htmlhead meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 titleLogBook/title /head body bgcolor=#FF text=#00 link=#FF vlink=#80 alink=#FF ? return; } ? ? function HtmlFooter() { ? /body /html ? return; } cheers Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include/require and the HTML Code
This did indeed fix the problem, thanks for the advise. A question though: Why is this necessary, the include/require is called from index.php while in PHP mode ? The functions work fine as if I remain in PHP mode within the functions. It is only when I go in and out of HTML mode within the function that this problem arises. Thanks again Mike. -Original Message- From: Bas Jobsen [mailto:[EMAIL PROTECTED]] Sent: Thursday, 15 August 2002 6:52 AM To: Mike Eales; [EMAIL PROTECTED] Subject: Re: [PHP] Include/require and the HTML Code Can anybody tell me why I get a Parse error: parse error, unexpected '}' in /usr/local/apache/htdocs/logbook/Functions.inc on line begin and end your include files with ? and ? ? function HtmlHeader() { ? bllaalla ? return; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include/require and the HTML Code
I'm not sure about others, but I am glad this behavior is like this. It is very nice for modules to stand on their own so to speak, so that you don't have to worry about what context they are used in. If the file you are including is plain HTML, would you want it to be parsed as if it were PHP? No, but if you had to include PHP in it (the closing ? for example), it wouldn't be a plain HTML file anymore. You might have other applications in different languages using the same module that would now have to interpret PHP. On the other hand, what about a PHP script that you want to include. Wouldn't it be annoying to get a parse error when you include it because of the double opening tags? Those are just a few thoughts. Happy hacking. Chris Michael Eales wrote: This did indeed fix the problem, thanks for the advise. A question though: Why is this necessary, the include/require is called from index.php while in PHP mode ? The functions work fine as if I remain in PHP mode within the functions. It is only when I go in and out of HTML mode within the function that this problem arises. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include require directive
On Tue, 2002-08-13 at 02:55, Huy wrote: But I do... If I left out the require statement all is well.. or I copy the whole content of the included file.. it works fine. The problem is the require statement. Check the file for whitespace, anything outside ?..?php or spaces/blank lines above your first ?php in any of your files. James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include require directive
Thanks, I thought I checked that already. Obviously, I use notepad in Win2000 to edit the files, and save them as Unicode file, which Notepad put some characters at the beginning of the file. Only when I use another editor was I able to see those strange characters. After deleting them, the require statement works fine. Again, thanks for the help. :) James Green [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Tue, 2002-08-13 at 02:55, Huy wrote: But I do... If I left out the require statement all is well.. or I copy the whole content of the included file.. it works fine. The problem is the require statement. Check the file for whitespace, anything outside ?..?php or spaces/blank lines above your first ?php in any of your files. James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include require directive
Huy, Use Editplus, or something similar, not Notepad. Costs $45 and makes your work *much* easier. Miles At 08:41 AM 8/13/2002 -0700, Huy wrote: Thanks, I thought I checked that already. Obviously, I use notepad in Win2000 to edit the files, and save them as Unicode file, which Notepad put some characters at the beginning of the file. Only when I use another editor was I able to see those strange characters. After deleting them, the require statement works fine. Again, thanks for the help. :) James Green [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Tue, 2002-08-13 at 02:55, Huy wrote: But I do... If I left out the require statement all is well.. or I copy the whole content of the included file.. it works fine. The problem is the require statement. Check the file for whitespace, anything outside ?..?php or spaces/blank lines above your first ?php in any of your files. James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include require directive
On Mon, 2002-08-12 at 22:14, Huy wrote: If I use either the include or require statement, PHP will generate some lines in the browser. For example, I want the first line is Hello There.. echo (Hello There); but the line happens to be the third line after some blank lines. So how do I turn that off?? http://uk.php.net/manual/en/function.include.php Enclose your included scripts in ?php ... ? James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include require directive
But I do... If I left out the require statement all is well.. or I copy the whole content of the included file.. it works fine. The problem is the require statement. James Green [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Mon, 2002-08-12 at 22:14, Huy wrote: If I use either the include or require statement, PHP will generate some lines in the browser. For example, I want the first line is Hello There.. echo (Hello There); but the line happens to be the third line after some blank lines. So how do I turn that off?? http://uk.php.net/manual/en/function.include.php Enclose your included scripts in ?php ... ? James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include php code as variable
http://www.php.net/eval - Original Message - From: Alawi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, August 03, 2002 11:41 AM Subject: [PHP] Include php code as variable How can I Include my php code code as variable and excute it ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include problems
include 'inc/test.inc' will work fine if you add your root directory to your include_path (in the c:\winnt\php.ini file). Daniel Kushner [EMAIL PROTECTED] Need hosting? http://www.TheHostingCompany.us/ -Original Message- From: Scott [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 03, 2002 3:11 PM To: [EMAIL PROTECTED] Subject: [PHP] Include problems I have PHP4 on both a windows IIS server and a windows apache server. The include function only works in the same directory of the file I wish to access. ex. www.include.com/default.php all files in same directory (i guess the root)? ?php include 'test.inc' ? everything works fine. Here's where I have the problem. Now I want to store all my includes in one directory www.include.com/inc ?php include 'inc/test.inc' ? that doesn't work Warning: Failed opening 'test.inc' for inclusion (include_path='') Can anyone help me with this??? Thanks scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include problems
Does this mean i have to do this to each site??? Daniel Kushner [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... include 'inc/test.inc' will work fine if you add your root directory to your include_path (in the c:\winnt\php.ini file). Daniel Kushner [EMAIL PROTECTED] Need hosting? http://www.TheHostingCompany.us/ -Original Message- From: Scott [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 03, 2002 3:11 PM To: [EMAIL PROTECTED] Subject: [PHP] Include problems I have PHP4 on both a windows IIS server and a windows apache server. The include function only works in the same directory of the file I wish to access. ex. www.include.com/default.php all files in same directory (i guess the root)? ?php include 'test.inc' ? everything works fine. Here's where I have the problem. Now I want to store all my includes in one directory www.include.com/inc ?php include 'inc/test.inc' ? that doesn't work Warning: Failed opening 'test.inc' for inclusion (include_path='') Can anyone help me with this??? Thanks scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include problems
does the require has something to be with include ? Cause instead of using include im always usin require Thanks, Flavio Bastos Amiel Scott [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Does this mean i have to do this to each site??? Daniel Kushner [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... include 'inc/test.inc' will work fine if you add your root directory to your include_path (in the c:\winnt\php.ini file). Daniel Kushner [EMAIL PROTECTED] Need hosting? http://www.TheHostingCompany.us/ -Original Message- From: Scott [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 03, 2002 3:11 PM To: [EMAIL PROTECTED] Subject: [PHP] Include problems I have PHP4 on both a windows IIS server and a windows apache server. The include function only works in the same directory of the file I wish to access. ex. www.include.com/default.php all files in same directory (i guess the root)? ?php include 'test.inc' ? everything works fine. Here's where I have the problem. Now I want to store all my includes in one directory www.include.com/inc ?php include 'inc/test.inc' ? that doesn't work Warning: Failed opening 'test.inc' for inclusion (include_path='') Can anyone help me with this??? Thanks scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include problems
Include and require are identical, except for their failure behavior - require() halts permanently ending execution of the script. Sincerely, Maxim Maletsky PHP Beginner www.phpbeginner.com -Original Message- From: ::: Flavio Bastos Amiel:: [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 04, 2002 12:53 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Include problems does the require has something to be with include ? Cause instead of using include im always usin require Thanks, Flavio Bastos Amiel Scott [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Does this mean i have to do this to each site??? Daniel Kushner [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... include 'inc/test.inc' will work fine if you add your root directory to your include_path (in the c:\winnt\php.ini file). Daniel Kushner [EMAIL PROTECTED] Need hosting? http://www.TheHostingCompany.us/ -Original Message- From: Scott [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 03, 2002 3:11 PM To: [EMAIL PROTECTED] Subject: [PHP] Include problems I have PHP4 on both a windows IIS server and a windows apache server. The include function only works in the same directory of the file I wish to access. ex. www.include.com/default.php all files in same directory (i guess the root)? ?php include 'test.inc' ? everything works fine. Here's where I have the problem. Now I want to store all my includes in one directory www.include.com/inc ?php include 'inc/test.inc' ? that doesn't work Warning: Failed opening 'test.inc' for inclusion (include_path='') Can anyone help me with this??? Thanks scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include problems
Thanks Maxim, it is good to know! :) Flavio Bastos Amiel Maxim Maletsky [EMAIL PROTECTED] wrote in message 000401c23b48$55266960$1113fe17@dominanta">news:000401c23b48$55266960$1113fe17@dominanta... Include and require are identical, except for their failure behavior - require() halts permanently ending execution of the script. Sincerely, Maxim Maletsky PHP Beginner www.phpbeginner.com -Original Message- From: ::: Flavio Bastos Amiel:: [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 04, 2002 12:53 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Include problems does the require has something to be with include ? Cause instead of using include im always usin require Thanks, Flavio Bastos Amiel Scott [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Does this mean i have to do this to each site??? Daniel Kushner [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... include 'inc/test.inc' will work fine if you add your root directory to your include_path (in the c:\winnt\php.ini file). Daniel Kushner [EMAIL PROTECTED] Need hosting? http://www.TheHostingCompany.us/ -Original Message- From: Scott [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 03, 2002 3:11 PM To: [EMAIL PROTECTED] Subject: [PHP] Include problems I have PHP4 on both a windows IIS server and a windows apache server. The include function only works in the same directory of the file I wish to access. ex. www.include.com/default.php all files in same directory (i guess the root)? ?php include 'test.inc' ? everything works fine. Here's where I have the problem. Now I want to store all my includes in one directory www.include.com/inc ?php include 'inc/test.inc' ? that doesn't work Warning: Failed opening 'test.inc' for inclusion (include_path='') Can anyone help me with this??? Thanks scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include hassle
On Friday 02 August 2002 10:02 am, lallous wrote: I have this: //file1.php ? include('../libs/lib1.php'); ? now lib1.php: ? include ('helper.php'); ? If i run file1.php -includes lib1.php - fails to include helper.php ! ! how can i solve that? We need more information that this. What's the error message? what do you mean fails? In anycase, you should be able to run lib1.php first without error, before trying file1.php. If the former causes error, resolve that first. rdb p.s: currently, i'm chdir()ing to the ../libs path, then i return to current dir... my code cannot make use of Apache's help. (like setting the include path inside .htaccess) thank you, Elias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include hassle
I mean this: i have this tree: ./libs/*.php ./user/file1.php now i'm in ./user/ directory i run file1.php it includes ../libs/lib1.php which in turn will include helper.php (./users/helper.php) -- will fail! how can i programmatically set the include path? Elias Reuben D. Budiardja [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Friday 02 August 2002 10:02 am, lallous wrote: I have this: //file1.php ? include('../libs/lib1.php'); ? now lib1.php: ? include ('helper.php'); ? If i run file1.php -includes lib1.php - fails to include helper.php ! ! how can i solve that? We need more information that this. What's the error message? what do you mean fails? In anycase, you should be able to run lib1.php first without error, before trying file1.php. If the former causes error, resolve that first. rdb p.s: currently, i'm chdir()ing to the ../libs path, then i return to current dir... my code cannot make use of Apache's help. (like setting the include path inside .htaccess) thank you, Elias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include hassle
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Lallous) wrote: how can i programmatically set the include path? http://php.net/ini-set -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include hassle
On Friday 02 August 2002 10:41 am, lallous wrote: I mean this: i have this tree: ./libs/*.php ./user/file1.php now i'm in ./user/ directory i run file1.php it includes ../libs/lib1.php which in turn will include helper.php (./users/helper.php) -- will fail! how can i programmatically set the include path? Elias - You can use an absolute path. - You can also specified all the includes path that will be find by php automatically in your php.ini. You might want to specify your /libs directory there, if you're including a lot of files from that directory. Either or both should work Rdb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include()
If you run your own server, you can set it up so that each webmaster is locked into a private environment, but it's messy. According to me, you would need a separate copy of apache for each site, each running under a different user, and they would need to run on separate ports, which is a nuisance. It's called SuEXEC in Apache and compiled in the core of Apache, it's not a module. What it does, it allows Apache to use the Group and User directives inside virtual hosts. For example: VirtualHost whatever DocumentRoot /blah User cust001 Group cust001 /VirutalHost In this case, all files in /blah would be owned by cust001:cust001 and permissions as strict as 0600 can be given on the files in the directory. Apache's processes serving requests on this virutal host, will drop permissions to user and group cust001 as specified in the configuration, so apache would have access to read it. In other virtualhosts, either the default user / group is used, or they are specified uniquely in a per-virtualhost basis. The other virtual hosts will thus run with different uid/gid meaning that other virtualhosts will not be able to include code in other virtualhosts, even when they know the paths. Because Apache drop permissions to the user/group specified, they will not have access to read/write/execute the included filename in a different virtualhost. -- me -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include()
Other users on the same server *shouldn't* be able to include() in this way How? Would their $_SERVER['HTTP_HOST'] not be the same? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include()
I suppose include() can be used to include files from remote systems(not on WINDOWS). Only if the sysadmin running your web server allows it, which they should not. A webmaster on the same server can always use a path like /home/htdocs/.../config.php and include my config .php which contains my database password !! Not quite, but if you are on a shared server hosted by somebody else, there is a potential problem. If somebody can figure out the name of the function that opens the database, they could call it, potemtially giving access to the data. You could use the solution posted by Justin French to make sure that the function does nothing for them when they call it. As other people have said, your hosting organisation should set the system up so that nobody can read your PHP code, and that nobody outside the host computer can include it. However, I think it would be difficult for them to stop another user on the same server including your code. If you run your own server, you can set it up so that each webmaster is locked into a private environment, but it's messy. According to me, you would need a separate copy of apache for each site, each running under a different user, and they would need to run on separate ports, which is a nuisance. Simon Ritchie Download my introduction to PHP for $25: http://merrowinternet.com/downloads?source=ml -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php