php-general Digest 7 Nov 2004 22:49:24 -0000 Issue 3099
Topics (messages 201415 through 201451):
Re: Javascript and php
201415 by: Jordi Canals
201416 by: Bruno B B Magalhães
201417 by: Reinhart Viane
Help:escape_string and stripslashes
201418 by: Stuart Felenstein
201420 by: Jordi Canals
201421 by: Stuart Felenstein
201422 by: Stuart Felenstein
201423 by: Jason Wong
201424 by: Stuart Felenstein
How to get WIN-1255 encoded string
201419 by: Marina Markus
201436 by: Manuel Lemos
Extension help
201425 by: Kevin
Re: loking for a item in string?
201426 by: Greg Donald
201427 by: Kevin
201429 by: M. Sokolewicz
201432 by: Murray . PlanetThoughtful
Re: CONGRATULATION (YOU JUST WON LOTTERY)
201428 by: John Nichel
Re: pspell problems
201430 by: John Nichel
201444 by: Noodles
Re: images doesn't seem to cache
201431 by: anders thoresson
Wirred problem with "500 Internal Server Error"
201433 by: Michelle Konzack
201438 by: Michelle Konzack
Question: array_walk
201434 by: Stuart Felenstein
201442 by: M. Sokolewicz
Is that something like perldoc in PHP ?
201435 by: Exile
201441 by: M. Sokolewicz
Auto Form Fill on option select
201437 by: Kevin Dell
201447 by: Jonel Rienton
recursive function not returning anything..
201439 by: nate.savingadvice.com
201440 by: M. Sokolewicz
201443 by: nate.savingadvice.com
Re: [PHP-I18N] How to get WIN-1255 encoded string
201445 by: Fredrik Tolf
201446 by: Fredrik Tolf
[SOLVED] Re: Wirred problem with "500 Internal Server Error"
201448 by: Michelle Konzack
Re: Is there an HTTP server that parses PHP that will run on the Axim x3i?
201449 by: Megiddo
FW by [EMAIL PROTECTED] : *****SPAM_sub***** failure notice
201450 by: Michelle Konzack
Re: Syntax problem - dynamic static member access
201451 by: Jake Press
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 ---
On Sun, 7 Nov 2004 11:44:33 +0100, Reinhart Viane <[EMAIL PROTECTED]> wrote:
> Hope some of you also work on sundays :)
>
> I have a little javascript which displays a images (with previous / next
> thing)
> Now, i populate the javascript array with an php array:
>
> <SCRIPT LANGUAGE="JavaScript">
>
> <!-- Begin
> NewImg = new Array (
> <?php
> while($row = mysql_fetch_object($result)){
> echo "\"".$row->picture_url."\",";
> }
> ?>
> "../pictures/7_stripper3.jpg",
> "../pictures/7_stripper2.jpg"
> );
> var ImgNum = 0;
> var ImgLength = NewImg.length - 1;
> ...
> </script>
>
> As you can see i echo the url of the picture.
> After each picture url there needs to be a ','
> But not after the last picture.
> At this moment all pictures have the ',' after there url, even the last
> one.
> Any way to determine if the url is the url of the last picture and thus
> not printing a ',' behind that last one?
>
Yes ... some work on sunday ;), at least to read the list
I took no much time to find out a solution for your problem, but a
possible question could be:
<?php
$list = array()
while($row = mysql_fetch_object($result)){
$list[] = '"'. $row->picture_url .'"';
}
echo implode(',', $list);
}
?>
Another solution :
<?php
$string = ''
while($row = mysql_fetch_object($result)){
$string .= "\"".$row->picture_url."\",";
}
$string = substr($string, 0, strlen($string - 1);
?>
I have no tested the solutions, so could be some sintax error. But to
give you a couple of examples, hope that helps
Jordi
--- End Message ---
--- Begin Message ---
Reinhart,
<?php
for($i = 0; $i < mysql_num_rows($result)-1; $i++)
{
$row = mysql_fetch_object($result);
echo '"'.$row->picture_url.'"';
if($i <= mysql_num_rows($result)-2)
{
echo ',';
}
}
?>
Here is how I do in my developments.
Regards,
Bruno B B Magalhães
On Nov 7, 2004, at 8:44 AM, Reinhart Viane wrote:
Hey all,
Hope some of you also work on sundays :)
I have a little javascript which displays a images (with previous /
next
thing)
Now, i populate the javascript array with an php array:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
NewImg = new Array (
<?php
while($row = mysql_fetch_object($result)){
echo "\"".$row->picture_url."\",";
}
?>
"../pictures/7_stripper3.jpg",
"../pictures/7_stripper2.jpg"
);
var ImgNum = 0;
var ImgLength = NewImg.length - 1;
...
</script>
As you can see i echo the url of the picture.
After each picture url there needs to be a ','
But not after the last picture.
At this moment all pictures have the ',' after there url, even the last
one.
Any way to determine if the url is the url of the last picture and thus
not printing a ',' behind that last one?
Thx in advance,
Reinhart
_____
Reinhart Viane
<mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
Domos || D-Studio
Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01
--
fax +32 15 43 25 26
STRICTLY PERSONAL AND CONFIDENTIAL
This message may contain confidential and proprietary material for the
sole use of the intended
recipient. Any review or distribution by others is strictly
prohibited.
If you are not the intended
recipient please contact the sender and delete all copies.
--- End Message ---
--- Begin Message ---
Thank you very much,
After some small adjustements to make it work with the rest of the
javascript it works like a charm!!
Have a nice Sunday :)
Greetings,
Reinhart
-----Original Message-----
From: Bruno B B Magalhães [mailto:[EMAIL PROTECTED]
Sent: zondag 7 november 2004 12:33
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Javascript and php
Reinhart,
<?php
for($i = 0; $i < mysql_num_rows($result)-1; $i++)
{
$row = mysql_fetch_object($result);
echo '"'.$row->picture_url.'"';
if($i <= mysql_num_rows($result)-2)
{
echo ',';
}
}
?>
Here is how I do in my developments.
Regards,
Bruno B B Magalhães
On Nov 7, 2004, at 8:44 AM, Reinhart Viane wrote:
> Hey all,
> Hope some of you also work on sundays :)
>
> I have a little javascript which displays a images (with previous /
> next
> thing)
> Now, i populate the javascript array with an php array:
>
> <SCRIPT LANGUAGE="JavaScript">
>
> <!-- Begin
> NewImg = new Array (
> <?php
> while($row = mysql_fetch_object($result)){
> echo "\"".$row->picture_url."\",";
> }
> ?>
> "../pictures/7_stripper3.jpg",
> "../pictures/7_stripper2.jpg"
> );
> var ImgNum = 0;
> var ImgLength = NewImg.length - 1;
> ...
> </script>
>
> As you can see i echo the url of the picture.
> After each picture url there needs to be a ','
> But not after the last picture.
> At this moment all pictures have the ',' after there url, even the
> last one. Any way to determine if the url is the url of the last
> picture and thus not printing a ',' behind that last one?
>
> Thx in advance,
>
> Reinhart
>
> _____
>
> Reinhart Viane
> <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
> Domos || D-Studio
> Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01
> --
> fax +32 15 43 25 26
>
>
> STRICTLY PERSONAL AND CONFIDENTIAL
> This message may contain confidential and proprietary material for the
> sole use of the intended recipient. Any review or distribution by
> others is strictly prohibited.
> If you are not the intended
> recipient please contact the sender and delete all copies.
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I asked a question yesterday about this but I think my
question is now more fine tuned:
Right now I have about 50+ session variables that will
be inserted into my mysql database in a transaction.
I need to do the mysql_real_escape_string and because
magic_quotes_gpc is turned on stripslashes as well.
I'm wondering if there is a way to use a function or
class within my connection script to take care of all
of this ? As oppposed to listing everyone out ? I
know I can pass all the variables as an array but some
of the variabls are arrays themselves, so not sure how
that would work.
Any suggestions ?
Thank you
Stuart
--- End Message ---
--- Begin Message ---
On Sun, 7 Nov 2004 03:52:28 -0800 (PST), Stuart Felenstein
<[EMAIL PROTECTED]> wrote:
> I asked a question yesterday about this but I think my
> question is now more fine tuned:
>
> Right now I have about 50+ session variables that will
> be inserted into my mysql database in a transaction.
> I need to do the mysql_real_escape_string and because
> magic_quotes_gpc is turned on stripslashes as well.
>
> I'm wondering if there is a way to use a function or
> class within my connection script to take care of all
> of this ? As oppposed to listing everyone out ? I
> know I can pass all the variables as an array but some
> of the variabls are arrays themselves, so not sure how
> that would work.
>
In the manual http://es2.php.net/manual/en/function.get-magic-quotes-gpc.php
you have an example just for that. Take a look to the Example 2.
The way I do it, is using that function, but think the example in the
manual is much better:
function array_deslash(&$array) {
foreach ($array as $key => $value) {
if (is_string($value)) {
$array[$key] = stripslashes($value);
} elseif (is_array($value)) {
array_deslash($arrau[$key]);
}
}
}
Hope this helps,
Jordi.
--- End Message ---
--- Begin Message ---
--- Jordi Canals <[EMAIL PROTECTED]> wrote:
> In the manual
>
http://es2.php.net/manual/en/function.get-magic-quotes-gpc.php
> you have an example just for that. Take a look to
> the Example 2.
>
Ok, that makes sense. Thank you .
Stuart
--- End Message ---
--- Begin Message ---
--- Stuart Felenstein <[EMAIL PROTECTED]> wrote:
On second thought, I have a question. What is the
$value in the example ?
Does that mean I put in my own values ?
Stuart
<?php
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value)
{
$value = is_array($value) ? <---?
array_map('stripslashes_deep',
$value) :
stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep',
$_COOKIE);
}
?>
--- End Message ---
--- Begin Message ---
On Sunday 07 November 2004 13:03, Stuart Felenstein wrote:
> On second thought, I have a question. What is the
> $value in the example ?
$_POST, then $_GET, then $_COOKIE
> Does that mean I put in my own values ?
1) No.
2) Lookup array_map() and understand what it does.
3) stripslashes_deep() is a recursive function (ie. it calls itself). You
should find a good tutorial on recursive functions to learn exactly what it
does.
> <?php
> if (get_magic_quotes_gpc()) {
> function stripslashes_deep($value)
> {
> $value = is_array($value) ? <---?
> array_map('stripslashes_deep',
> $value) :
> stripslashes($value);
>
> return $value;
> }
>
> $_POST = array_map('stripslashes_deep', $_POST);
> $_GET = array_map('stripslashes_deep', $_GET);
> $_COOKIE = array_map('stripslashes_deep',
> $_COOKIE);
> }
> ?>
--
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
------------------------------------------
/*
ASHes to ASHes, DOS to DOS.
*/
--- End Message ---
--- Begin Message ---
--- Jason Wong <[EMAIL PROTECTED]> wrote:
> 2) Lookup array_map() and understand what it does.
>
> 3) stripslashes_deep() is a recursive function (ie.
> it calls itself). You
> should find a good tutorial on recursive functions
> to learn exactly what it
> does.
Thank you Jason.
Another thing I'm wondering and not clear on .
I have 5 pages of forms, a 6th page is where the
processing , transaction is taking place.
Would it be sufficient to add stripslashes_deep() to
only the last page (6th page) ?
Each succeeding page, posts the previous page
varibles.
I'm guessing the last (6th page) would be enough, but
would like to confirm.
Stuart
--- End Message ---
--- Begin Message ---
Hello,
I am desperately looking for a solution of a problem that seems quite
simple.
I need a PHP script to create an email message in a way that a subject line
in Hebrew will be readable in all mail clients. Some mail clients cannot
cope with Hebrew if they don't have character set explicitly denoted.
Is there a possibility in PHP allowing to encode a string
with WIN-1255 character set encoding? The result should look like:
=?windows-1255?B?Rlc6IOz26eHl+CDk8uXj6e0=?=
which the mail client then is able to decode back into Hebrew.
If anyone has a solution for another character set, I suppose it can also
help.
Will be grateful for any hint or idea.
Marina Markus
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Hello,
On 11/07/2004 09:57 AM, Marina Markus wrote:
I am desperately looking for a solution of a problem that seems quite
simple.
I need a PHP script to create an email message in a way that a subject line
in Hebrew will be readable in all mail clients. Some mail clients cannot
cope with Hebrew if they don't have character set explicitly denoted.
Is there a possibility in PHP allowing to encode a string
with WIN-1255 character set encoding? The result should look like:
=?windows-1255?B?Rlc6IOz26eHl+CDk8uXj6e0=?=
which the mail client then is able to decode back into Hebrew.
You can use this class for that purpose easily. Just set the
default_charset class variable to that windows-1255 and the class will
compose and send the message assuming that text in the body and in the
headers are encoded that way.
http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--- End Message ---
--- Begin Message ---
Hello all,
I have the source code for a C library who's functions i wish to
expose to php. Ideally i'd like to be able to use dl() or put the
library file location into php.ini to allow use of the functions.
Is there a tutorial on how to do this? I've read over the Zend API
stuff, and i dont mind doing some configuation, but a list of the steps
would be very handy today...
--- End Message ---
--- Begin Message ---
On Sat, 6 Nov 2004 21:58:49 -0600, Dustin Wish with INDCO Networks
<[EMAIL PROTECTED]> wrote:
> I am opening a file and then have to look for a value inside the string. Is
> there an easy way to do this?
>
> I need the value in this string for the var djLast = '45.119999';
preg_match() can do that.
php.net/preg_match
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/
--- End Message ---
--- Begin Message ---
On Sun, Nov 07, 2004 at 08:32:53AM -0600, Greg Donald wrote:
> On Sat, 6 Nov 2004 21:58:49 -0600, Dustin Wish with INDCO Networks
> preg_match() can do that.
>
> php.net/preg_match
>
Easiest possible way to do this ( for you the programmer ) is to slurp
the whole file in as a string and search for your pattern across
newlines
--- End Message ---
--- Begin Message ---
I'd rather suggest using strpos(), seen as it's quite a bit faster than
using a regular expression engine (especially when you don't need one)
Greg Donald wrote:
On Sat, 6 Nov 2004 21:58:49 -0600, Dustin Wish with INDCO Networks
<[EMAIL PROTECTED]> wrote:
I am opening a file and then have to look for a value inside the string. Is
there an easy way to do this?
I need the value in this string for the var djLast = '45.119999';
preg_match() can do that.
php.net/preg_match
--- End Message ---
--- Begin Message ---
> I'd rather suggest using strpos(), seen as it's quite a bit faster than
> using a regular expression engine (especially when you don't need one)
>
> Greg Donald wrote:
> > On Sat, 6 Nov 2004 21:58:49 -0600, Dustin Wish with INDCO Networks
> > <[EMAIL PROTECTED]> wrote:
> >
> >>I am opening a file and then have to look for a value inside the string.
> Is
> >>there an easy way to do this?
> >>
> >>I need the value in this string for the var djLast = '45.119999';
> >
> >
> >
> > preg_match() can do that.
> >
> > php.net/preg_match
>From how I read the question, preg_match is the better approach. I don't
think Dustin is attempting to simply verify that the substring is in the
string, but is attempting to return the value that appears between the
single quote characters after the existence of 'djLast = '. Presumably this
value could be '45.119999', as in his example, or '26.3333333', or
'98.123456' and so on. I think Dustin is attempting to find out what that
value is.
preg_match is how I'd achieve this as well.
Much warmth,
Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
One quirky comment at a time.
--- End Message ---
--- Begin Message ---
-{ Rene Brehmer }- wrote:
Spam message reported, original sender added to permanent blacklist
Have a nice day
Rene
At 02:56 06-11-2004, floydjeffers wrote:
[skip spam]
But....but....but....what if we really won? ;)
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--- End Message ---
--- Begin Message ---
Noodles wrote:
I've spent the last 6 hours or so trying to get pspell going on my php
install, version 4.3.9. I've searched all over the net, but haven't
found a solution.
I'm using debian so I'm using the packaged version of php4 and apache. I
installed aspell using apt-get and then downloaded and compiled pspell
0.12.2. I downloaded php4 off the php.net site and used it to compile a
pspell.so file, which seemed to work until I tried to check a word. I get:
To the best of my knowledge, you don't have to complie/install pspell
anymore to have the functions work with php...only need aspell (as both
aspell and pspell are combined in the aspell release)
Warning: PSPELL couldn't open the dictionary. reason: I'm sorry I can't
find any suitable word lists for the language-tag "en".
Did you install a dictionary? If not, that's what you need to do. If
you want English....
http://packages.debian.org/unstable/text/aspell-en
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--- End Message ---
--- Begin Message ---
I tried it with just aspell (including the aspell-en dictionary package)
and whenever I tried to configure php to use pspell it couldn't find
pspell (./configure --with-pspell)
John Nichel wrote:
Noodles wrote:
I've spent the last 6 hours or so trying to get pspell going on my php
install, version 4.3.9. I've searched all over the net, but haven't
found a solution.
I'm using debian so I'm using the packaged version of php4 and apache.
I installed aspell using apt-get and then downloaded and compiled
pspell 0.12.2. I downloaded php4 off the php.net site and used it to
compile a pspell.so file, which seemed to work until I tried to check
a word. I get:
To the best of my knowledge, you don't have to complie/install pspell
anymore to have the functions work with php...only need aspell (as both
aspell and pspell are combined in the aspell release)
Warning: PSPELL couldn't open the dictionary. reason: I'm sorry I
can't find any suitable word lists for the language-tag "en".
Did you install a dictionary? If not, that's what you need to do. If
you want English....
http://packages.debian.org/unstable/text/aspell-en
--- End Message ---
--- Begin Message ---
it won't be a php-parameter. Seen as the script isn't executed when the
server decides it is the same as the cached version. So only if it deems
not to be, then it runs the script, and when it does that, the script
doesn't need to know anything about modified-since, because that checks
has long since been passed.
Really? It's not until the script is executed that the acutal image is
accessed. Until, it's only refered to as a picture id, and int-value.
Your suggestion was to use If-Modified-Since. How and where should I
do a check for it?
Best regards,
Anders
--- End Message ---
--- Begin Message ---
Hello all,
I was working on my OnlineStore up to 04:30 in the morning and all was
working fine. Now for 20 minutes a friend has called me, my OnlineStore
give an error.
After checking I do not know, so I have
echo "<?php echo=\"What the hell... ?\"; ?>" >pest.php
and called it with
<http://onlinestore.tamay-dogan.homelinux.net/pest.php>
Why do I get an errror ?
There is nothin special...
All of my php Scripts stop working.
(I run 168 VirtualHosts on a Debian GNU/Linux 3.0 Server)
Greetings
Michelle
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
signature.pgp
Description: Digital signature
--- End Message ---
--- Begin Message ---
Forgotten to post the error.log:
[Sun Nov 7 18:45:13 2004] [error] (13)Permission denied: exec of /home/
onlinstore/public_html/pest.php failed
[Sun Nov 7 18:45:15 2004] [error] [client 65.222.145.42] Premature end
of script headers: /home/onlinestore/public_html/pest.php
and access.log:
onlinestore.tamay-dogan.homelinux.net 65.222.145.42 - - [07/Nov/2004:18:
45:15 +0100] "GET /pest.php HTTP/1.1" 500 686 "-" "Mozilla/5.0 (X11; U;
Linux i686; en-US; rv:1.5) Gecko/20031007 Firebird/0.7" 2
I have checked the logs and it was working at 4:30 in the morning.
So I do not know, whats going on...
It must have something to do with php, because all other stuff is
working fine.
At 17:15 I have done a security update, but has not changed anything.
Greetings
Michelle
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
signature.pgp
Description: Digital signature
--- End Message ---
--- Begin Message ---
This array_walk() looks like a good function
Would this be a legitimate call:
array_walk($myarray, 'mysql_real_escape_string');
?
Thank you,
Stuart
--- End Message ---
--- Begin Message ---
Stuart Felenstein wrote:
This array_walk() looks like a good function
Would this be a legitimate call:
array_walk($myarray, 'mysql_real_escape_string');
?
Thank you,
Stuart
array_map() is faster :)
--- End Message ---
--- Begin Message ---
Thanks in advise,
Exile
--- End Message ---
--- Begin Message ---
Exile wrote:
Thanks in advise,
Exile
is what like perldoc?
--- End Message ---
--- Begin Message ---
Hi all,
I have a question that I can't get my head around and was hoping someone
could answer for me.
I have a form with a number of fields.
Field one is a <td><select name="thisSteamField"></td>
The option fields are built from an sql statement and a where clause builds
the options fields
...
<option value="<? echo $teamname; ?>"><? echo $teamname;
?></option>
....
etc...
When I select one of the options, the form automatically goes off and does
another sql select a with the WHERE value of the selected $teamname, and
then populates the next field, but I can't think how.
Any pointers?
TIA
K
--- End Message ---
--- Begin Message ---
This can be done with javascript or you can use an event-driven solution
like PRADO
> Hi all,
> I have a question that I can't get my head around and was hoping
> someone
> could answer for me.
>
> I have a form with a number of fields.
>
> Field one is a <td><select name="thisSteamField"></td>
> The option fields are built from an sql statement and a where clause
> builds the options fields
> ...
> <option value="<? echo $teamname; ?>"><? echo
> $teamname;
> ?></option>
> ....
> etc...
>
> When I select one of the options, the form automatically goes off and
> does another sql select a with the WHERE value of the selected
> $teamname, and then populates the next field, but I can't think how.
>
> Any pointers?
>
> TIA
> K
--
--- End Message ---
--- Begin Message ---
function recursePathLookup($CatID, $Path = array()) {
//Get the catid for this subcat
$sql = "SELECT SubCategoryID, Name FROM categories WHERE CategoryID =
'".$CatID."'";
$query = mysql_query($sql);
if(mysql_num_rows($query) == 1) {
$data = mysql_fetch_array($query);
$Path[] = $data["Name"];
recursePathLookup($data["SubCategoryID"], $Path);
} else {
//print_r($Path);
return $Path;
}
}
print_r(recursePathLookup(2));
Any ideas why when I uncomment the //print_r($Path) inside the function it
prints the value fine, but when I try to return the value and print it
outside the function I get nothing?
Thanks,
Nate
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
function recursePathLookup($CatID, $Path = array()) {
//Get the catid for this subcat
$sql = "SELECT SubCategoryID, Name FROM categories WHERE CategoryID =
'".$CatID."'";
$query = mysql_query($sql);
if(mysql_num_rows($query) == 1) {
$data = mysql_fetch_array($query);
$Path[] = $data["Name"];
recursePathLookup($data["SubCategoryID"], $Path);
change to:
return recursePathLookup($data["SubCategoryID"], $Path);
} else {
//print_r($Path);
return $Path;
}
}
print_r(recursePathLookup(2));
Any ideas why when I uncomment the //print_r($Path) inside the function it
prints the value fine, but when I try to return the value and print it
outside the function I get nothing?
Thanks,
Nate
--- End Message ---
--- Begin Message ---
Of course! Thank you.
Nate
-----Original Message-----
From: M. Sokolewicz [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 07, 2004 11:03 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: recursive function not returning anything..
[EMAIL PROTECTED] wrote:
> function recursePathLookup($CatID, $Path = array()) {
>
> //Get the catid for this subcat
>
> $sql = "SELECT SubCategoryID, Name FROM categories WHERE CategoryID
=
> '".$CatID."'";
>
> $query = mysql_query($sql);
>
> if(mysql_num_rows($query) == 1) {
>
> $data = mysql_fetch_array($query);
>
> $Path[] = $data["Name"];
>
> recursePathLookup($data["SubCategoryID"], $Path);
change to:
return recursePathLookup($data["SubCategoryID"], $Path);
>
> } else {
>
> //print_r($Path);
>
> return $Path;
>
> }
>
> }
>
>
>
> print_r(recursePathLookup(2));
>
>
>
> Any ideas why when I uncomment the //print_r($Path) inside the function it
> prints the value fine, but when I try to return the value and print it
> outside the function I get nothing?
>
> Thanks,
>
> Nate
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Sun, 2004-11-07 at 13:57 +0200, Marina Markus wrote:
> Hello,
Hi!
> I need a PHP script to create an email message in a way that a subject line
> in Hebrew will be readable in all mail clients. Some mail clients cannot
> cope with Hebrew if they don't have character set explicitly denoted.
I believe that should be _all_ e-mail clients. Since the default MIME
charset is US-ASCII (as per RFC 2047 and 2822), only faulty e-mail
clients would be able to cope with non-ASCII characters without wrapping
the header in MIME.
> Is there a possibility in PHP allowing to encode a string
> with WIN-1255 character set encoding? The result should look like:
>
> =?windows-1255?B?Rlc6IOz26eHl+CDk8uXj6e0=?=
>
> which the mail client then is able to decode back into Hebrew.
If you're running PHP5, you might want to look at iconv_mime_encode. If
not, you can take these functions, which are from a GPL:d webmail I'm
writing, and adapt them to your purpose:
function mimifyhdr($header)
{
if(strpos($header, " ") !== FALSE)
{
$temp = "";
$cp = 0;
while(($np = strpos($header, " ", $cp)) !== FALSE)
{
$temp .= mimifyhdr(substr($header, $cp, $np - $cp)) . " ";
$cp = $np + 1;
}
$temp .= mimifyhdr(substr($header, $cp));
return($temp);
}
$nh = "";
$num = 0;
for($i = 0; $i < strlen($header); $i++)
{
$c = substr($header, $i, 1);
if(ord($c) >= 128)
$num++;
}
if($num == 0)
return($header);
if($num > (strlen($header) / 4))
return("=?UTF-8?B?" . encodemime($header, "base64") . "?=");
$nt = "";
for($i = 0; $i < strlen($header); $i++)
{
$c = substr($header, $i, 1);
if(($c == "=") || (ord($c) >= 128) || ($c == "_"))
{
$nt .= "=" . strtoupper(dechex(ord($c)));
} else if($c == " ") {
$nt .= "_";
} else {
$nt .= $c;
}
}
return("=?UTF-8?Q?" . $nt . "?=");
}
function addhdr($name, $val)
{
global $headers;
if(trim($val) != "")
{
$temp .= $name . ": " . mimifyhdr($val);
$maxlen = strlen($temp);
$ls = 0;
while($maxlen > 70)
{
$cp = $ls + 70;
while(strpos("\t ", substr($temp, $cp, 1)) === FALSE)
{
if(--$cp < $ls)
break;
}
if($cp < $ls)
break;
$temp = substr($temp, 0, $cp) . "\r\n\t" .
substr($temp, $cp+ 1);
$ls = $cp + 3;
$maxlen = strlen($temp) - $ls;
}
$headers .= $temp . "\r\n";
}
}
Note that they take values which are already in the UTF-8 encoding. If
your values aren't in UTF-8, take a look at the iconv function.
> If anyone has a solution for another character set, I suppose it can also
> help.
I'd recommend that you use UTF-8 instead. It's more general than
Windows-1255 (copes with characters outside the Hebrew range), and is
probably supported by more MUAs.
Hope it helps!
Fredrik Tolf
--- End Message ---
--- Begin Message ---
On Sun, 2004-11-07 at 20:42 +0100, Fredrik Tolf wrote:
> On Sun, 2004-11-07 at 13:57 +0200, Marina Markus wrote:
> > Is there a possibility in PHP allowing to encode a string
> > with WIN-1255 character set encoding? The result should look like:
> >
> > =?windows-1255?B?Rlc6IOz26eHl+CDk8uXj6e0=?=
> >
> > which the mail client then is able to decode back into Hebrew.
>
> If you're running PHP5, you might want to look at iconv_mime_encode. If
> not, you can take these functions, which are from a GPL:d webmail I'm
> writing, and adapt them to your purpose:
> [snip]
> return("=?UTF-8?B?" . encodemime($header, "base64") . "?=");
> [snip]
Sorry, it seems the `encodemime' function was mine as well:
function encodemime($text, $encoding)
{
if($encoding == "quoted-printable")
{
$nt = "";
for($i = 0; $i < strlen($text); $i++)
{
$c = substr($text, $i, 1);
if(($c == "=") || (ord($c) >= 128))
$nt .= "=" . dechex(ord($c));
else
$nt .= $c;
}
return($nt);
}
if($encoding == "base64")
return(base64_encode($text));
return($text);
}
Sorry for taking two mails.
Fredrik Tolf
--- End Message ---
--- Begin Message ---
Hello all,
it was realy stupid...
One of my VirtualHosts had
AddHandler cgi-script .php .cgi .sh .pl
but NOT inside the <VirtualHost> directive...
...and has blocked all
Greetings
Michelle
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
signature.pgp
Description: Digital signature
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] (Megiddo) wrote in message news:<[EMAIL PROTECTED]>...
> Is there an HTTP server that parses PHP that will run on the Axim x3i?
>
> I'd really like to know the answer to this question.
>
> I'm a big PHP programmer, and would love to be able to test my scripts on my
> Axim.
Anybody?
--- End Message ---
--- Begin Message ---
Hello,
Whats going on with the ListServer of php.net ?
For every Message I send I get an error Message...
But the E-Mails was correctly delivered...
Greetings
Michelle
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
--- Begin Message ---
Hi. This is the qmail-send program at pb1.pair.com.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.
<[EMAIL PROTECTED]>:
This message is looping: it already has my Delivered-To line. (#5.4.6)
--- Below this line is a copy of the message.
Return-Path: <[EMAIL PROTECTED]>
Received: (qmail 43026 invoked from network); 7 Nov 2004 18:36:01 -0000
Received: from unknown (HELO mailsvc.com) (63.247.192.101)
by pb1.pair.com with SMTP; 7 Nov 2004 18:36:01 -0000
Received: by mailsvc.com (CommuniGate Pro PIPE 4.2)
with PIPE id 102309223; Sun, 07 Nov 2004 11:36:01 -0700
Received: from pb1.pair.com ([216.92.131.4] verified)
by mailsvc.com (CommuniGate Pro SMTP 4.2)
with SMTP id 102309175 for [EMAIL PROTECTED]; Sun, 07 Nov 2004 11:35:47 -0700
Received: (qmail 36721 invoked by uid 1010); 7 Nov 2004 18:35:13 -0000
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: <mailto:[EMAIL PROTECTED]>
list-unsubscribe: <mailto:[EMAIL PROTECTED]>
list-post: <mailto:[EMAIL PROTECTED]>
Delivered-To: mailing list [EMAIL PROTECTED]
Received: (qmail 36055 invoked by uid 1010); 7 Nov 2004 18:35:10 -0000
Delivered-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Date: Sun, 7 Nov 2004 19:34:11 +0100
From: Michelle Konzack <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
protocol="application/pgp-signature"; boundary="rWhLK7VZz0iBluhq"
Content-Disposition: inline
In-Reply-To: <[EMAIL PROTECTED]>
X-Message-Flag: Improper configuration of Outlook is a breeding ground for
viruses. Please take care your Client is configured correctly. Greetings
Michelle.
X-Disclaimer-DE: Eine weitere Verwendung oder die Veroeffentlichung dieser Mail
oder dieser Mailadresse ist nur mit der Einwilligung des Autors gestattet.
Organisation: Michelle's Selbstgebrautes
X-Operating-System: Linux michelle1.private 2.4.18-bf2.4
X-Uptime: 19:25:39 up 6 days, 2:38, 4 users, load average: 0.21, 0.16, 0.11
X-Homepage: http://www.debian.tamay-dogan.homelinux.net/
User-Agent: Mutt/1.5.6i
Subject: [PHP] Re: Wirred problem with "500 Internal Server Error"
X-CIT-MailScanner-Information: Please contact 719-473-2800 for more information
X-CIT-MailScanner-AZ: No Virus Found
X-CIT-MailScanner-SpamCheck: not spam, SpamAssassin (score=-2.599,
required 6, autolearn=not spam, BAYES_00 -2.60)
X-MailScanner-From: [EMAIL PROTECTED]
--rWhLK7VZz0iBluhq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Forgotten to post the error.log:
[Sun Nov 7 18:45:13 2004] [error] (13)Permission denied: exec of /home/
onlinstore/public_html/pest.php failed
[Sun Nov 7 18:45:15 2004] [error] [client 65.222.145.42] Premature end=20
of script headers: /home/onlinestore/public_html/pest.php
and access.log:
onlinestore.tamay-dogan.homelinux.net 65.222.145.42 - - [07/Nov/2004:18:
45:15 +0100] "GET /pest.php HTTP/1.1" 500 686 "-" "Mozilla/5.0 (X11; U;=20
Linux i686; en-US; rv:1.5) Gecko/20031007 Firebird/0.7" 2
I have checked the logs and it was working at 4:30 in the morning.
So I do not know, whats going on...
It must have something to do with php, because all other stuff is
working fine.
At 17:15 I have done a security update, but has not changed anything.
Greetings
Michelle
--=20
Linux-User #280138 with the Linux Counter, http://counter.li.org/=20
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
--rWhLK7VZz0iBluhq
Content-Type: application/pgp-signature; name="signature.pgp"
Content-Description: Digital signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBjmqjC0FPBMSS+BIRAnWhAJwPZVtIwShPXPrCq2NmyPwpSgxLmQCgnLx6
e6ehqcIHV5yaCBTGVlijCN4=
=/0jU
-----END PGP SIGNATURE-----
--rWhLK7VZz0iBluhq--
--- End Message ---
signature.pgp
Description: Digital signature
--- End Message ---
--- Begin Message ---
Thanks Tul,
Okay, so its a limitation :(!!!!
I cant find the line of posts, any idea on it - or possible keywords i
can google with.... ?
I'd like to find out the reasons behind why this a fixed limitation........
Best Regards
Jake Press
M. Sokolewicz wrote:
hi,
it's a limitation, and not allowed in PHP. There was a whole line of
posts about it in internals.
- Tul
--- End Message ---