Re: [PHP] require() causing strange characters ?

2009-02-05 Thread Paul M Foster
On Fri, Feb 06, 2009 at 06:34:41AM +0100, cr.vege...@gmail.com wrote:

 Hi all,
 
 I have a script called test.php:
 ?php echo C; require(echo.php); echo D; ?
 
 and a script called echo.php:
 ?php echo test; ?
 
 With IE and Firefox it shows: CtestD
 but when I view the source, it seems to be: C??testD
 
 When debugging it, it seems that:
  C???testD   has length 9 in stead of 6
  pos1  has char=C ord=67 
  pos2  has char=??? ord=239 
  pos3  has char=??? ord=187 
  pos4  has char=??? ord=191 
  rest okay ...
 
 Any idea what's causing this and how to solve it ?

I don't know about the odd characters. You might try include() instead
of require() and see if the behavior changes.

I've noticed that Apache tends to insert an unpredictable number of
spaces in code when PHP is embedded in the HTML. My best guess is that
Apache substitutes blanks for all the non-printing PHP code in the file.
But that's just a guess.

How exactly are you managing to obtain the page in such a way that you
can test character codes and such?

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Require error

2008-12-20 Thread Jochem Maas
sean greenslade schreef:
 So, I have this code in a php file called testing.php:
 $incl = '/webs/www.zootboy.com/sl/sql.inc';
  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
 exist??!?');
  require $incl or die('MySQL page not found. Unable to continue.');
 

your require line is doing this:

require ($incl or die(foo);

the expression results in 1 which translates to the string 1
which require then tries to include.

do something like:

if (!require $incl)
die(foo);

although you might consider just doing

require $incl;

and removing the is_readable() check, die()s, etc ... the script
will die anyway if the require failed.

 
 When I run the code in command line, it outputs this:
 
 [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
 PHP Warning:  require(1): failed to open stream: No such file or directory
 in /webs/www.zootboy.com/sl/testing.php on line 13
 PHP Fatal error:  require(): Failed opening required '1'
 (include_path='/var/php/inc/') in /webs/www.zootboy.com/sl/testing.php on
 line 13
 
 I have no idea what's going on. All the files have 777 perms.
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Require error

2008-12-20 Thread Jochem Maas
Wolf schreef:
  Kyle Terry k...@kyleterry.com wrote: 
 On Fri, Dec 19, 2008 at 9:43 AM, Wolf lonew...@nc.rr.com wrote:

 Bottom Post

  sean greenslade zootboys...@gmail.com wrote:
 No. The file is called testing.php and it is trying to include sql.inc

 On Fri, Dec 19, 2008 at 12:36 PM, Kyle Terry k...@kyleterry.com wrote:


 On Fri, Dec 19, 2008 at 9:28 AM, sean greenslade 
 zootboys...@gmail.comwrote:
 So, I have this code in a php file called testing.php:
 $incl = '/webs/www.zootboy.com/sl/sql.inc';
  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
 exist??!?');
  require $incl or die('MySQL page not found. Unable to continue.');


 When I run the code in command line, it outputs this:

 [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
 PHP Warning:  require(1): failed to open stream: No such file or
 directory
 in /webs/www.zootboy.com/sl/testing.php on line 13
 PHP Fatal error:  require(): Failed opening required '1'
 (include_path='/var/php/inc/') in /webs/
 www.zootboy.com/sl/testing.php on
 line 13

 I have no idea what's going on. All the files have 777 perms.

 --
 --Zootboy

 Are you trying to require itself?
 Change your line to:
 require('$incl') or die('File not found');

 Require can be dork about things like this, I normally wind up handling to
 fiddle with the coding for them.

 Wolf

 Actually, single quoted will be string literal. He would need to encase them
 in double quotes so the parser knows it might be looking for a variable.
 require($incl) is what he wants.

 
 See!  I told you I always have problems with those!  :)
 
 Normally I'm not so literal though. 
 
 so yeah:
 require($incl);
 include($incl);

brilliant, stick a variable containing a string into an interpolated and
otherwise empty string.

require($incl);

... the quotes are a complete waste of time/cpu.

 
 I prefer the includes over the requires, but that is personal preference.
 
 Wolf
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Require error

2008-12-19 Thread sean greenslade
No. The file is called testing.php and it is trying to include sql.inc

On Fri, Dec 19, 2008 at 12:36 PM, Kyle Terry k...@kyleterry.com wrote:



 On Fri, Dec 19, 2008 at 9:28 AM, sean greenslade zootboys...@gmail.comwrote:

 So, I have this code in a php file called testing.php:
 $incl = '/webs/www.zootboy.com/sl/sql.inc';
  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
 exist??!?');
  require $incl or die('MySQL page not found. Unable to continue.');


 When I run the code in command line, it outputs this:

 [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
 PHP Warning:  require(1): failed to open stream: No such file or directory
 in /webs/www.zootboy.com/sl/testing.php on line 13
 PHP Fatal error:  require(): Failed opening required '1'
 (include_path='/var/php/inc/') in /webs/www.zootboy.com/sl/testing.php on
 line 13

 I have no idea what's going on. All the files have 777 perms.

 --
 --Zootboy


 Are you trying to require itself?


 --
 Kyle Terry | www.kyleterry.com




-- 
--Zootboy


Re: [PHP] Require error

2008-12-19 Thread Wolf
Bottom Post

 sean greenslade zootboys...@gmail.com wrote: 
 No. The file is called testing.php and it is trying to include sql.inc
 
 On Fri, Dec 19, 2008 at 12:36 PM, Kyle Terry k...@kyleterry.com wrote:
 
 
 
  On Fri, Dec 19, 2008 at 9:28 AM, sean greenslade 
  zootboys...@gmail.comwrote:
 
  So, I have this code in a php file called testing.php:
  $incl = '/webs/www.zootboy.com/sl/sql.inc';
   if(!is_readable($incl)) die('ERROR: MySQL Include file does not
  exist??!?');
   require $incl or die('MySQL page not found. Unable to continue.');
 
 
  When I run the code in command line, it outputs this:
 
  [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
  PHP Warning:  require(1): failed to open stream: No such file or directory
  in /webs/www.zootboy.com/sl/testing.php on line 13
  PHP Fatal error:  require(): Failed opening required '1'
  (include_path='/var/php/inc/') in /webs/www.zootboy.com/sl/testing.php on
  line 13
 
  I have no idea what's going on. All the files have 777 perms.
 
  --
  --Zootboy
 
 
  Are you trying to require itself?

Change your line to:
require('$incl') or die('File not found');

Require can be dork about things like this, I normally wind up handling to 
fiddle with the coding for them.

Wolf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Require error

2008-12-19 Thread Kyle Terry
On Fri, Dec 19, 2008 at 9:43 AM, Wolf lonew...@nc.rr.com wrote:

 Bottom Post

  sean greenslade zootboys...@gmail.com wrote:
  No. The file is called testing.php and it is trying to include sql.inc
 
  On Fri, Dec 19, 2008 at 12:36 PM, Kyle Terry k...@kyleterry.com wrote:
 
  
  
   On Fri, Dec 19, 2008 at 9:28 AM, sean greenslade 
 zootboys...@gmail.comwrote:
  
   So, I have this code in a php file called testing.php:
   $incl = '/webs/www.zootboy.com/sl/sql.inc';
if(!is_readable($incl)) die('ERROR: MySQL Include file does not
   exist??!?');
require $incl or die('MySQL page not found. Unable to continue.');
  
  
   When I run the code in command line, it outputs this:
  
   [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
   PHP Warning:  require(1): failed to open stream: No such file or
 directory
   in /webs/www.zootboy.com/sl/testing.php on line 13
   PHP Fatal error:  require(): Failed opening required '1'
   (include_path='/var/php/inc/') in /webs/
 www.zootboy.com/sl/testing.php on
   line 13
  
   I have no idea what's going on. All the files have 777 perms.
  
   --
   --Zootboy
  
  
   Are you trying to require itself?

 Change your line to:
 require('$incl') or die('File not found');

 Require can be dork about things like this, I normally wind up handling to
 fiddle with the coding for them.

 Wolf


Actually, single quoted will be string literal. He would need to encase them
in double quotes so the parser knows it might be looking for a variable.
require($incl) is what he wants.

-- 
Kyle Terry | www.kyleterry.com


Re: [PHP] Require error

2008-12-19 Thread Wolf

 sean greenslade zootboys...@gmail.com wrote: 
 On Fri, Dec 19, 2008 at 12:43 PM, Wolf lonew...@nc.rr.com wrote:
 
  Bottom Post
 
   sean greenslade zootboys...@gmail.com wrote:
   No. The file is called testing.php and it is trying to include sql.inc
  
   On Fri, Dec 19, 2008 at 12:36 PM, Kyle Terry k...@kyleterry.com wrote:
  
   
   
On Fri, Dec 19, 2008 at 9:28 AM, sean greenslade 
  zootboys...@gmail.comwrote:
   
So, I have this code in a php file called testing.php:
$incl = '/webs/www.zootboy.com/sl/sql.inc';
 if(!is_readable($incl)) die('ERROR: MySQL Include file does not
exist??!?');
 require $incl or die('MySQL page not found. Unable to continue.');
   
   
When I run the code in command line, it outputs this:
   
[r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
PHP Warning:  require(1): failed to open stream: No such file or
  directory
in /webs/www.zootboy.com/sl/testing.php on line 13
PHP Fatal error:  require(): Failed opening required '1'
(include_path='/var/php/inc/') in /webs/
  www.zootboy.com/sl/testing.php on
line 13
   
I have no idea what's going on. All the files have 777 perms.
   
--
--Zootboy
   
   
Are you trying to require itself?
 
  Change your line to:
  require('$incl') or die('File not found');
 
  Require can be dork about things like this, I normally wind up handling to
  fiddle with the coding for them.
 
  Wolf
 
 
 Sorry, GMail defaults to top post. Also, I had tried that before. Same
 errors.
 

Keep replies on the list too, in case someone else stumbles in...  :)

Did you try switching it from require to include?

Did you try just using the full path to the file?

Wolf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Require error

2008-12-19 Thread Wolf

 Kyle Terry k...@kyleterry.com wrote: 
 On Fri, Dec 19, 2008 at 9:43 AM, Wolf lonew...@nc.rr.com wrote:
 
  Bottom Post
 
   sean greenslade zootboys...@gmail.com wrote:
   No. The file is called testing.php and it is trying to include sql.inc
  
   On Fri, Dec 19, 2008 at 12:36 PM, Kyle Terry k...@kyleterry.com wrote:
  
   
   
On Fri, Dec 19, 2008 at 9:28 AM, sean greenslade 
  zootboys...@gmail.comwrote:
   
So, I have this code in a php file called testing.php:
$incl = '/webs/www.zootboy.com/sl/sql.inc';
 if(!is_readable($incl)) die('ERROR: MySQL Include file does not
exist??!?');
 require $incl or die('MySQL page not found. Unable to continue.');
   
   
When I run the code in command line, it outputs this:
   
[r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
PHP Warning:  require(1): failed to open stream: No such file or
  directory
in /webs/www.zootboy.com/sl/testing.php on line 13
PHP Fatal error:  require(): Failed opening required '1'
(include_path='/var/php/inc/') in /webs/
  www.zootboy.com/sl/testing.php on
line 13
   
I have no idea what's going on. All the files have 777 perms.
   
--
--Zootboy
   
   
Are you trying to require itself?
 
  Change your line to:
  require('$incl') or die('File not found');
 
  Require can be dork about things like this, I normally wind up handling to
  fiddle with the coding for them.
 
  Wolf
 
 
 Actually, single quoted will be string literal. He would need to encase them
 in double quotes so the parser knows it might be looking for a variable.
 require($incl) is what he wants.
 

See!  I told you I always have problems with those!  :)

Normally I'm not so literal though. 

so yeah:
require($incl);
include($incl);

I prefer the includes over the requires, but that is personal preference.

Wolf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Require error

2008-12-19 Thread sean greenslade
On Fri, Dec 19, 2008 at 12:50 PM, Wolf lonew...@nc.rr.com wrote:


  Kyle Terry k...@kyleterry.com wrote:
  On Fri, Dec 19, 2008 at 9:43 AM, Wolf lonew...@nc.rr.com wrote:
 
   Bottom Post
  
    sean greenslade zootboys...@gmail.com wrote:
No. The file is called testing.php and it is trying to include
 sql.inc
   
On Fri, Dec 19, 2008 at 12:36 PM, Kyle Terry k...@kyleterry.com
 wrote:
   


 On Fri, Dec 19, 2008 at 9:28 AM, sean greenslade 
   zootboys...@gmail.comwrote:

 So, I have this code in a php file called testing.php:
 $incl = '/webs/www.zootboy.com/sl/sql.inc';
  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
 exist??!?');
  require $incl or die('MySQL page not found. Unable to
 continue.');


 When I run the code in command line, it outputs this:

 [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
 PHP Warning:  require(1): failed to open stream: No such file or
   directory
 in /webs/www.zootboy.com/sl/testing.php on line 13
 PHP Fatal error:  require(): Failed opening required '1'
 (include_path='/var/php/inc/') in /webs/
   www.zootboy.com/sl/testing.php on
 line 13

 I have no idea what's going on. All the files have 777 perms.

 --
 --Zootboy


 Are you trying to require itself?
  
   Change your line to:
   require('$incl') or die('File not found');
  
   Require can be dork about things like this, I normally wind up handling
 to
   fiddle with the coding for them.
  
   Wolf
  
 
  Actually, single quoted will be string literal. He would need to encase
 them
  in double quotes so the parser knows it might be looking for a variable.
  require($incl) is what he wants.
 

 See!  I told you I always have problems with those!  :)

 Normally I'm not so literal though.

 so yeah:
 require($incl);
 include($incl);

 I prefer the includes over the requires, but that is personal preference.

 Wolf


I tried includes, and they fail as well. I tried putting the var in
double-quotes, and it did nothing.

-- 
--Zootboy


Re: [PHP] Require error

2008-12-19 Thread Kyle Terry
On Fri, Dec 19, 2008 at 9:50 AM, Wolf lonew...@nc.rr.com wrote:


  Kyle Terry k...@kyleterry.com wrote:
  On Fri, Dec 19, 2008 at 9:43 AM, Wolf lonew...@nc.rr.com wrote:
 
   Bottom Post
  
    sean greenslade zootboys...@gmail.com wrote:
No. The file is called testing.php and it is trying to include
 sql.inc
   
On Fri, Dec 19, 2008 at 12:36 PM, Kyle Terry k...@kyleterry.com
 wrote:
   


 On Fri, Dec 19, 2008 at 9:28 AM, sean greenslade 
   zootboys...@gmail.comwrote:

 So, I have this code in a php file called testing.php:
 $incl = '/webs/www.zootboy.com/sl/sql.inc';
  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
 exist??!?');
  require $incl or die('MySQL page not found. Unable to
 continue.');


 When I run the code in command line, it outputs this:

 [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
 PHP Warning:  require(1): failed to open stream: No such file or
   directory
 in /webs/www.zootboy.com/sl/testing.php on line 13
 PHP Fatal error:  require(): Failed opening required '1'
 (include_path='/var/php/inc/') in /webs/
   www.zootboy.com/sl/testing.php on
 line 13

 I have no idea what's going on. All the files have 777 perms.

 --
 --Zootboy


 Are you trying to require itself?
  
   Change your line to:
   require('$incl') or die('File not found');
  
   Require can be dork about things like this, I normally wind up handling
 to
   fiddle with the coding for them.
  
   Wolf
  
 
  Actually, single quoted will be string literal. He would need to encase
 them
  in double quotes so the parser knows it might be looking for a variable.
  require($incl) is what he wants.
 

 See!  I told you I always have problems with those!  :)

 Normally I'm not so literal though.

 so yeah:
 require($incl);
 include($incl);

 I prefer the includes over the requires, but that is personal preference.

 Wolf


It really all depends on how you want to handle errors. If you want to kill
the script because the database can't be reached, use require or
require_once, if you want the script to continue and handle everything
differently in the event that a file isn't loaded, use include or
include_once.

-- 
Kyle Terry | www.kyleterry.com


Re: [PHP] Require error

2008-12-19 Thread sean greenslade
On Fri, Dec 19, 2008 at 12:55 PM, Kyle Terry k...@kyleterry.com wrote:



 On Fri, Dec 19, 2008 at 9:50 AM, Wolf lonew...@nc.rr.com wrote:


  Kyle Terry k...@kyleterry.com wrote:
  On Fri, Dec 19, 2008 at 9:43 AM, Wolf lonew...@nc.rr.com wrote:
 
   Bottom Post
  
    sean greenslade zootboys...@gmail.com wrote:
No. The file is called testing.php and it is trying to include
 sql.inc
   
On Fri, Dec 19, 2008 at 12:36 PM, Kyle Terry k...@kyleterry.com
 wrote:
   


 On Fri, Dec 19, 2008 at 9:28 AM, sean greenslade 
   zootboys...@gmail.comwrote:

 So, I have this code in a php file called testing.php:
 $incl = '/webs/www.zootboy.com/sl/sql.inc';
  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
 exist??!?');
  require $incl or die('MySQL page not found. Unable to
 continue.');


 When I run the code in command line, it outputs this:

 [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
 PHP Warning:  require(1): failed to open stream: No such file or
   directory
 in /webs/www.zootboy.com/sl/testing.php on line 13
 PHP Fatal error:  require(): Failed opening required '1'
 (include_path='/var/php/inc/') in /webs/
   www.zootboy.com/sl/testing.php on
 line 13

 I have no idea what's going on. All the files have 777 perms.

 --
 --Zootboy


 Are you trying to require itself?
  
   Change your line to:
   require('$incl') or die('File not found');
  
   Require can be dork about things like this, I normally wind up
 handling to
   fiddle with the coding for them.
  
   Wolf
  
 
  Actually, single quoted will be string literal. He would need to encase
 them
  in double quotes so the parser knows it might be looking for a variable.
  require($incl) is what he wants.
 

 See!  I told you I always have problems with those!  :)

 Normally I'm not so literal though.

 so yeah:
 require($incl);
 include($incl);

 I prefer the includes over the requires, but that is personal preference.

 Wolf


 It really all depends on how you want to handle errors. If you want to kill
 the script because the database can't be reached, use require or
 require_once, if you want the script to continue and handle everything
 differently in the event that a file isn't loaded, use include or
 include_once.


 --
 Kyle Terry | www.kyleterry.com


I want the page to stop if it can't access the DB. It is required for the
function of the page.

-- 
--Zootboy


Re: [PHP] Require error

2008-12-19 Thread Philip Graham

 So, I have this code in a php file called testing.php:
 $incl = '/webs/www.zootboy.com/sl/sql.inc';
  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
 exist??!?');
  require $incl or die('MySQL page not found. Unable to continue.');


 When I run the code in command line, it outputs this:

 [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
 PHP Warning:  require(1): failed to open stream: No such file or directory
 in /webs/www.zootboy.com/sl/testing.php on line 13

Line 13?

 PHP Fatal error:  require(): Failed opening required '1'
 (include_path='/var/php/inc/') in /webs/www.zootboy.com/sl/testing.php on
 line 13

 I have no idea what's going on. All the files have 777 perms.

What happens if you remove the die() statement?

  require $incl;

-- 
Philip Graham

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Require error

2008-12-19 Thread sean greenslade
On Fri, Dec 19, 2008 at 1:04 PM, Philip Graham phi...@lightbox.org wrote:


  So, I have this code in a php file called testing.php:
  $incl = '/webs/www.zootboy.com/sl/sql.inc';
   if(!is_readable($incl)) die('ERROR: MySQL Include file does not
  exist??!?');
   require $incl or die('MySQL page not found. Unable to continue.');
 
 
  When I run the code in command line, it outputs this:
 
  [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
  PHP Warning:  require(1): failed to open stream: No such file or
 directory
  in /webs/www.zootboy.com/sl/testing.php on line 13

 Line 13?

  PHP Fatal error:  require(): Failed opening required '1'
  (include_path='/var/php/inc/') in /webs/www.zootboy.com/sl/testing.phpon
  line 13
 
  I have no idea what's going on. All the files have 777 perms.

 What happens if you remove the die() statement?

  require $incl;

 --
 Philip Graham


Hey! That fixed it. That's strange.

-- 
--Zootboy


Re: [PHP] Require error

2008-12-19 Thread Kyle Terry
On Fri, Dec 19, 2008 at 10:07 AM, sean greenslade zootboys...@gmail.comwrote:

 On Fri, Dec 19, 2008 at 1:04 PM, Philip Graham phi...@lightbox.org
 wrote:

 
   So, I have this code in a php file called testing.php:
   $incl = '/webs/www.zootboy.com/sl/sql.inc';
if(!is_readable($incl)) die('ERROR: MySQL Include file does not
   exist??!?');
require $incl or die('MySQL page not found. Unable to continue.');
  
  
   When I run the code in command line, it outputs this:
  
   [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
   PHP Warning:  require(1): failed to open stream: No such file or
  directory
   in /webs/www.zootboy.com/sl/testing.php on line 13
 
  Line 13?
 
   PHP Fatal error:  require(): Failed opening required '1'
   (include_path='/var/php/inc/') in /webs/
 www.zootboy.com/sl/testing.phpon
   line 13
  
   I have no idea what's going on. All the files have 777 perms.
 
  What happens if you remove the die() statement?
 
   require $incl;
 
  --
  Philip Graham
 

 Hey! That fixed it. That's strange.

 --
 --Zootboy


I totally forgot you have to wrap requires and includes in () if you are
putting the die statement after it.

(require $incl) or die('message'); //should work just fine for you.

-- 
Kyle Terry | www.kyleterry.com


Re: [PHP] require and http

2007-07-20 Thread Zoltán Németh
2007. 07. 20, péntek keltezéssel 09.17-kor Suporte - DPRJ Sistemas ezt
írta:
 Hello!
 
 I am returning to PHP and having some problems.
 
 Can anyone tell me if 
 require_once(http://www.mydomain.com.br/includes/teste.php;) really do not 
 work?
 
 If I especify the complete path for my local server 
 (/srv/www/htdocs/mysite/php/teste.php) it works fine (I did it when using 
 version 4). 
 
 The manual says it works but it is not working for me.

check the allow_url_fopen setting in php.ini
http://hu2.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen

hope that helps
Zoltán Németh

 
 Thank you
 
 Deleo
 
 PHP  5.2.0
 MySQL 5.0.26
 Apache 2.2.3
 Suse Linux 10.2

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] require and http

2007-07-20 Thread Zoltán Németh
2007. 07. 20, péntek keltezéssel 09.30-kor Suporte - DPRJ Sistemas ezt
írta:
 Checked and ON!
 


sorry I forgot that you need allow_url_include to be on too.
check that too.

btw, what do you mean by not working? does it throw any error? or
what?

greets
Zoltán Németh


(ps. sorry I forgot to include the list in my reply - but you forgot
that too ;) )

 Deleo
 
 - Original Message - 
 From: Zoltán Németh [EMAIL PROTECTED]
 To: Suporte - DPRJ Sistemas [EMAIL PROTECTED]
 Cc: PHP - General List php-general@lists.php.net
 Sent: Friday, July 20, 2007 9:25 AM
 Subject: Re: [PHP] require and http
 
 
  2007. 07. 20, péntek keltezéssel 09.17-kor Suporte - DPRJ Sistemas ezt
  írta:
  Hello!
 
  I am returning to PHP and having some problems.
 
  Can anyone tell me if 
  require_once(http://www.mydomain.com.br/includes/teste.php;) really do 
  not work?
 
  If I especify the complete path for my local server 
  (/srv/www/htdocs/mysite/php/teste.php) it works fine (I did it when using 
  version 4).
 
  The manual says it works but it is not working for me.
 
  check the allow_url_fopen setting in php.ini
  http://hu2.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen
 
  hope that helps
  Zoltán Németh
 
 
  Thank you
 
  Deleo
 
  PHP  5.2.0
  MySQL 5.0.26
  Apache 2.2.3
  Suse Linux 10.2
 
  -- 
  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] require and http

2007-07-20 Thread Richard Lynch
On Fri, July 20, 2007 7:17 am, Suporte - DPRJ Sistemas wrote:
 I am returning to PHP and having some problems.

 Can anyone tell me if
 require_once(http://www.mydomain.com.br/includes/teste.php;) really
 do not work?

It will not work if allow_url_fopen is set to OFF in php.ini

Even if it *DOES* work, because you've got allow_url_fopen set to
ON, it's not doing what you think it is...

It's using your own computer as an HTTP server to open up an HTTP
connection to fire up a PHP script that spits out something which is
then included as PHP source into your original PHP script.

So unless teste.php is a PHP script that spits out *more* PHP, this is
probably not what you want at all.

Here is a Hello World script that you could put into teste.php to
see what's going on:

?php
  echo '?php echo Hello World!';
?

Slow-motion:
Your original script runs and does:
?php include 'http://www.mydomain.com.br/includes/teste.php';?

This opens up a connection to your website, and requests teste.php

teste.php runs, and the above script prints out:
?php echo Hello World!

This PHP code is then included into your original script.

Your original script then executes the PHP code that teste.php has
spit out, namely:
?php echo Hello World!

And so, finally, it prints out:
Hello World!

This is DANGEROUS because somebody who know what you were doing could
easily (well, okay, maybe not easily, but still) hack the DNS routers
such that instead of the URL getting YOUR teste.php script, it gets
theirs.

And then your original script runs whatever code they felt like typing
on your server.

If you understand what is happening, you should be very very afraid of
doing this now.

If you're not very very afraid, re-read this until you are. :-)

 If I especify the complete path for my local server
 (/srv/www/htdocs/mysite/php/teste.php) it works fine (I did it when
 using version 4).

You can use the complete path.

Or you could figure out how PHP does include_path and set your
include_path in .htaccess or with something like
http://php.net/set_include_path

I would highly recommend that you figure out this include_path stuff
before going any farther.  It makes life so much easier.

 The manual says it works but it is not working for me.

It does work.

It just doesn't do what you think... :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] 'Require' and 'Select' lists

2005-05-14 Thread Richard Lynch
On Fri, May 13, 2005 5:59 am, Andre Dubuc said:
 However, the behavior continues intermittently. I've duplicated it one
 time.
 If I click on the 'State' dropdown list, allow the mouse to scan through
 it,
 but do not choose a value, and then immediately go to the previous or next
 field and click on it, the box where 'USA or Canada' appears will be blank
 (despite 'option selected value=In USA or CanadaIn USA or
 Canada/option'). For the life of me, I cannot figure why it's doing
 that.

This is a browser/OS bug.

It's possible that it's even time-dependent -- That if you click in the
popup list before it's fully formed, then you can make this happen, but
after it gets completely built, you can't duplicate this.

At any rate, there is nothing you can do about it.

Well, okay, you can complain to the browser-makers, and be ignored by them...

I guess one thing that *MIGHT* help would be to ob_start() before you send
out all the option tags, and then ob_flush()/flush() after the /select
closing tag.

The purpose being that you want the browser to build the whole menu with
as few interruptions as possible, so it will not get used while it is
half-built.

I would not RELY on this actually fixing the problem for sure 100% every
time you betcha, but it could reduce the incidence.

 As a hack, I've included a new routine checking for blank or null value
 for
 $selstate that snags problems before they hit the database. However, I'd
 rather know why this is happening.

Browsers and the data coming from them are flaky, if not downright hostile.

That's just how life is.

It's not a problem to solve.  It's a state of being to accept and plan
for. :-)

Maybe it's time to just re-write the script the right way, the way you
would do it today... :-)

You probably have already spent more time trying to figure this out than
it would have taken to just re-code it with your better experience.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] 'Require' and 'Select' lists

2005-05-14 Thread Andre Dubuc
On Saturday 14 May 2005 02:14 am, you wrote:
 On Fri, May 13, 2005 5:59 am, Andre Dubuc said:
  However, the behavior continues intermittently. I've duplicated it one
  time.
  If I click on the 'State' dropdown list, allow the mouse to scan through
  it,
  but do not choose a value, and then immediately go to the previous or
  next field and click on it, the box where 'USA or Canada' appears will be
  blank (despite 'option selected value=In USA or CanadaIn USA or
  Canada/option'). For the life of me, I cannot figure why it's doing
  that.

 This is a browser/OS bug.

 It's possible that it's even time-dependent -- That if you click in the
 popup list before it's fully formed, then you can make this happen, but
 after it gets completely built, you can't duplicate this.

 At any rate, there is nothing you can do about it.

 Well, okay, you can complain to the browser-makers, and be ignored by
 them...

 I guess one thing that *MIGHT* help would be to ob_start() before you send
 out all the option tags, and then ob_flush()/flush() after the /select
 closing tag.

 The purpose being that you want the browser to build the whole menu with
 as few interruptions as possible, so it will not get used while it is
 half-built.

 I would not RELY on this actually fixing the problem for sure 100% every
 time you betcha, but it could reduce the incidence.

  As a hack, I've included a new routine checking for blank or null value
  for
  $selstate that snags problems before they hit the database. However, I'd
  rather know why this is happening.

 Browsers and the data coming from them are flaky, if not downright hostile.

 That's just how life is.

 It's not a problem to solve.  It's a state of being to accept and plan
 for. :-)

 Maybe it's time to just re-write the script the right way, the way you
 would do it today... :-)

 You probably have already spent more time trying to figure this out than
 it would have taken to just re-code it with your better experience.


Thanks Richard,

Ain't life beautiful? I live for these debugging moments with *challenged* 
browsers! 

So, I'll stick with the hack. I've thrown the whole mess back at the browser 
and will let the user correct the *problem*.

Re-write the code? Yup, sometime in the near future - around July 2020 - I 
believe I have a few days available :

Regards,
Andre

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] 'Require' and 'Select' lists

2005-05-13 Thread Richard Lynch
On Thu, May 12, 2005 8:41 pm, Andre Dubuc said:
 I've had some rather odd intermittent behavior with a select list drawn by
 a
 'require' on my production site. Sometimes, rather than displaying 'In
 USA/Canada' from the 'option selectedIn USA/Canada/option' code in the
 required file, it will display a blank. Yet, if I try to duplicate this
 behavior on the development box, it will display as coded.

 Since I use this text string as a validator for user input, it really
 messes
 up the database/code functions that rely on it.

In that case, your validation routines aren't very good.

You have to assume the data coming from the browser is completely messed
up in malicious ways.  If not providing that item in the menu will break
your script or hash your data, then that's really a bigger problem than
the one you think you have.

 ?php require(provcountry.sty); ?

 [snippet of 'require' text (provcountry.sty)]
 tr
 tdbState nbsp;/b/td
 tdSELECT NAME=selstate
   option selectedIn USA/Canada/option

I'd try using an html entity on the '/' in USA/Canada

   option value=AlabamaAlabama/option
 . . .
 /SELECT/td
 /tr

 [snippet of some validating code verifying $selstate that relies on
 $selstate]

 ?php
 if (($_POST['selstate'] != In USA/Canada)($_POST['typstate'] != ))
  die (h5brbrPlease choose from 'In USA/Canada' or type in 'Other
  State'.
 brDo not use bothbrbrClick 'Back' on your  browser to
  re-enter information/h5);
 ?

 Any ideas why this is happening?

It's quite possible that some sort of php.ini setting with Magic Quotes or
something is altering the '/' character as well.

What *IS* in $_POST['selstate'] when it breaks?  Log it and see what the
data is.`

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] 'Require' and 'Select' lists

2005-05-13 Thread Andre Dubuc
On Friday 13 May 2005 02:20 am, Richard Lynch wrote:
 On Thu, May 12, 2005 8:41 pm, Andre Dubuc said:
  I've had some rather odd intermittent behavior with a select list drawn
  by a
  'require' on my production site. Sometimes, rather than displaying 'In
  USA/Canada' from the 'option selectedIn USA/Canada/option' code in
  the required file, it will display a blank. Yet, if I try to duplicate
  this behavior on the development box, it will display as coded.
 
  Since I use this text string as a validator for user input, it really
  messes
  up the database/code functions that rely on it.

 In that case, your validation routines aren't very good.

 You have to assume the data coming from the browser is completely messed
 up in malicious ways.  If not providing that item in the menu will break
 your script or hash your data, then that's really a bigger problem than
 the one you think you have.

  ?php require(provcountry.sty); ?
 
  [snippet of 'require' text (provcountry.sty)]
  tr
  tdbState nbsp;/b/td
  tdSELECT NAME=selstate
  option selectedIn USA/Canada/option

 I'd try using an html entity on the '/' in USA/Canada

  option value=AlabamaAlabama/option
  . . .
  /SELECT/td
  /tr
 
  [snippet of some validating code verifying $selstate that relies on
  $selstate]
 
  ?php
  if (($_POST['selstate'] != In USA/Canada)($_POST['typstate'] != ))
   die (h5brbrPlease choose from 'In USA/Canada' or type in 'Other
   State'.
  brDo not use bothbrbrClick 'Back' on your  browser to
   re-enter information/h5);
  ?
 
  Any ideas why this is happening?

 It's quite possible that some sort of php.ini setting with Magic Quotes or
 something is altering the '/' character as well.

 What *IS* in $_POST['selstate'] when it breaks?  Log it and see what the
 data is.`


Thanks for the info, Richard.

The errant behavior is intermittent and hard to replicate, but it has forced 
me to recode this part completly. [This code was my first attempt at PHP two 
years ago, and it's a bad mix of html/php - I certainly wouldn't do it that 
way again.]

I've replaced the 'In USA/Canada' with 'In USA or Canada' eliminating the 
possibility of the slash causing problems.

However, the behavior continues intermittently. I've duplicated it one time. 
If I click on the 'State' dropdown list, allow the mouse to scan through it, 
but do not choose a value, and then immediately go to the previous or next 
field and click on it, the box where 'USA or Canada' appears will be blank 
(despite 'option selected value=In USA or CanadaIn USA or 
Canada/option'). For the life of me, I cannot figure why it's doing that.

As a hack, I've included a new routine checking for blank or null value for 
$selstate that snags problems before they hit the database. However, I'd 
rather know why this is happening.

Logging it - $_POST['selstate'] is blank (after it messes up as above) -- no 
surprise, since that is what the browser displays.

Any other ideas?

Regards,
Andre

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] 'Require' and 'Select' lists

2005-05-13 Thread Brent Baisley
Sounds like it might be a browser behavior issue. I've seen some really 
weird behavior in browsers when a DOCTYPE is not declared at the start 
of the web page. The doctype declaration and the version declared in it 
are actually very important to the rendering and behavior of a web  
page. Over the years, browser behavior has changed and will render code 
and perform actions differently. The doctype declaration allows specify 
which version behavior you are targeting.

So, is the first line of your web page something like:
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd;
On May 13, 2005, at 8:59 AM, Andre Dubuc wrote:
Thanks for the info, Richard.
The errant behavior is intermittent and hard to replicate, but it has 
forced
me to recode this part completly. [This code was my first attempt at 
PHP two
years ago, and it's a bad mix of html/php - I certainly wouldn't do it 
that
way again.]

I've replaced the 'In USA/Canada' with 'In USA or Canada' eliminating 
the
possibility of the slash causing problems.

However, the behavior continues intermittently. I've duplicated it one 
time.
If I click on the 'State' dropdown list, allow the mouse to scan 
through it,
but do not choose a value, and then immediately go to the previous or 
next
field and click on it, the box where 'USA or Canada' appears will be 
blank
(despite 'option selected value=In USA or CanadaIn USA or
Canada/option'). For the life of me, I cannot figure why it's doing 
that.

As a hack, I've included a new routine checking for blank or null 
value for
$selstate that snags problems before they hit the database. However, 
I'd
rather know why this is happening.

Logging it - $_POST['selstate'] is blank (after it messes up as above) 
-- no
surprise, since that is what the browser displays.

Any other ideas?
Regards,
Andre
--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] 'Require' and 'Select' lists

2005-05-13 Thread Andre Dubuc
That might be it ( a browser issue) since the behavior seems to occur most in 
Opera. I shudder to think what IE must be doing with it. And blush . . . I 
didn't have that declaration on the required page (since the page only 
contains that code snippet and I thought it unnecessary - guess I was wrong).

I'll give it whirl, and take it out for a test-drive.

Thanks,
Andre

On Friday 13 May 2005 10:51 am, you wrote:
 Sounds like it might be a browser behavior issue. I've seen some really
 weird behavior in browsers when a DOCTYPE is not declared at the start
 of the web page. The doctype declaration and the version declared in it
 are actually very important to the rendering and behavior of a web
 page. Over the years, browser behavior has changed and will render code
 and perform actions differently. The doctype declaration allows specify
 which version behavior you are targeting.

 So, is the first line of your web page something like:
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd;

 On May 13, 2005, at 8:59 AM, Andre Dubuc wrote:
  Thanks for the info, Richard.
 
  The errant behavior is intermittent and hard to replicate, but it has
  forced
  me to recode this part completly. [This code was my first attempt at
  PHP two
  years ago, and it's a bad mix of html/php - I certainly wouldn't do it
  that
  way again.]
 
  I've replaced the 'In USA/Canada' with 'In USA or Canada' eliminating
  the
  possibility of the slash causing problems.
 
  However, the behavior continues intermittently. I've duplicated it one
  time.
  If I click on the 'State' dropdown list, allow the mouse to scan
  through it,
  but do not choose a value, and then immediately go to the previous or
  next
  field and click on it, the box where 'USA or Canada' appears will be
  blank
  (despite 'option selected value=In USA or CanadaIn USA or
  Canada/option'). For the life of me, I cannot figure why it's doing
  that.
 
  As a hack, I've included a new routine checking for blank or null
  value for
  $selstate that snags problems before they hit the database. However,
  I'd
  rather know why this is happening.
 
  Logging it - $_POST['selstate'] is blank (after it messes up as above)
  -- no
  surprise, since that is what the browser displays.
 
  Any other ideas?
 
  Regards,
  Andre

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] require() in other directories?

2004-11-18 Thread Pluance
What error happen?


On Thu, 18 Nov 2004 09:15:22 +0100, Peter Lauri [EMAIL PROTECTED] wrote:
 Best groupmember,
 
 I have an webapplication that uses different languages and therefor I have
 set up different directorys for each language. All languages use the same
 classes.
 
 The problem I have is when I want to require() the classfile I can not
 require a file that is not in the same directory as my .php file. I have
 tried the following:
 
 require(../classes.php);
 require(http://www.mydomain.com/classes.php;);
 and more.
 
 All gives me error messages, why?
 
 Anyone that could help me?
 
 - Best Of Times
 /Peter
 
 --
 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] require() in other directories?

2004-11-18 Thread Peter Lauri
I get the Failed to open stream, no such file in directory

If you were in one of these folders:
/fr/
/eng/
And your classfile was namned classes.php and in the directory:
/classes/
And you wanted to include the classfile, how would you write it?

I would assume: require(/classes/classes.php);

But that doesn't work.

Help :)



Pluance [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 What error happen?


 On Thu, 18 Nov 2004 09:15:22 +0100, Peter Lauri [EMAIL PROTECTED] wrote:
  Best groupmember,
 
  I have an webapplication that uses different languages and therefor I
have
  set up different directorys for each language. All languages use the
same
  classes.
 
  The problem I have is when I want to require() the classfile I can not
  require a file that is not in the same directory as my .php file. I have
  tried the following:
 
  require(../classes.php);
  require(http://www.mydomain.com/classes.php;);
  and more.
 
  All gives me error messages, why?
 
  Anyone that could help me?
 
  - Best Of Times
  /Peter
 
  --
  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] require() in other directories?

2004-11-18 Thread Jason Wong
On Thursday 18 November 2004 16:32, Peter Lauri wrote:
 I get the Failed to open stream, no such file in directory

 If you were in one of these folders:
 /fr/
 /eng/
 And your classfile was namned classes.php and in the directory:
 /classes/
 And you wanted to include the classfile, how would you write it?

 I would assume: require(/classes/classes.php);

No because PHP would be trying to find the 'classes' directory in the root 
level of your filesystem.

The best way to deal with it would be to add /full/path/to/classes into your 
include_path, then you can simply use include('classes.php').

-- 
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
--
/*
Will you loan me $20.00 and only give me ten of it?
That way, you will owe me ten, and I'll owe you ten, and we'll be even!
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] require() in other directories?

2004-11-18 Thread Peter Lauri
But if I am working on a webserver it would try to find it in the root of my
webserver, or am I wrong?

For example I use that notation with an image:
I use this: img src='/image/theimage.gif'

Is this not the case for the PHP-scripting?

/Peter


Jason Wong [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 On Thursday 18 November 2004 16:32, Peter Lauri wrote:
  I get the Failed to open stream, no such file in directory
 
  If you were in one of these folders:
  /fr/
  /eng/
  And your classfile was namned classes.php and in the directory:
  /classes/
  And you wanted to include the classfile, how would you write it?
 
  I would assume: require(/classes/classes.php);

 No because PHP would be trying to find the 'classes' directory in the root
 level of your filesystem.

 The best way to deal with it would be to add /full/path/to/classes into
your
 include_path, then you can simply use include('classes.php').

 --
 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
 --
 /*
 Will you loan me $20.00 and only give me ten of it?
 That way, you will owe me ten, and I'll owe you ten, and we'll be even!
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] require() in other directories?

2004-11-18 Thread Jason Wong
On Thursday 18 November 2004 19:45, Peter Lauri wrote:

Please do not top post.

 But if I am working on a webserver it would try to find it in the root of
 my webserver, or am I wrong?

 For example I use that notation with an image:
 I use this: img src='/image/theimage.gif'

That is your 'webroot'.

 Is this not the case for the PHP-scripting?

No, $_SERVER['DOCUMENT_ROOT'] is what you need to prepend in front 
directories. BTW using relative paths for include should work.

-- 
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
--
/*
Television -- the longest amateur night in history.
  -- Robert Carson
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] require() in other directories?

2004-11-18 Thread Ryan King
Peter Lauri wrote:
I get the Failed to open stream, no such file in directory
If you were in one of these folders:
/fr/
/eng/
And your classfile was namned classes.php and in the directory:
/classes/
And you wanted to include the classfile, how would you write it?
I would assume: require(/classes/classes.php);
require(classes/classes.php);

But that doesn't work.
Help :)

Pluance [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
What error happen?
On Thu, 18 Nov 2004 09:15:22 +0100, Peter Lauri [EMAIL PROTECTED] wrote:
Best groupmember,
I have an webapplication that uses different languages and therefor I
have
set up different directorys for each language. All languages use the
same
classes.
The problem I have is when I want to require() the classfile I can not
require a file that is not in the same directory as my .php file. I have
tried the following:
require(../classes.php);
require(http://www.mydomain.com/classes.php;);
and more.
All gives me error messages, why?
Anyone that could help me?
- Best Of Times
/Peter
--
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] require/include from a different directory

2003-03-31 Thread Jennifer Goodie
If the includes are within the website, using
$_SERVER[DOCUMENT_ROOT]/pathtofile/file is a good way to go.

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 29, 2003 2:10 PM
To: 'Greg Macek'; [EMAIL PROTECTED]
Subject: RE: [PHP] require/include from a different directory


  try using an absolute path.

 I've considered that route, but an issue I have with that is I do most
 of my development work on a machine that a different directory
structure
 than the production server (currently a Cobalt RaQ4), so the paths are
 different. Accommodating both would be a time consuming project for
me.

I always put it into a variable.

$_CONF['path'] = '/home/web/www/';

and then use that variable in all of your includes or requires. I also
make an HTML variable that's used in all links and images.

$_CONF['html'] = 'http://www.mysite.com/';

Sure, you have to get used to using this variable everywhere, but it
makes switching server pretty easy.

---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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] require/include from a different directory

2003-03-30 Thread Tim Burden
The call to include() must be relative to one of the directories listed in
open_basedir, regardless of which file the call is made from.

Usually the dir mentioned in open_basedir is the docroot, so in  your case
require include/inc_file.php;

should work from any file, in any folder.

- Original Message -
From: Greg Macek [EMAIL PROTECTED]
Newsgroups: php.general
To: [EMAIL PROTECTED]
Sent: Saturday, March 29, 2003 3:37 PM
Subject: Re: [PHP] require/include from a different directory


 It seems I have found my problem. It has to do with the files I'm trying
 to include. They also include other files and the directories it's
 trying to include files from aren't working. I've found a workaround for
 my situation for the time being. It's not pretty, but functional.

 On Sat, 2003-03-29 at 14:19, Greg Macek wrote:
  Hi,
 
  I'm having a problem hopefully can be easily answered. I'm trying to
  organize parts of my site into different directories so that they're all
  not in the main folder so to speak; basically breaking out by what
  part of the application it is. I also have an include folder for all
  my main functions and such...
 
  /  (main directory)
  /include   (global functions, includes)
  /app_sect1
  /app_sect2
 
  what I'm trying to do from /app_sect1 is include a file from the
  include directory, but with little success. The line looks like this:
 
  require ../include/inc_file.php;
 
  But my page just doesn't work for me now.. any ideas what I'm missing?
 
  - 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] require/include from a different directory

2003-03-29 Thread Greg Macek
It seems I have found my problem. It has to do with the files I'm trying
to include. They also include other files and the directories it's
trying to include files from aren't working. I've found a workaround for
my situation for the time being. It's not pretty, but functional. 

On Sat, 2003-03-29 at 14:19, Greg Macek wrote:
 Hi,
 
 I'm having a problem hopefully can be easily answered. I'm trying to
 organize parts of my site into different directories so that they're all
 not in the main folder so to speak; basically breaking out by what
 part of the application it is. I also have an include folder for all
 my main functions and such...
 
 /  (main directory)
 /include   (global functions, includes)
 /app_sect1 
 /app_sect2
 
 what I'm trying to do from /app_sect1 is include a file from the
 include directory, but with little success. The line looks like this:
 
 require ../include/inc_file.php; 
 
 But my page just doesn't work for me now.. any ideas what I'm missing?
 
 - 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] require/include from a different directory

2003-03-29 Thread Greg Macek
I've considered that route, but an issue I have with that is I do most
of my development work on a machine that a different directory structure
than the production server (currently a Cobalt RaQ4), so the paths are
different. Accommodating both would be a time consuming project for me. 

On Sat, 2003-03-29 at 14:47, Jason Paschal wrote:
 try using an absolute path.
 
 
 
 
 
 
 From: Greg Macek [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [PHP] require/include from a different directory
 Date: 29 Mar 2003 14:19:41 -0600
 
 Hi,
 
 I'm having a problem hopefully can be easily answered. I'm trying to
 organize parts of my site into different directories so that they're all
 not in the main folder so to speak; basically breaking out by what
 part of the application it is. I also have an include folder for all
 my main functions and such...
 
 /  (main directory)
 /include   (global functions, includes)
 /app_sect1
 /app_sect2
 
 what I'm trying to do from /app_sect1 is include a file from the
 include directory, but with little success. The line looks like this:
 
 require ../include/inc_file.php;
 
 But my page just doesn't work for me now.. any ideas what I'm missing?
 
 - Greg
 
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 _
 Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
 http://join.msn.com/?page=features/junkmail



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] require/include from a different directory

2003-03-29 Thread John W. Holmes
  try using an absolute path.
 
 I've considered that route, but an issue I have with that is I do most
 of my development work on a machine that a different directory
structure
 than the production server (currently a Cobalt RaQ4), so the paths are
 different. Accommodating both would be a time consuming project for
me.

I always put it into a variable.

$_CONF['path'] = '/home/web/www/';

and then use that variable in all of your includes or requires. I also
make an HTML variable that's used in all links and images.

$_CONF['html'] = 'http://www.mysite.com/'; 

Sure, you have to get used to using this variable everywhere, but it
makes switching server pretty easy. 

---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] Require some help about the date comparison

2002-07-17 Thread Jason Wong

On Wednesday 17 July 2002 14:55, Manisha wrote:
 I am writing one program -

 I want to display some text on web. This text should appear for limited
 period e.g from 20th July 12pm till 25th July 3pm. After 25th July 3pm the
 text should disappear from screen.

 I tried to look for date comparison / string conversion to date etc, I got
 lot info but could not figure out which would be best for above (rather how
 can I do it).

 Anybody can share some expert comments please ?

1) Use strtotime() to convert your start and end dates to unixtimestamps. 

2) Use time() to get the current unixtimestamp. 

3) Use the standard less-than (), greater-than () comparison operators on 
the above 3 items to decide whether or not to display the text.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
A chronic disposition to inquiry deprives domestic felines of vital qualities.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Require some help about the date comparison

2002-07-17 Thread Andrey Hristov

I think that it is better to use unixtimestamps and if you save them to a
RDBMS then save according to GMT. When retrieving use timezone to convert to
your local time -
ex

define('MY_TIMEZONE',-2);
list($time) = mysql_fetch_array(mysql_query('select tstamp from table where
user='.$user_id.';'));
$tt_ar = explode(':',gmstrftime('%H:%M:%S:%m:%d:%Y',$time));
$local_time = gmmktime($tt_ar[0]+MY_TIMEZONE, $tt_ar[1],
$tt_ar[2],$tt_ar[3],$tt_ar[4],$tt_ar[5]);

Regards,
Andrey

- Original Message -
From: Manisha [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 17, 2002 9:55 AM
Subject: [PHP] Require some help about the date comparison


 I am writing one program -

 I want to display some text on web. This text should appear for limited
 period e.g from 20th July 12pm till 25th July 3pm. After 25th July 3pm the
 text should disappear from screen.

 I tried to look for date comparison / string conversion to date etc, I got
 lot info but could not figure out which would be best for above (rather
how
 can I do it).

 Anybody can share some expert comments please ?

 Thanking in advance,
 Manisha


 --
 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] Require some help about the date comparison

2002-07-17 Thread Manisha

Thanks to all who responded me. Actually I got confused after seeing so 
many commands but finally got it correct from u guys.

Thanks once again.

Manisha


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Require()

2002-06-26 Thread Adam Voigt

No spaces.

Instead of every = 1
Use: every=1

Adam Voigt
[EMAIL PROTECTED]

On Wed, 2002-06-26 at 08:37, Andy Whittlestone wrote:
  I want to use require to send some post information to a page.
 
 
 Code:
 
 if ($viewsystem = = 1)
 $Str = editexemptfiles.php?every = 1;
 
 require($Str);
 
 
 I've tried what it says in the online documentation, but it doesn't work,
 
 Tried:
 $Str = d:\htdocs\somewhere\editexemptfiles.php?every = 1;
 
 
 getting the following error:
 
 Fatal error: Failed opening required
 'd:/htdocs/somewhere/anotherpage.php?every = 1'
 (include_path='.;d:\php\includes') in d:\htdocs\somewhere\thispage.php on
 line 48
 
 
 
 
 
 
 -- 
 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] Require()

2002-06-26 Thread Andy Whittlestone

I'm afraid it don't ork.

Thanks Anyway.

Anyone ?



Adam Voigt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 No spaces.

 Instead of every = 1
 Use: every=1

 Adam Voigt
 [EMAIL PROTECTED]

 On Wed, 2002-06-26 at 08:37, Andy Whittlestone wrote:
   I want to use require to send some post information to a page.
 
 
  Code:
 
  if ($viewsystem = = 1)
  $Str = editexemptfiles.php?every = 1;
 
  require($Str);
 
 
  I've tried what it says in the online documentation, but it doesn't
work,
 
  Tried:
  $Str = d:\htdocs\somewhere\editexemptfiles.php?every = 1;
 
 
  getting the following error:
 
  Fatal error: Failed opening required
  'd:/htdocs/somewhere/anotherpage.php?every = 1'
  (include_path='.;d:\php\includes') in d:\htdocs\somewhere\thispage.php
on
  line 48
 
 
 
 
 
 
  --
  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] Require()

2002-06-26 Thread John Holmes

 if ($viewsystem = = 1)
 $Str = editexemptfiles.php?every = 1;
 
 require($Str);

You don't pass variables to a require()'d file. Any variable in the
current scope is available in the included()'d, require()'d file. 

So just require($editexemptfiles.php); and in that file, $every will be
available, automatically.

Think of include() and require() as a cut and paste operation. When you
use either function, it's just like taking that file and copying it into
the code at that point. So anything available to the main script at that
point is available to the included/required file. 

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Require()

2002-06-26 Thread Niklas Lampén

Try this:

?
if ($viewsystem == 1)
$Str = d:\\htdocs\\somewhere\\editexemptfiles.php?every=1;

require($Str);
?


Niklas


-Original Message-
From: Andy Whittlestone [mailto:[EMAIL PROTECTED]] 
Sent: 26. kesäkuuta 2002 15:37
To: [EMAIL PROTECTED]
Subject: [PHP] Require()


 I want to use require to send some post information to a page.


Code:

if ($viewsystem = = 1)
$Str = editexemptfiles.php?every = 1;

require($Str);


I've tried what it says in the online documentation, but it doesn't
work,

Tried:
$Str = d:\htdocs\somewhere\editexemptfiles.php?every = 1;


getting the following error:

Fatal error: Failed opening required
'd:/htdocs/somewhere/anotherpage.php?every = 1'
(include_path='.;d:\php\includes') in d:\htdocs\somewhere\thispage.php
on line 48






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Require()

2002-06-26 Thread Andy Whittlestone

Thanks, that worked, and made it alot clearer.

Andy


John Holmes [EMAIL PROTECTED] wrote in message
000501c21d12$f4907580$b402a8c0@mango">news:000501c21d12$f4907580$b402a8c0@mango...
  if ($viewsystem = = 1)
  $Str = editexemptfiles.php?every = 1;
 
  require($Str);

 You don't pass variables to a require()'d file. Any variable in the
 current scope is available in the included()'d, require()'d file.

 So just require($editexemptfiles.php); and in that file, $every will be
 available, automatically.

 Think of include() and require() as a cut and paste operation. When you
 use either function, it's just like taking that file and copying it into
 the code at that point. So anything available to the main script at that
 point is available to the included/required file.

 ---John Holmes...




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] require or include ?

2002-03-28 Thread Rick Emery

require() is used when you want the file included regardless of whether any
information is used from it.  include() may be conditional.

-Original Message-
From: javier [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 4:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP] require or include ?


When should I use require or include?
I read that include copies the content from the file to the script that
is calling it.
And require is like #include in C.


-- 
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] require or include ?

2002-03-28 Thread Javier


If I include for ex. common.php in a script and this script also calls
common.php what should I use require or include?


On Thu, Mar 28, 2002 at 04:44:04PM -0600, Rick Emery wrote:
 require() is used when you want the file included regardless of whether any
 information is used from it.  include() may be conditional.
 
 -Original Message-
 From: javier [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 28, 2002 4:44 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] require or include ?
 
 
 When should I use require or include?
 I read that include copies the content from the file to the script that
 is calling it.
 And require is like #include in C.
 
 
 -- 
 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] require or include ?

2002-03-28 Thread bvr


both include the file, but
use require() when it is required, and include() when it's not.

In the new behaviour these two make no further difference.

bvr.

Javier wrote:

If I include for ex. common.php in a script and this script also calls
common.php what should I use require or include?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Require variable declaration?

2002-03-27 Thread Rick Emery

PHP is weakly typed.  Therefore, definitions are not needed.  A variable may
assume any guise depending upon its context.

-Original Message-
From: Kjell Hansen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 2:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Require variable declaration?


Hi,
I've just started making my database/PHP-scripts and I'm used to, from
my earlier development, have my variables declared at the top of each
routine.
But I can't find the command that would force me to declare my variables
and I can't find the declare statement either.

Is there a way to do this?

Regards
/Kjell


-- 
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] Require variable declaration?

2002-03-27 Thread Demitrious S. Kelly

You don't need to do this with PHP... a variable is created when you
assign a value to it. It is also unnecessary to assign a type. PHP will
typecast automatically as necessary

-Original Message-
From: Kjell Hansen [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 27, 2002 12:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Require variable declaration?

Hi,
I've just started making my database/PHP-scripts and I'm used to, from
my earlier development, have my variables declared at the top of each
routine.
But I can't find the command that would force me to declare my variables
and I can't find the declare statement either.

Is there a way to do this?

Regards
/Kjell


-- 
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] Require variable declaration?

2002-03-27 Thread Kjell Hansen

That's too bad, 
I used to do some ASP which is weakly typed too but I still could use Option 
Explicit to require variables to be declared. 
Then a small typo would produce very hard-to-find errors.

Well, I guess I have to live with it. Can I add it to a PHP5-wishlist?

Thanx
/Kjell 

- Original Message - 
From: Rick Emery [EMAIL PROTECTED]
To: 'Kjell Hansen' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, March 27, 2002 10:45 PM
Subject: RE: [PHP] Require variable declaration?


 PHP is weakly typed.  Therefore, definitions are not needed.  A variable may
 assume any guise depending upon its context.
 
 -Original Message-
 From: Kjell Hansen [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 27, 2002 2:47 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Require variable declaration?
 
 
 Hi,
 I've just started making my database/PHP-scripts and I'm used to, from
 my earlier development, have my variables declared at the top of each
 routine.
 But I can't find the command that would force me to declare my variables
 and I can't find the declare statement either.
 
 Is there a way to do this?
 
 Regards
 /Kjell
 
 
 -- 
 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] Require variable declaration?

2002-03-27 Thread Rick Emery

There has been some discussion at zend.com to add this to PHP5/engine 2.0.
However, the idea was rejected.

-Original Message-
From: Kjell Hansen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 2:54 PM
To: Rick Emery; [EMAIL PROTECTED]
Subject: Re: [PHP] Require variable declaration?


That's too bad, 
I used to do some ASP which is weakly typed too but I still could use
Option Explicit to require variables to be declared. 
Then a small typo would produce very hard-to-find errors.

Well, I guess I have to live with it. Can I add it to a PHP5-wishlist?

Thanx
/Kjell 

- Original Message - 
From: Rick Emery [EMAIL PROTECTED]
To: 'Kjell Hansen' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, March 27, 2002 10:45 PM
Subject: RE: [PHP] Require variable declaration?


 PHP is weakly typed.  Therefore, definitions are not needed.  A variable
may
 assume any guise depending upon its context.
 
 -Original Message-
 From: Kjell Hansen [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 27, 2002 2:47 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Require variable declaration?
 
 
 Hi,
 I've just started making my database/PHP-scripts and I'm used to, from
 my earlier development, have my variables declared at the top of each
 routine.
 But I can't find the command that would force me to declare my variables
 and I can't find the declare statement either.
 
 Is there a way to do this?
 
 Regards
 /Kjell
 
 
 -- 
 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] Require variable declaration?

2002-03-27 Thread Johnson, Kirk

You can catch typos by setting the error reporting level to E_ALL (in
php.ini). PHP will then give you a warning whenever a variable is used
before it has been assigned a value.

Kirk

 That's too bad, 
 I used to do some ASP which is weakly typed too but I still 
 could use Option Explicit to require variables to be declared. 
 Then a small typo would produce very hard-to-find errors.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] require() vs include()

2002-03-15 Thread Ford, Mike [LSS]

 -Original Message-
 From: Jim Lucas [php] [mailto:[EMAIL PROTECTED]]
 Sent: 15 March 2002 00:55
 
 Plus, depending on how you are calling the file.  Meaning if 
 the file name
 that you are calling is a static file name or dynamic file name
 
 require() and require_once()  will include a file before the 
 php parser
 starts its job, but this will only happen if the name isn't dynamic.

In fact, I believe that what you are describing is an OLD behaviour (prior to PHP 
4.0.2, in fact).  However, the manual has only recently changed to document the new 
behaviour (and actually doesn't do it very well, yet).  Now, BOTH require and include 
(and their _once versions) work dynamically, and the only difference is in how they 
report a failure.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] require() vs include()

2002-03-14 Thread SHEETS,JASON (Non-HP-Boise,ex1)

They are much the same, both include a file.

To quote the PHP manual require() and include() are identical in every way
except how they handle failure. include() produces a Warning while require()
results in a Fatal Error. In other words, don't hesitate to use require() if
you want a missing file to halt processing of the page. include() does not
behave this way, the script will continue regardless. Be sure to have an
appropriate include_path setting as well.

That said I would use require_once and include_once instead of just include
and require, these functions ensure the file is only included once which
prevents a lot of problems.

Jason

-Original Message-
From: David McInnis [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 14, 2002 4:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP] require() vs include()


Are these redundant functions or are they different?  I seem to be able
to use the interchangeably.

David McInnis



-- 
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] require() vs include()

2002-03-14 Thread Jim Lucas [php]

Plus, depending on how you are calling the file.  Meaning if the file name
that you are calling is a static file name or dynamic file name

require() and require_once()  will include a file before the php parser
starts its job, but this will only happen if the name isn't dynamic.

meaning that if you have this

require(myfile.inc);  //static
and
require($var. .inc); //dynamic

the first one will be included into the before parsing and the second will
wait until the parser comes along and defines the $var value.

if you call require()  or require_once() with a variable in the file handler
name space, it will downgrade (in a way) to just working like an include()
or include_once()

with include() or include_once() it doesn't matter if the file handle name
has a variable in it.  it will always include the file after the parser
starts its job.

Jim Lucas
www.bend.com

- Original Message -
From: SHEETS,JASON (Non-HP-Boise,ex1) [EMAIL PROTECTED]
To: 'David McInnis' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, March 14, 2002 3:56 PM
Subject: RE: [PHP] require() vs include()


 They are much the same, both include a file.

 To quote the PHP manual require() and include() are identical in every
way
 except how they handle failure. include() produces a Warning while
require()
 results in a Fatal Error. In other words, don't hesitate to use require()
if
 you want a missing file to halt processing of the page. include() does not
 behave this way, the script will continue regardless. Be sure to have an
 appropriate include_path setting as well.

 That said I would use require_once and include_once instead of just
include
 and require, these functions ensure the file is only included once which
 prevents a lot of problems.

 Jason

 -Original Message-
 From: David McInnis [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 14, 2002 4:47 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] require() vs include()


 Are these redundant functions or are they different?  I seem to be able
 to use the interchangeably.

 David McInnis



 --
 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] require v. includes

2002-03-07 Thread Andrey Hristov

require includes code only once(on the parse), include includes code 
everytime it is called. if you have some libs and in two or more you do 
require or include of some core lib you have to use require_once or to define 
some constant and use it to check. I am sure when but require changed its 
behaviour. Before it leaded to fatal error if some the file that has to be 
required is not found. Now it works just like include (just notice or warning 
- not sure).

For more info read the docs ar : http://www.php.net/

Best regards,
Andrey Hristov
On Thursday 07 March 2002 07:25 pm, you wrote:
 I was just wondering if anyone could tell me when would be the time to
 choose require(), require_once(), or include().  I know a little bit about
 using each one, but I am just not sure if there is one that is better than
 the other in certain situations.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] require or include

2001-11-15 Thread Mike Eheler

It all depends on the purpose.

With require, the script will die on the spot if the file is not found. 
Also, the code will always be included in the file.. so take this example:

file.php:
?
echo Hello World!;
?

requiretest.php:
?
if (FALSE) {
require('file.php');
}
?

The run script would be:

?
if (FALSE) {
echo Hello World!;
}
?

Of course that code would never be executed, but the required file would 
be parsed and included as part of the file, whereas:

includetest.php:
?
if (FALSE) {
include('file.php');
}
?

If the if() condition is not met, the file is not included at all.. so 
the parsed code would be:

?
if (FALSE) {
}
?

:)

Mike

Oosten, Sjoerd van wrote:

Hello list,

I'm just wandering what's better, require or include.

Greetings,


Sjoerd van Oosten 
Digitaal vormgever [EMAIL PROTECTED]
Datamex E-sites B.V. 
http://www.esites.nl
Minervum 7368 Telefoon: (076) 5 730 730 
4817 ZH BREDA Telefax: (076) 5 877 757 
___





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] require include

2001-10-22 Thread Steve Cayford

http://www.php.net/manual/en/function.require.php

require() pulls in the target file when the source file is 
parsed/compiled, include() pulls in the target file when the source file 
is executed. So an include() nested in an if statement will only be 
included if the if statement evaluates to true, a require() nested in an 
if statement will be included regardless.

Also check out include_once() and require_once().

-Steve

On Monday, October 22, 2001, at 05:15  PM, jtjohnston wrote:

 Coverting from perl ...
 What's the differencw between require and include? Where, when, why?

 John?

 
 Email post  reply always appreciated


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] require using url

2001-08-09 Thread Christian Reiniger

On Wednesday 08 August 2001 18:08, [EMAIL PROTECTED] wrote:

 I'm having a problem using require with a url. What I'm trying to do is
 have a php script on a server that calls a file on another server using
 require. The file that is called on the other server contains php
 functions that the calling php script uses.

 I my attempts so far I get:
 Fatal error: Call to undefined function: login() in
 /usr/home/nigels/public_html/survey01/survey.php on line 51

 survey.php is the script that has the require line:
require(http://host.server.com/functions.php;);

That means your server does a HHTP request to 
http://host.server.com/functions.php , get's back the *output* of 
functions.php and includes that (assuming host.server.com uses PHP).

-- 
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)

World domination. Fast. (Linus Torvalds about Linux)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] require using url

2001-08-08 Thread Tyler Longren

What's on line 51?  The error is on line 51 in survey.php.  require()

Tyler Longren
Captain Jack Communications
[EMAIL PROTECTED]
www.captainjack.com

isn't on line 51.  The error occurs because there's no login() function.



On Wed, 8 Aug 2001 10:08:01 -0600 (Mountain Daylight Time)
[EMAIL PROTECTED] wrote:

 Hi,
 
 I'm having a problem using require with a url. What I'm trying to do is
 have a php script on a server that calls a file on another server using
 require. The file that is called on the other server contains php
 functions that the calling php script uses.
 
 I my attempts so far I get:
 Fatal error: Call to undefined function: login() in
 /usr/home/nigels/public_html/survey01/survey.php on line 51
 
 survey.php is the script that has the require line:
require(http://host.server.com/functions.php;);
 
 I really appreciate your help.
 
 Thanks,
 
 Nigel
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] require using url

2001-08-08 Thread Nigel_Soon

Line 51 has a call to login(). The login() function is in functions.php
which lives on a different server. I try to use functions.php by putting
the require statement in survey.php. This works when they both live on the
same server but when I try using require with the url to a remote server
it fails.

Cheers,

Nigel

On Wed, 8 Aug 2001, Tyler Longren wrote:

 What's on line 51?  The error is on line 51 in survey.php.  require()

 Tyler Longren
 Captain Jack Communications
 [EMAIL PROTECTED]
 www.captainjack.com

 isn't on line 51.  The error occurs because there's no login() function.



 On Wed, 8 Aug 2001 10:08:01 -0600 (Mountain Daylight Time)
 [EMAIL PROTECTED] wrote:

  Hi,
 
  I'm having a problem using require with a url. What I'm trying to do is
  have a php script on a server that calls a file on another server using
  require. The file that is called on the other server contains php
  functions that the calling php script uses.
 
  I my attempts so far I get:
  Fatal error: Call to undefined function: login() in
  /usr/home/nigels/public_html/survey01/survey.php on line 51
 
  survey.php is the script that has the require line:
 require(http://host.server.com/functions.php;);
 
  I really appreciate your help.
 
  Thanks,
 
  Nigel
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] require using url

2001-08-08 Thread Bruin, Bolke de

Is that file living on a HTTP server which PARSES the function? Eg do you
get
the source code when directly requesting it from a browser or an empty page
(or whatever)

Bolke

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Verzonden: Wednesday, August 08, 2001 6:20 PM
Aan: Tyler Longren
CC: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Onderwerp: Re: [PHP] require using url


Line 51 has a call to login(). The login() function is in functions.php
which lives on a different server. I try to use functions.php by putting
the require statement in survey.php. This works when they both live on the
same server but when I try using require with the url to a remote server
it fails.

Cheers,

Nigel

On Wed, 8 Aug 2001, Tyler Longren wrote:

 What's on line 51?  The error is on line 51 in survey.php.  require()

 Tyler Longren
 Captain Jack Communications
 [EMAIL PROTECTED]
 www.captainjack.com

 isn't on line 51.  The error occurs because there's no login() function.



 On Wed, 8 Aug 2001 10:08:01 -0600 (Mountain Daylight Time)
 [EMAIL PROTECTED] wrote:

  Hi,
 
  I'm having a problem using require with a url. What I'm trying to do is
  have a php script on a server that calls a file on another server using
  require. The file that is called on the other server contains php
  functions that the calling php script uses.
 
  I my attempts so far I get:
  Fatal error: Call to undefined function: login() in
  /usr/home/nigels/public_html/survey01/survey.php on line 51
 
  survey.php is the script that has the require line:
 require(http://host.server.com/functions.php;);
 
  I really appreciate your help.
 
  Thanks,
 
  Nigel
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] require using url

2001-08-08 Thread Nigel_Soon

Yeah the file is on a HTTP server. I don't exactly get the source code
showing though as it is enclosed in php tags and the HTTP server is
running php.

Thanks,

Nigel

On Wed, 8 Aug 2001, Bruin, Bolke de wrote:

 Is that file living on a HTTP server which PARSES the function? Eg do you
 get
 the source code when directly requesting it from a browser or an empty page
 (or whatever)

 Bolke

 -Oorspronkelijk bericht-
 Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Verzonden: Wednesday, August 08, 2001 6:20 PM
 Aan: Tyler Longren
 CC: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Onderwerp: Re: [PHP] require using url


 Line 51 has a call to login(). The login() function is in functions.php
 which lives on a different server. I try to use functions.php by putting
 the require statement in survey.php. This works when they both live on the
 same server but when I try using require with the url to a remote server
 it fails.

 Cheers,

 Nigel

 On Wed, 8 Aug 2001, Tyler Longren wrote:

  What's on line 51?  The error is on line 51 in survey.php.  require()
 
  Tyler Longren
  Captain Jack Communications
  [EMAIL PROTECTED]
  www.captainjack.com
 
  isn't on line 51.  The error occurs because there's no login() function.
 
 
 
  On Wed, 8 Aug 2001 10:08:01 -0600 (Mountain Daylight Time)
  [EMAIL PROTECTED] wrote:
 
   Hi,
  
   I'm having a problem using require with a url. What I'm trying to do is
   have a php script on a server that calls a file on another server using
   require. The file that is called on the other server contains php
   functions that the calling php script uses.
  
   I my attempts so far I get:
   Fatal error: Call to undefined function: login() in
   /usr/home/nigels/public_html/survey01/survey.php on line 51
  
   survey.php is the script that has the require line:
  require(http://host.server.com/functions.php;);
  
   I really appreciate your help.
  
   Thanks,
  
   Nigel
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail: [EMAIL PROTECTED]
  
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Require very urgent Help about Security (pki, digital signature) along with PHP

2001-07-10 Thread Christian Reiniger

On Tuesday 10 July 2001 04:50, Manisha wrote:

 I want to develop one payment site, where people will pay their tax.
[...]
 These reports are very sensitive, so I want high end security (I am out
 of USA). I am thinking of using pki (public key infrastructure).

If it is very sensitive, employ a good security expert. Everything else 
is a desaster waiting to happen.

-- 
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)

I sat laughing snidely into my notebook until they showed me a PC running
Linux. And oh! It was as though the heavens opened and God handed down a
client-side OS so beautiful, so graceful, and so elegant that a million
Microsoft developers couldn't have invented it even if they had a hundred
years and a thousand crates of Jolt cola.

- LAN Times

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Require vs include

2001-03-17 Thread Boaz Yahav


Hi

Check out : 

http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=22

Sincerely

  berber

Visit http://www.weberdev.com Today!!! 
To see where PHP might take you tomorrow.
 



-Original Message-
From: NGUYEN DINH Quoc Huy [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 17, 2001 9:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Require vs include


Hi

Can someone explain me what's the difference between include() and require()
??
I did not catch the explanation in the docs.
When should I use include() and when should I use require() ??

I'm not on the list so reply me to: [EMAIL PROTECTED]

Thnx

-- 
=
 NGUYEN DINH Quoc Huy (SnAKes)
   http://www.snakesbox.com/
  [EMAIL PROTECTED] - ICQ# 3398187
  telnet://snakesbox.com:/  -- Puissance 4
=



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] require on compressed files

2001-03-01 Thread Christian Reiniger

On Wednesday 28 February 2001 22:58, you wrote:

 I am trying to get the expected behavior of:
 require("filename.gz");
 or
 require("filename.bz2");
 to work properly.

Why do you want to do that? If that file is just a normal include file, 
compression just adds unneccessary overhead. If it's some file you don't 
know the contents of, don't include it (that would mean executing 
arbitrary code on your server)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

What luck for the rulers that men do not think.

- Adolf Hitler

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] require() ???

2001-02-16 Thread Brandon Orther

Hello,

Can you give me the full path to where the php script is and the full path
to where the script is you want require('');

I use this all the time and should be able to figure it out.

Thank you,


Brandon Orther
WebIntellects Design/Development Manager
[EMAIL PROTECTED]
800-994-6364
www.webintellects.com


-Original Message-
From: Maamiin [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 16, 2001 9:38 AM
To: PHP General Newslist
Subject: [PHP] require() ???


How can I use this function to load files from subfolders?
when i try this on apache (Linux+PHP3)

require('cls/mysql.cl.php3');

from log I can read then:

[error] PHP3 Fatal error: Failed opening required 'cls/mysql.cl.php3' in
'index.php3' on line 6

I already tried full-path, but nothing! Only when i copied file in to same
folder, then it works! But I dont want do this!

Any other ideas are welcome!


R.K.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] require() ???

2001-02-16 Thread Maamiin

main script:
/home/www/public_html/YL/index.php3 (rw-rw-rw-) root 
and second script:
/home/www/public_html/YL/cls/mysql.cl.php3  (rw-rw-rw-) root

First page intranet web-address is http://MyServer/www/YL/index.php3

Thnx

|| -Original Message-
|| From: Brandon Orther [mailto:[EMAIL PROTECTED]]
|| Sent: Friday, February 16, 2001 8:30 PM
|| To: PHP User Group
|| Subject: RE: [PHP] require() ???
|| 
|| 
|| Hello,
|| 
|| Can you give me the full path to where the php script is and the 
|| full path
|| to where the script is you want require('');
|| 
|| I use this all the time and should be able to figure it out.
|| 
|| Thank you,
|| 
|| 
|| Brandon Orther
|| WebIntellects Design/Development Manager
|| [EMAIL PROTECTED]
|| 800-994-6364
|| www.webintellects.com
|| 
|| 
|| -Original Message-
|| From: Maamiin [mailto:[EMAIL PROTECTED]]
|| Sent: Friday, February 16, 2001 9:38 AM
|| To: PHP General Newslist
|| Subject: [PHP] require() ???
|| 
|| 
|| How can I use this function to load files from subfolders?
|| when i try this on apache (Linux+PHP3)
|| 
|| require('cls/mysql.cl.php3');
|| 
|| from log I can read then:
|| 
|| [error] PHP3 Fatal error: Failed opening required 'cls/mysql.cl.php3' in
|| 'index.php3' on line 6
|| 
|| I already tried full-path, but nothing! Only when i copied file 
|| in to same
|| folder, then it works! But I dont want do this!
|| 
|| Any other ideas are welcome!
|| 
|| 
|| R.K.
|| 
|| 
|| --
|| PHP General Mailing List (http://www.php.net/)
|| To unsubscribe, e-mail: [EMAIL PROTECTED]
|| For additional commands, e-mail: [EMAIL PROTECTED]
|| To contact the list administrators, e-mail: [EMAIL PROTECTED]
|| 
|| 
|| -- 
|| PHP General Mailing List (http://www.php.net/)
|| To unsubscribe, e-mail: [EMAIL PROTECTED]
|| For additional commands, e-mail: [EMAIL PROTECTED]
|| To contact the list administrators, e-mail: [EMAIL PROTECTED]
|| 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]