php-general Digest 5 Feb 2005 00:40:27 -0000 Issue 3268
Topics (messages 208073 through 208107):
Re: Is it Possible?
208073 by: Jason Barnett
208074 by: Erwin Kerk
208082 by: Sagar C Nannapaneni
CLI & CGI
208075 by: Claudio
208088 by: Philip Olson
gzcompress fuction missing
208076 by: Scott Mueller
array_map in conjunction with user_call_func_array - inconsistency
208077 by: Jochem Maas
Re: Udp.pl scare
208078 by: Jochem Maas
208081 by: Mike
208091 by: Jochem Maas
Re: Script stuck on final ?>
208079 by: Jochem Maas
208085 by: Alp
Re: Credit card storing, for processing
208080 by: Jochem Maas
imagecolorallocatealpha() error
208083 by: Kurt Wagner
208097 by: Richard Lynch
Re: Multiline data Insert Into table from a generated form?
208084 by: Alp
208105 by: Christopher Fulton
Re: Date Update
208086 by: John Nichel
interface development
208087 by: Winn Johnston
208090 by: Richard Lynch
[suspicious - maybe spam] Re: [PHP] interface development
208089 by: Miles Thompson
208095 by: Jochem Maas
[suspicious - maybe spam] Re: [PHP] Re: mcrypt public and private key
208092 by: Richard Lynch
PHP5 Exception Handling
208093 by: Gerard Samuel
208100 by: Jochem Maas
208104 by: Gerard Samuel
[suspicious - maybe spam] Re: [PHP] Date Update
208094 by: Richard Lynch
Re: sending set NUMBERFORMAT
208096 by: Richard Lynch
connection pooling
208098 by: Bosky, Dave
208102 by: Jochem Maas
Re: [suspicious - maybe spam] [PHP] gzcompress fuction missing
208099 by: Richard Lynch
Expression for deleting all cookies
208101 by: Ross Hulford
208107 by: Marek Kilimajer
Job Recruitment and Support Ticketing Appz
208103 by: Jason Paschal
Information
208106 by: jason.inetgurus.net
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Sagar C Nannapaneni wrote:
I'm calling a php script with <img> tag
for ex: <img src="http://localhost/test.php?img=asfd">
and the test.php is as follows...
test.php
------------
<?
....
....
some server side validations
....
readfile("abcd.gif");
?>
-----------------------------------------------
Theres no problem with this..its working fine. But i want to return some
text(or Html) the
browser along with the image. So is there anyway that i can send the text to
the browser
You seem to have a pretty good understanding of what's going on already.
What you can do is have one script (main.php) that includes the <img>
tag that links to the PHP generated gif (test.php). Then you can put
whatever text / html you want in main.php
<?php
/** main.php */
echo "<p>I am a super cool piece of text. Now check out this
picture!</p>\n<img src=\"http://localhost/test.php?img=asdf\">";
?>
in this fashion. Even anyother solution other than the <img> is also Ok.
Showing img
is not a priority for me but sending the text is..
Any help will be greatly appreciated..
Thanks,
/sagar
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
signature.asc
Description: OpenPGP digital signature
--- End Message ---
--- Begin Message ---
Sagar C Nannapaneni wrote:
I'm calling a php script with <img> tag
for ex: <img src="http://localhost/test.php?img=asfd">
and the test.php is as follows...
test.php
------------
<?
...
...
some server side validations
...
readfile("abcd.gif");
?>
-----------------------------------------------
Theres no problem with this..its working fine. But i want to return some text(or Html) the
browser along with the image. So is there anyway that i can send the text to the browser
in this fashion. Even anyother solution other than the <img> is also Ok. Showing img
is not a priority for me but sending the text is..
Any help will be greatly appreciated..
Thanks,
/sagar
I guess you're trying to get some data from the server after the page
load (problably by javascript), so this might be of help:
http://www.scss.com.au/family/andrew/webdesign/xmlhttprequest/
Erwin Kerk
--- End Message ---
--- Begin Message ---
Figured it out from the other way....
hope others may find this useful
<script language="javascript" src="yourscript.php"></script>
Note that what ever you optput in your php do that with
echo "document.write('asdfasdf');"
/sagar
----- Original Message -----
From: "Erwin Kerk" <[EMAIL PROTECTED]>
To: "Sagar C Nannapaneni" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Friday, February 04, 2005 5:36 PM
Subject: Re: [PHP] Is it Possible?
> Sagar C Nannapaneni wrote:
> > I'm calling a php script with <img> tag
> >
> > for ex: <img src="http://localhost/test.php?img=asfd">
> >
> > and the test.php is as follows...
> >
> > test.php
> > ------------
> > <?
> > ...
> > ...
> > some server side validations
> > ...
> > readfile("abcd.gif");
> > ?>
> > -----------------------------------------------
> >
> > Theres no problem with this..its working fine. But i want to return some
text(or Html) the
> > browser along with the image. So is there anyway that i can send the
text to the browser
> > in this fashion. Even anyother solution other than the <img> is also Ok.
Showing img
> > is not a priority for me but sending the text is..
> >
> > Any help will be greatly appreciated..
> >
> > Thanks,
> > /sagar
>
>
> I guess you're trying to get some data from the server after the page
> load (problably by javascript), so this might be of help:
>
> http://www.scss.com.au/family/andrew/webdesign/xmlhttprequest/
>
>
>
> Erwin Kerk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--- End Message ---
--- Begin Message ---
Can I use the CGI executable at the command-line?
In other words, what is the diference between the CLI and CGI Version?
--- End Message ---
--- Begin Message ---
> Can I use the CGI executable at the command-line?
Yes.
> In other words, what is the diference between the CLI
> and CGI Version?
See the manual, it explains the differences:
http://php.net/features.commandline
Regards,
Philip
--- End Message ---
--- Begin Message ---
modernbill is no longer working for a customer all of a sudden. It
seems that function_exists('gzcompress') now returns false for some
reason. Does anybody have any ideas what might've happened and how I
can correct this? Our customer is effectively down from this, so i'm
very anxious to help him out.
Thanks
Scott Mueller
AccelerateBiz Managed Hosting
http://www.acceleratebiz.com
--- End Message ---
--- Begin Message ---
listers,
I was playing around with call_user_func_array() and array_map() on
PHP 5.0.2 (cli) (built: Nov 9 2004 19:00:36) and noticed the that
calling call_user_func_array() on 'array_map' with more than 2 args
(i.e. more than just the name of the callback and array
argument that are required for 'array_map') then a numerically indexed array
is returned, where as with just the minimum 2 args the associative keys of array
are maintained:
question is have I missed something, am I doing something wrong or it this
a 'buglet'?
===========================================================================
function array_map_assoc($callback, $arr)
{
$keys = array_keys($arr);
$args = func_get_args();
$arr = call_user_func_array("array_map", $args);
/* return the fixed array */
return $arr;
}
// couldn't figure out how else
// to use a single quote with php -r in a bash shell
$sq = chr(39);
// start array
$arr1 = array( "name" => "\"{$sq}Testing{$sq}\"",
"email" => "\"Yadda{$sq}s \"YADDa\"<script language={$sq}Testing{$sq}
source={$sq}{$sq}></script>\"");
$arr2 = array_map_assoc("strip_tags", $arr1);
$arr3 = array_map_assoc("htmlentities", $arr2, array( ENT_QUOTES, ENT_QUOTES ));
$arr4 = array_map_assoc("htmlentities", $arr2);
$arr5 = array_map_assoc("strip_tags", $arr1, array( "<p>", "<p>" ));
echo "-----\n\n";
var_dump($arr1, $arr2, $arr3, $arr4, $arr5);
===========================================================================
OUTPUTS ON MACHINE:
-----
array(2) {
["name"]=>
string(11) ""'Testing'""
["email"]=>
string(63) ""Yadda's "YADDa"<script language='Testing' source=''></script>""
}
array(2) {
["name"]=>
string(11) ""'Testing'""
["email"]=>
string(17) ""Yadda's "YADDa"""
}
array(2) {
[0]=>
string(31) ""'Testing'""
[1]=>
string(42) ""Yadda's "YADDa"""
}
array(2) {
["name"]=>
string(21) ""'Testing'""
["email"]=>
string(37) ""Yadda's "YADDa"""
}
array(2) {
[0]=>
string(11) ""'Testing'""
[1]=>
string(17) ""Yadda's "YADDa"""
}
rgds,
Jochem
--- End Message ---
--- Begin Message ---
Mike wrote:
Hello all,
I have been hit twice now with the udp.pl exploit found in phpbb
I thought that upgrading to php 4.3.10 would stop this? Was I wrong?
yes you are wrong - I have no idea why you would think that other than blind
assumption. - phpBB is forum software writting in PHP.....
phpBB IS NOT *&[EMAIL PROTECTED]&^% PHP!!!!
the exploit is in phpBB and not in PHP. (like you said yourself).
in order to fix it you should go to the phpbb.com site a download the
latest version - actually I don't know if that will help - but I do know
that they have a topic on their forum which explains how to hack to source
code in order to 'fix' the problem, tghe problem is related to their
search term 'highlight' functionlality. (knowing that should help
you track down the fix)
rgds,
Jochem
Here is what it does...
" The attacker installed a UDP flood tool that ran for 2 hours before buzz
was blocked by Network Services. Remote shell programs were also uploaded
and run to give the attackers easier access to the webservers user account.
"
--- End Message ---
--- Begin Message ---
on 2/4/05 8:07 AM, Jochem Maas at [EMAIL PROTECTED] wrote:
>> I have been hit twice now with the udp.pl exploit found in phpbb
>>
>> I thought that upgrading to php 4.3.10 would stop this? Was I wrong?
>
> yes you are wrong - I have no idea why you would think that other than blind
> assumption. - phpBB is forum software writting in PHP.....
>
> phpBB IS NOT *&[EMAIL PROTECTED]&^% PHP!!!!
Why don't you chill out.
I ask because 4.3.10 was released to (in part) fix an exploit in phpBB and
PHP < PHP 4.3.10
http://securityfocus.com/archive/1/384773/2004-12-15/2004-12-21/0
Just wanted to make sure my situation was not related to this one.
--- End Message ---
--- Begin Message ---
Mike wrote:
on 2/4/05 8:07 AM, Jochem Maas at [EMAIL PROTECTED] wrote:
I have been hit twice now with the udp.pl exploit found in phpbb
I thought that upgrading to php 4.3.10 would stop this? Was I wrong?
yes you are wrong - I have no idea why you would think that other than blind
assumption. - phpBB is forum software writting in PHP.....
phpBB IS NOT *&[EMAIL PROTECTED]&^% PHP!!!!
Why don't you chill out.
well actually this is me chilled out ;-)
my reaction was based on the fact that the exploit you talked about made
headline news (e.g. coverage on bbc.co.uk) AND is discussed on the projects
own website in some depth... i.e. you could have found the answer yourself.
I ask because 4.3.10 was released to (in part) fix an exploit in phpBB and
PHP < PHP 4.3.10
http://securityfocus.com/archive/1/384773/2004-12-15/2004-12-21/0
It would have been cool if you had added this URL to your OP (assuming you
knew about it at that time). AFAICT that bug actually has nothing to do with the
exploit you were asking about.
It all boils down to sanitizing input/thruput/output vars. there is a
recent long thread (started 2nd Feb) on [email protected]
called 'PHP 5.1' which you might find helpful.
Just wanted to make sure my situation was not related to this one.
--- End Message ---
--- Begin Message ---
Alp wrote:
Thanks Jochem. Ctrl+Shift+M is also another great way to catch a mistake. I
have never gone through the help before, looks like I should have...
thats almost begging for RTFM-like comment ;-)
but seeing as you have just given me a new shortcut I let it be :-)
seriously 9 of out 10 editors have a lot more functionality than
the average user knows about.... I use textpad almost everyday, have done for
at least 2-3 years and the CTRL+SHFT+M combo is news to me.
cheers. and good luck with php :-)
Alp
--- End Message ---
--- Begin Message ---
Hi Jochem,
"Jochem Maas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Alp wrote:
> > Thanks Jochem. Ctrl+Shift+M is also another great way to catch a
mistake. I
> > have never gone through the help before, looks like I should have...
>
> thats almost begging for RTFM-like comment ;-)
Well, couldn't agree with you more! :-)
> but seeing as you have just given me a new shortcut I let it be :-)
Phew! So barely saved... :-P
> seriously 9 of out 10 editors have a lot more functionality than
> the average user knows about.... I use textpad almost everyday, have done
for
> at least 2-3 years and the CTRL+SHFT+M combo is news to me.
>
> cheers. and good luck with php :-)
Thanks, and I will need that!
Alp
--- End Message ---
--- Begin Message ---
Brian Dunning wrote:
Source for these statistics?
I pulled them from the MYASS database.
priceless
--- End Message ---
--- Begin Message ---
On my PHP installation (4.3.10), imagecolorallocatealpha() does not work at
all. I have tried all of the examples in the function notes and quite a few
more. The GD version is that which was packaged with PHP, which the
documentation says should be able to use image blending functions.
Does anyone have a moderately quick solution? No real hurry.
/nightcrawler
"May you live as long as you wish and love as long as you live."
-- Minerva, Time Enough for Love
--- End Message ---
--- Begin Message ---
Kurt Wagner wrote:
> On my PHP installation (4.3.10), imagecolorallocatealpha() does not work
> at all. I have tried all of the examples in the function notes and quite
> a few more. The GD version is that which was packaged with PHP, which the
> documentation says should be able to use image blending functions.
>
> Does anyone have a moderately quick solution? No real hurry.
Does it give error messages?
Does it crash?
Do you just not see the image?
Does the image not look alpha blended?
What does the function return?
Can you give us a 10-line script demonstrating its non-functionality?
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Hi Mike,
Sorry that the response is a bit late. I will keep in mind to include the
whole details of the error next time, sorry for the toruble.
Somehow, I just couldn't manage to get all 3 tables updated from a single
php file (well, understandable since I'm a beginner) so now I am going
through 3 seperate scripts one calling the next page in line. But I really
was hoping to cut down on the page travelling since there are (or would
mostly be) a few lines of input for each if not none.
Maybe I'm trying to re-invent the wheel but I couldn't find a suitable CMS
out there that would beeasily modifiable to suit my exact needs and thus set
out to put together my own. Intention is to provide an interface so that
tour package details could be entered into the DB for use with a generic
php/html page that would display all the info available per tour in an
orderly manner. So now this info can be entered through several steps. I
would still need to find a way to give options to create tables (for html)
to the user, i.e. num.of columns, rows, the contents of the header row(s),
alignment etc. I know it will take me a long way to accomplish all this but
I'm not lucky in finding examples that could show me the way, where/how to
start...
I will try your suggestions and let you know.
Thanks for all your help.
Alp
"Mike Smith" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Change:
> > while ($c=0;$c<count($_POST['tourid']):$c++)
>
> to (change the : before $c++ to ;):
>
> for ($c=0;$c<count($tourid);$c++)
>
> I think i mentioned the while loop in my first reply. I should have said
for.
> (See: http://us2.php.net/for, http://us3.php.net/while,
> http://us4.php.net/foreach)
>
> I'm not sure what you mean by "form is posted to itself". Do you have
> the function at the top of the page with the form? If so, you can do
> something like
>
> if($_POST['var']){
>
> add_to_database( $tourid, $dayno, $fromto, $bld, $descrip,
> &$dberror)
> //ideally you'd forward to another page to let the user know the form
> was received OK...
> } else {
>
> //Show form
>
> }
>
> Please post any specific error message you may get, not just "a parse
> error", it will save my eyes!
>
> Thanks,
> Mike
--- End Message ---
--- Begin Message ---
[snip]
> //user connection section--begin
> $username="root";
> $password="";
> $database="nazardane";
[/snip]
If this is actually your login, I would suggest changing it right away
[snip]
> while ($c=0;$c<count($_POST['tourid']):$c++)
[/snip]
Like Mike already said, that should be a for loop. But, you do have
one other option, that I prefer...A foreach loop.
foreach($_POST['tourid'] AS $tour_id {
... now in your code use $tour_id instead of $_POST['tourid'][$c]
}
-Chris
ps...You may want to read through the php turorial again. Lots of
helpful information there. http://us2.php.net/tut.php
--
Christopher Fulton
http://www.fultonfam.com
--- End Message ---
--- Begin Message ---
Everybody sent a return receipt, right? ;)
--
John C. Nichel
�berGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
i have taken on a job replacing an old AS400 RPM
database with four thin clients. They really like the
feel of the thin client interface, no point and click,
no graphics, just green text on a black background. I
could use any suggestions on what to read, or where to
look to find a way to create a similar feel on the new
interface. I am leaning heavily to php, since it would
make the Internet port easier.
Thank You very much for your replies.
Winn Johnston
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message ---
Winn Johnston wrote:
> i have taken on a job replacing an old AS400 RPM
> database with four thin clients. They really like the
> feel of the thin client interface, no point and click,
> no graphics, just green text on a black background. I
> could use any suggestions on what to read, or where to
> look to find a way to create a similar feel on the new
> interface. I am leaning heavily to php, since it would
> make the Internet port easier.
http://php.net/ncurses may be "close"...
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
This is really an HTML and CSS question; PHP, if you use it, generates the
code fed to the browser.
Remember - PHP is SERVER side, not client side.
You can mock this up using HTML, making certain you incorporate all of the
interface features you want to use, tab order, etc. Once you are happy with
it, that HTML is what you will have the PHP script issue, with the
appropriate data fields completed.
Regards - Miles Thompson
At 11:45 AM 2/4/2005, Winn Johnston wrote:
i have taken on a job replacing an old AS400 RPM
database with four thin clients. They really like the
feel of the thin client interface, no point and click,
no graphics, just green text on a black background. I
could use any suggestions on what to read, or where to
look to find a way to create a similar feel on the new
interface. I am leaning heavily to php, since it would
make the Internet port easier.
Thank You very much for your replies.
Winn Johnston
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Winn Johnston wrote:
i have taken on a job replacing an old AS400 RPM
database with four thin clients. They really like the
feel of the thin client interface, no point and click,
no graphics, just green text on a black background. I
could use any suggestions on what to read, or where to
look to find a way to create a similar feel on the new
interface. I am leaning heavily to php, since it would
make the Internet port easier.
the look & feel of the client can't be controlled by
PHP directly unless you're looking a php-gtk.
output basic/clean HTML with a few well placed
class attributes. set backgrounds to black
and text to green... (in a stylesheet?) -
(I'm not suggesting mimicking
a B/G console is easy but I think you can approxiate
quite well with out too much effort).
which leave the 'feel':
<label for="ListMenu" accesskey="l"><u>L</u>ist</label>
<select name="ListMenu" id="ListMenu" onkeypress="keyPressGetURL(this, event)">
<option label="..." value="0">...</option>
</select>
use of labels in conjunction with accesskey attributes
and possibly javascript (e.g. to trap keypress events)
would possibly help here, hitting ALT+L on a page containing
the preceeding example would cause focus to jump to
the select dropdown. (keyPressGetURL() submits the form if
ENTER is pressed while the select has focus)
additionally accesskey attribs on button-type form inputs
will cause the onclick event to fire when the shortcut is used:
<input type="button" class="IconButton"
id="MyDetailsButton" accesskey="m"
onclick="getURL('userdetails.php')" value="My Details" />
this may not work the same in all browsers.
Thank You very much for your replies.
Winn Johnston
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message ---
Daniel Bowett wrote:
> Marek Kilimajer wrote:
>> Daniel Bowett wrote:
>>
>>> Hi,
>>>
>>> I have been reading up on the mcrypt function. Is it possible to use
>>> it with a public and private key pair or just with a single key?
>>>
>>> Cheers.
>>>
>>
>> mcrypt supports only single key
>>
>
> Is there anything out there that supports public/private key other than
> using gpg through the command line?
http://php.net/ssh2 MIGHT have what you need...
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Just bouncing a thought on you.
I currently have a default exception handler setup.
So far in the code, I throw an exception when something is wrong.
i.e. Missing file, invalid argument, failed db connection etc...
My thought was centering around if I still needed to use
try/catch in the code, since I have a default exception handler.
Normally, I would rethrow exceptions for it to bubble back up to the top,
where its caught, and something useful done with the stack.
So I removed all try/catch blocks, and its seems to be working as it
should be.
Just wondering if there may be an "gotchas" with this chain of thought.
Or should I keep the try/catch blocks as it is???
Thanks
--- End Message ---
--- Begin Message ---
Gerard Samuel wrote:
Just bouncing a thought on you.
I currently have a default exception handler setup.
So far in the code, I throw an exception when something is wrong.
i.e. Missing file, invalid argument, failed db connection etc...
My thought was centering around if I still needed to use
try/catch in the code, since I have a default exception handler.
Normally, I would rethrow exceptions for it to bubble back up to the top,
where its caught, and something useful done with the stack.
So I removed all try/catch blocks, and its seems to be working as it
should be.
Just wondering if there may be an "gotchas" with this chain of thought.
Or should I keep the try/catch blocks as it is???
I think you should leave them in. the idea behind the default exception
handler is
to catch uncaught exceptions - uncaught exceptions should be the exception
rather than the rule.
also you don't have to rethrow exceptions, sometimes its very useful to just
catch (possibly ignore) and continue execution just past the catch block.
http://be.php.net/manual/en/function.set-exception-handler.php
<the gotcha>
tha manual states that execution stops after the exception handler in called,
which is fairly limiting.
</the gotcha>
Another way to look at it would be to specify that all 'pages'
are based on the following:
try {
// global include
// process some stuff
// do output
}
catch (Exception $e) {
// error - show 404 or something?
}
another thing about exceptions, you can be
very specific about catching, also the catches
can be 'stacked':
try {
}
catch (DBException $e) {
}
catch (UnknownObject $e) {
}
catch (Exception $e) {
}
this implies that the code uses user defined
Exception subclasses. i.e. you can write your own
Exception classes that you can throw around :-)
Thanks
--- End Message ---
--- Begin Message ---
Jochem Maas wrote:
Gerard Samuel wrote:
Just bouncing a thought on you.
I currently have a default exception handler setup.
So far in the code, I throw an exception when something is wrong.
i.e. Missing file, invalid argument, failed db connection etc...
My thought was centering around if I still needed to use
try/catch in the code, since I have a default exception handler.
Normally, I would rethrow exceptions for it to bubble back up to the
top,
where its caught, and something useful done with the stack.
So I removed all try/catch blocks, and its seems to be working as it
should be.
Just wondering if there may be an "gotchas" with this chain of thought.
Or should I keep the try/catch blocks as it is???
I think you should leave them in. the idea behind the default
exception handler is
to catch uncaught exceptions - uncaught exceptions should be the
exception
rather than the rule.
also you don't have to rethrow exceptions, sometimes its very useful
to just
catch (possibly ignore) and continue execution just past the catch block.
http://be.php.net/manual/en/function.set-exception-handler.php
<the gotcha>
tha manual states that execution stops after the exception handler in
called,
which is fairly limiting.
</the gotcha>
Another way to look at it would be to specify that all 'pages'
are based on the following:
try {
// global include
// process some stuff
// do output
}
catch (Exception $e) {
// error - show 404 or something?
}
another thing about exceptions, you can be
very specific about catching, also the catches
can be 'stacked':
try {
}
catch (DBException $e) {
}
catch (UnknownObject $e) {
}
catch (Exception $e) {
}
this implies that the code uses user defined
Exception subclasses. i.e. you can write your own
Exception classes that you can throw around :-)
I understand what you're getting at.
Let me describe a little more of my setup.
All requests go through the framework's index.php, where
I used to have something like what you described ->
<?php
try
{
// code for page
}
catch(Exception $e)
{
// Log exception
// Display pretty error page with stack
die;
}
?>
The problem with this, is that its possible for the logging mechanism,
to throw an exception, leaving the exception not logged, along with the
default *ugly*
page.
So thats when I decided to start using the default exception handler.
Currently, I have the default exception handler, log the exception,
and display a *pretty* page.
If the logging mechanism does throw an exception, the exception will not
be logged, but at least, the *pretty* page does display.
Your point about page execution stopping after the default exception
handler is
called, is acceptable for me.
From my original email ->
So far in the code, I throw an exception when something is wrong.
i.e. Missing file, invalid argument, failed db connection etc...
What I mean by this is that if the code sees that there is no other
way to go, to throw an exception.
With the setup Im currently using, I should still be able to use
exceptions to
control execution flow, as long as they are tried/caught properly.
As I understand it, exceptions can be used to
a) Handle errors
b) Control execution flow
Right now, Im only concerned about a).
Hopefully that makes my situation a bit clearer.
So with this in mind, the default exception handler, handles
the *pretty* error page, and tries to log the exception.
And I remove all try/catch blocks from the framework code (the reason
for this email).
Then in the application, that runs on top of the framework, then I
can use try/catch to control code execution.
I hope that was clearer.
If I've missed the point, feel free to bash me in my head ;).
--- End Message ---
--- Begin Message ---
Adi Pramadi wrote:
> I'm new in PHP programing, and i need a way to add date in php.
>
> here is the sample
>
> If today is 29/01/2005 (dd/mm/yy)
> and i need to make an apointment for another 10 days
> the date recorded sould be 08/02/2005 and not 39/01/2005
>
> is there a way to do it in just like in asp (add date) ?
http://php.net/mktime
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Nuzzo Art-CINT116 wrote:
> Hopefully this is an easy question. I need to set the default numeric
> data format when selecting data from an oracle database using PHP OCI
> interface.
>
>
> The SQLPLUS command is:
>
> SET NUMBERFORMAT 99990.999
>
> How would I send this from PHP? I need to do the format at the datebase
> server instead of reformatting in PHP to work around PHP bug 30726.
It's a query.
Just send it the same way you send every query.
$query = "set numberformat 99990.999";
$result = sqlplus_query($query); //Use the SAME thing as for SELECT query.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
What options are available regarding connection pooling using PHP?
I understand how to accomplish this using Java but PHP is another language.
Thanks.
HTC Disclaimer: The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of this message
is not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby notified that
any dissemination, distribution or copying of this communication is strictly
prohibited. If you have received this communication in error, please notify us
immediately by replying to the message and deleting it from your computer.
Thank you.
--- End Message ---
--- Begin Message ---
Bosky, Dave wrote:
What options are available regarding connection pooling using PHP?
I understand how to accomplish this using Java but PHP is another language.
for most db extensions there are persistent variants of the connect
functions.
e.g. ibase_pconnect()
php is unlike java in that there is a share nothing architecture and that
the whole php environment esentially dies after every request....
this FAQ from Oracle gives a hint as to the situation also:
http://www.orafaq.com/faqphp.htm#POOLING
sorry I can't be of more help - I have no experience with Java
or connection pooling as such.
Thanks.
--- End Message ---
--- Begin Message ---
Scott Mueller wrote:
> modernbill is no longer working for a customer all of a sudden. It
> seems that function_exists('gzcompress') now returns false for some
> reason. Does anybody have any ideas what might've happened and how I
> can correct this? Our customer is effectively down from this, so i'm
> very anxious to help him out.
Somebody upgraded PHP and left out --with-zlib???
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Is there a single bit of code for scrubbing all the cookies or do I have to
do setcookie ("name, "") for all of them??
--- End Message ---
--- Begin Message ---
Ross Hulford wrote:
Is there a single bit of code for scrubbing all the cookies or do I have to
do setcookie ("name, "") for all of them??
foreach($_COOKIE as $name => $value) {
setcookie($name, '', time() - 36000);
}
--- End Message ---
--- Begin Message ---
A friend of mine is looking for one each of the following web appz:
1) Job Recruitment
A bundle of scripts that will allow someone to manage job listings and
accept applications online.
2) Online Support Ticketing
Users submit issues, and they are resolved by the support team.
Resolutions may be shared in a searchable knowledgebase.
Anyone know of any solid PHP projects that deal with these issues?
Just didn't want to reinvent the wheel.
Thank you,
Jason
--- End Message ---
--- Begin Message ---
Important document!
--- End Message ---