Re: [PHP] Trying to create a site-template system.. and..

2001-10-28 Thread Moody

Try this: (see http://www.php.net/manual/en/ref.outcontrol.php for more
info)

  My problem is.. that when I do something like
 
  -
  $content = show_source(/path/to/file);
   // or
  $content = Blah.. blah.. .include(/some/file)... some
  more blah..;
  -
 
  It includes the files (or executes the code that is assigned
  to the variable), however it all appears OUTSIDE the
  template.

ob_start(); // start buffer
eval(?.include (/path/to/file));
$file_content = ob_get_contents();
ob_end_clean(); // delete the buffer

$content = Blah.. blah.. .$file_content... some more blah..;

Hope this helps...




-- 
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] phpmyadmin is installed, now how to access it?

2001-10-28 Thread Moody


 I see all the files are name php3 rather than php. When I access the
 index.php3 of course it my browser doesn't know what to do so it asks if I
 want to download it.

Sounds like you need to add .php3 to your AddType directive in the
httpd.conf file
i.e.the line in httpd.conf that says:

AddType application/x-httpd-php .php

Should be changed to:

AddType application/x-httpd-php .php .php3

This should solve the problem with .php3 scripts not executing on your
server :-)
 Otherwise, if you want/have to change all the extensions to .php, you'll
have to change all the requires and includes in the phpMyAdmin scripts to
reflect these changes.



-- 
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] Re: Convert a string so it is valid for a sql query

2001-09-10 Thread Moody

 Is there a function to convert a string so it is a valid string of text
 for a SQL query?  AN example would be a string of text that has ' in it
 would be converted to \'

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





-- 
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] Re: passing args to function?

2001-09-10 Thread Moody

 I'm having a bit of a hard time passing in a constant to a user-defined
 function.

 the calling page - index.php:
 html
 ?php
 include define_foo.php;
 function_foo(bar);
  ^
should be:
   foo(bar);

[snip]

 ?php
 function foo($value)
 {
 global $value, $page_id, $usr, $pass, $database, $host;
   ^
No need to declare $value as global . Already passed as arg

[snip]



-- 
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] Re: Error trapping, on scripts that don't exist

2001-09-05 Thread Moody

This is how it works (in very crude not-even-pseudo code, but I'm sure
you'll be able to follow the logic!):

BEGIN
1. Browser requests a resource (file) from your web server.
2. Web server checks to see whether requested resource exists.
3. if (!2) web server generates 404 error (page does not exist)  your user
is redirected to your custom error screen. Goto END
4. else send requested resource to browser: if it's an HTML file it is sent
as-is. Goto END.
5. If it's a php script, send it to the php interpreter to execute.
6. If script is error-free, send result to web server to forward on to
browser. Everything AOK. Goto END.
7. Else Error handler does whatever you want it to. In this case, redirect
to the same page as in (3) (as well as possibly sending you an email,
logging to a file, etc.)
END

By default step 7 would be printing an error to the browser, which is what I
assume you don't want. If someone requests a php file that does not exist,
they will get a 404 error since that url does not exist and you won't even
get as far running any script at all!



Tim Ward [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 thanks to Mahmoud for trying to help, but the php error trapping functions
 rely on the engine being able to auto-prepend the error trapping script. I
 tried a solution like this  ...
 ?php
 if (!file_exists($PATH_TRANSLATED))
 { include($DOCUMENT_ROOT/error.html);
 exit;
 }
 ?

 but it doesn't prepend to scripts that don't exist. I did some diagnostics
 (e.g. replacing $PATH_TRANSLATED with a hard coded non-existant file name)
 to confirm it was working for files that do exist.

 Any ideas on how to get around this?

 Tim Ward
 Senior Systems Engineer

 Please refer to the following disclaimer in respect of this message:
 http://www.stivesdirect.com/e-mail-disclaimer.html


  -Original Message-
  From: Mahmoud Abu-Wardeh [SMTP:[EMAIL PROTECTED]]
  Sent: 03 September 2001 18:01
  To: [EMAIL PROTECTED]
  Subject: Re: Error trapping
 
  Try writing a custom error handler. Chech out
  http://www.zend.com/zend/spotlight/error.php for a good article on the
  subject. Pay particular attention to the bit at the end about output
  buffering since I assume that what you would want to do is send a
redirect
  header to the browser if the script fails to work.
 
  Tim Ward [EMAIL PROTECTED] wrote
   I've gone an annoying problem. On our site I've trapped file does not
   exist errors at Apache level to send out my own error screen with a
  company
   logo, link to home page and a mailto link, but this doesn't work for
any
   request for a page that would be parsed by php if it existed. In this
  case
  a
   valid html page (containing the php error) is returned. The problem
  seems
  to
   be that as far as Apache is concerned there isn't an error. I haven't
  found
   anything in php that allows me to trap errors like this. Error
reporting
   levels aren't helpful as I still need the error trapped.
  
   I'm sure I'm not the first person who has come across this, and I'm
  hoping
   someone out there has found a way around it.
  
   I'm running PHP 4.0.0, Apache 1.3 on NT (yes I know, but our network
  manager
   has promised me a linux box)
  
   Tim Ward
   Senior Systems Engineer
  
   Please refer to the following disclaimer in respect of this message:
   http://www.stivesdirect.com/e-mail-disclaimer.html
  
  
 



-- 
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] Re: Error trapping

2001-09-03 Thread Moody

Try writing a custom error handler. Chech out
http://www.zend.com/zend/spotlight/error.php for a good article on the
subject. Pay particular attention to the bit at the end about output
buffering since I assume that what you would want to do is send a redirect
header to the browser if the script fails to work.

Tim Ward [EMAIL PROTECTED] wrote
 I've gone an annoying problem. On our site I've trapped file does not
 exist errors at Apache level to send out my own error screen with a
company
 logo, link to home page and a mailto link, but this doesn't work for any
 request for a page that would be parsed by php if it existed. In this case
a
 valid html page (containing the php error) is returned. The problem seems
to
 be that as far as Apache is concerned there isn't an error. I haven't
found
 anything in php that allows me to trap errors like this. Error reporting
 levels aren't helpful as I still need the error trapped.

 I'm sure I'm not the first person who has come across this, and I'm hoping
 someone out there has found a way around it.

 I'm running PHP 4.0.0, Apache 1.3 on NT (yes I know, but our network
manager
 has promised me a linux box)

 Tim Ward
 Senior Systems Engineer

 Please refer to the following disclaimer in respect of this message:
 http://www.stivesdirect.com/e-mail-disclaimer.html





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

2001-05-09 Thread Moody

What version of PHP are you using? According to the manual:
URL support was added in PHP 4.0.5

Moody


Joseph Bannon [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 For some reason, I can get the image image size for an image on the local
 machine, but remotely give me an error


 My code

 ?php
 $size = GetImageSize (images/title.gif);
 echo size: $size[0]p;
 echo size: $size[1]p;
 echo size: $size[2]p;
 echo size: $size[3]p;
 $size = GetImageSize
 (http://www.picpage.com/users/ka/kaurisma1331/images/image0.jpg;);
 echo size: $size[0]p;
 echo size: $size[1]p;
 echo size: $size[2]p;
 echo size: $size[3]p;
 ?



 Output


 size: 310
 size: 80
 size: 1
 size: width=310 height=80
 Warning: Unable to open
 http://www.picpage.com/users/ka/kaurisma1331/images/image0.jpg in
 web/imagetest.php on line 13
 size:
 size:
 size:
 size:

 --
 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] ZOPE PHP

2001-04-17 Thread Moody

Look at http://www.zope.org
and http://weblogs.userland.com/zopeNewbies/

have fun :-)

Moody

- Original Message -
From: "elias" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, April 17, 2001 7:51 PM
Subject: Re: [PHP] ZOPE PHP


 what is ZOPE?
 can you give me a URL about it?

 -elias
 ""Romulo Roberto Pereira"" [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hello!
 
  Any comments in PHP for Zope? I don't know much thought... Some people
 told
  me that Zope is good a while ago... And I saw that know they have a PHP
  layer... How good is this?
 
  Thank you,
 
  Rom
 
 
  --
  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]