php-general Digest 5 Dec 2006 22:00:37 -0000 Issue 4498
Topics (messages 245510 through 245541):
Re: Send emails from PHP ... in a secure way
245510 by: Ruben Rubio
245512 by: T.Lensselink
245513 by: Ruben Rubio
245515 by: Jochem Maas
Re: EZ array problem - What's wrong with my brain?
245511 by: Colin Guthrie
Re: Problems with Zip+IE6
245514 by: Javier Ruiz
245530 by: Richard Lynch
utf8 encoding £ to £ problem
245516 by: Chris Dean
245517 by: James Nunnerley
245518 by: Edward Kay
245519 by: Chris Dean
245521 by: Jochem Maas
245538 by: tedd
Re: LDAP & Active Directory Authentication
245520 by: Jay Blanchard
Re: Error in php doc?
245522 by: MS P
245523 by: Roman Neuhauser
Error with array and include
245524 by: Fernando M. M.
245525 by: T.Lensselink
245526 by: Fernando M. M.
245529 by: Richard Lynch
firefox only problem
245527 by: Ross
245541 by: Jochem Maas
Re: Pass a relative path [with slashes] into a 'clean' url
245528 by: Aaron Koning
245532 by: Richard Lynch
245537 by: Graham Anderson
Re: Distinguishing between a mouse click and a refresh?
245531 by: Richard Lynch
245540 by: Mark London
Re: illegal characters
245533 by: Richard Lynch
Re: Sending E-mail
245534 by: Richard Lynch
Re: hiding passwd in cmdlines that appear in the process list
245535 by: Richard Lynch
Re: problem with register globals on new server
245536 by: Richard Lynch
Re: Help me about audio stream...
245539 by: Richard Lynch
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 ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
clive escribió:
> Ruben Rubio wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
> the MTA then something is very wrong
>
> Why cant you save the email in a file or a database and then send it
> later your self?
Because if Mail server has a problem like server is down, or is busy, or
has too many concurrent connections ... it will reject temporary the
email. But that the email sent from php application _NEVER_ will try to
resend the email. Temporary problem, is an error for the log ... but the
email is lost.
In that case, It would be interesting save temporary the email in order
to be able to resend it later.
>
> clive
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFdUImIo1XmbAXRboRAkajAJ92ziV90uB7A9SQwlq7HnCAq/eWBwCgqobh
ie72JNl+RNjKq9V1TfweAJY=
=XVCd
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
You can store the emails in a database or textfile when an error occurs.
And use crontab to check the stored messages and send them to the mailserver.
On Tue, 05 Dec 2006 10:55:50 +0100, Ruben Rubio <[EMAIL PROTECTED]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> clive escribió:
>> Ruben Rubio wrote:
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>> the MTA then something is very wrong
>>
>> Why cant you save the email in a file or a database and then send it
>> later your self?
>
> Because if Mail server has a problem like server is down, or is busy, or
> has too many concurrent connections ... it will reject temporary the
> email. But that the email sent from php application _NEVER_ will try to
> resend the email. Temporary problem, is an error for the log ... but the
> email is lost.
>
> In that case, It would be interesting save temporary the email in order
> to be able to resend it later.
>
>>
>> clive
>>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFdUImIo1XmbAXRboRAkajAJ92ziV90uB7A9SQwlq7HnCAq/eWBwCgqobh
> ie72JNl+RNjKq9V1TfweAJY=
> =XVCd
> -----END PGP SIGNATURE-----
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
T.Lensselink escribió:
> You can store the emails in a database or textfile when an error occurs.
> And use crontab to check the stored messages and send them to the mailserver.
Is out there something that actually do it?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFdU1QIo1XmbAXRboRAt3nAJ9i/4jeCc8txFEUtceXHASv8TindwCeJ4TK
WZUx6Fi1/kGOmxDmOttePNo=
=lV7r
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Ruben Rubio wrote:
> T.Lensselink escribió:
>> You can store the emails in a database or textfile when an error occurs.
>> And use crontab to check the stored messages and send them to the mailserver.
>
> Is out there something that actually do it?
php, perl, python, ruby, c, c++ ... just about any programming language you
care to
mention.
of your looking for a turnkey solution you might consider doing a little
searching
(google, sourceforge, etc) - you never know what's out there until you look.
--- End Message ---
--- Begin Message ---
Brian Dunning wrote:
> That works, but the value 1.2 is unknown, I can't hardcode it.
If it is only a one element array you have several options.
foreach ($array as $unknown_key=>$the_values)
{
...
}
or
reset($array);
$the_values = current($array);
$unknown_key = key($array);
or
various other clever things with list and each.....
Col.
--- End Message ---
--- Begin Message ---
BUMP!
---------- Forwarded message ----------
From: Javier Ruiz <[EMAIL PROTECTED]>
Date: Dec 5, 2006 9:07 AM
Subject: Problems with Zip+IE6
To: [email protected]
Hi all!
I have a problem with zip files and Internet Explorer 6. I try to send to
the user a dinamically generated zip file writting the http headers and
using file_put_contents for the zip content. It works fine when downloading
the file with firefox, opera, etc... even it works well if I download the
file with internet explorer and then open it with any zip tool. The problem
comes when I try to directly open the file from the URL using IE6.
I found this is a known bug of IE (several versions) in windows XP:
http://support.microsoft.com/kb/308090
Does anybody know any way to workaround this problem? I found a couple
workarounds in forums over there and I tried them, but unfortunately they
didn't work:
1 - To change the mimetype (when writting http headers) from
"application/zip" that I used before to "application/x-zip-compressed"
2 - To not use MOD_DEFLATE in apache2 (I was not using it really...)
Any idea??
Thanks a lot!
--- End Message ---
--- Begin Message ---
It's kinda long, but this will probably save you some grief:
http://richardlynch.blogspot.com
On Tue, December 5, 2006 2:07 am, Javier Ruiz wrote:
> Hi all!
>
> I have a problem with zip files and Internet Explorer 6. I try to send
> to
> the user a dinamically generated zip file writting the http headers
> and
> using file_put_contents for the zip content. It works fine when
> downloading
> the file with firefox, opera, etc... even it works well if I download
> the
> file with internet explorer and then open it with any zip tool. The
> problem
> comes when I try to directly open the file from the URL using IE6.
>
> I found this is a known bug of IE (several versions) in windows XP:
> http://support.microsoft.com/kb/308090
>
> Does anybody know any way to workaround this problem? I found a couple
> workarounds in forums over there and I tried them, but unfortunately
> they
> didn't work:
> 1 - To change the mimetype (when writting http headers) from
> "application/zip" that I used before to "application/x-zip-compressed"
> 2 - To not use MOD_DEFLATE in apache2 (I was not using it
> really...)
>
>
>
> Any idea??
>
> Thanks a lot!
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
Hi
I was just wondering if anyone knows why php's utf8_encode function converts
the £ symbol into £
Is this a bug in php or is it because utf8 doesn't include the £ symbol (can't
find a quick and easy ref to say if it does or not) and as such the function
outputs junk?
Kind Regards
Chris Dean
--- End Message ---
--- Begin Message ---
Hi Chris,
Do you use £ or £?
I've had problems uploading onto a linux box for ages, but a straight text £
never seems to work, so I have to get one of my colleagues to do it
instead...
Does that help?
Nunners
-----Original Message-----
From: Chris Dean [mailto:[EMAIL PROTECTED]
Sent: 05 December 2006 12:38
To: [email protected]
Subject: [PHP] utf8 encoding £ to £ problem
Hi
I was just wondering if anyone knows why php's utf8_encode function converts
the £ symbol into £
Is this a bug in php or is it because utf8 doesn't include the £ symbol
(can't find a quick and easy ref to say if it does or not) and as such the
function outputs junk?
Kind Regards
Chris Dean
--- End Message ---
--- Begin Message ---
Hi Chris,
UTF-8 certainly does include the £ symbol (UTF-8 is a superset of ASCII so
has all the ASCII characters plus many others).
I've recently converted my database-driven app to UTF-8 and encountered
various issues that were quite awkward to resolve. In this case, I would
expect that the £ sign string you are passing to the utf8_encode function is
already UTF-8 encoded.
One trick I found most useful was to convert test strings to hex. That way I
could see exactly how the string was encoded.
Edward
> -----Original Message-----
> From: Chris Dean [mailto:[EMAIL PROTECTED]
> Sent: 05 December 2006 12:38
> To: [email protected]
> Subject: [PHP] utf8 encoding £ to £ problem
>
>
> Hi
>
>
>
> I was just wondering if anyone knows why php's utf8_encode
> function converts the £ symbol into £
>
>
>
> Is this a bug in php or is it because utf8 doesn't include the £
> symbol (can't find a quick and easy ref to say if it does or not)
> and as such the function outputs junk?
>
>
>
>
>
> Kind Regards
>
>
>
> Chris Dean
>
>
>
>
--- End Message ---
--- Begin Message ---
Hi Nunners,
Just the £ and in my case I need to use that symbol, can't really get round it
sensibly with £
Chris
-----Original Message-----
From: James Nunnerley [mailto:[EMAIL PROTECTED]
Sent: 05 December 2006 13:01
To: Chris Dean
Cc: [email protected]
Subject: RE: [PHP] utf8 encoding £ to £ problem
Hi Chris,
Do you use £ or £?
I've had problems uploading onto a linux box for ages, but a straight text £
never seems to work, so I have to get one of my colleagues to do it
instead...
Does that help?
Nunners
-----Original Message-----
From: Chris Dean [mailto:[EMAIL PROTECTED]
Sent: 05 December 2006 12:38
To: [email protected]
Subject: [PHP] utf8 encoding £ to £ problem
Hi
I was just wondering if anyone knows why php's utf8_encode function converts
the £ symbol into £
Is this a bug in php or is it because utf8 doesn't include the £ symbol
(can't find a quick and easy ref to say if it does or not) and as such the
function outputs junk?
Kind Regards
Chris Dean
--- End Message ---
--- Begin Message ---
Chris Dean wrote:
> Hi Nunners,
>
> Just the £ and in my case I need to use that symbol, can't really get round
> it sensibly with £
odd problem - check the output of the output of following ... :
var_dump(
mb_convert_encoding(html_entity_decode("£"),"UTF-8","ISO-8859-1"),
// this line is sh*t
html_entity_decode(mb_convert_encoding("£","UTF-8","ISO-8859-1"))
// this works
);
I have no idea where the extra bogus byte is coming from or why but I can
suggest the work-around
step 1. replace all '£' with '£' in the string to be converted
step 2. convert the string from ISO-8859-1 to UTF-8
step 3. pass the converted string through html_entity_decode()
this may leave you with the problem that you don't want to decode ALL the html
entities in the
string ... in which case you'll have to get your hands a little more dirty....
I would
start by checking out this page:
http://php.net/manual/en/function.get-html-translation-table.php
PS - this is not really a solution, more of a hack - but it might save you a
few hairs!
>
>
> Chris
>
> -----Original Message-----
> From: James Nunnerley [mailto:[EMAIL PROTECTED]
> Sent: 05 December 2006 13:01
> To: Chris Dean
> Cc: [email protected]
> Subject: RE: [PHP] utf8 encoding £ to £ problem
>
> Hi Chris,
>
> Do you use £ or £?
>
> I've had problems uploading onto a linux box for ages, but a straight text £
> never seems to work, so I have to get one of my colleagues to do it
> instead...
>
> Does that help?
>
> Nunners
>
> -----Original Message-----
> From: Chris Dean [mailto:[EMAIL PROTECTED]
> Sent: 05 December 2006 12:38
> To: [email protected]
> Subject: [PHP] utf8 encoding £ to £ problem
>
> Hi
>
>
>
> I was just wondering if anyone knows why php's utf8_encode function converts
> the £ symbol into £
>
>
>
> Is this a bug in php or is it because utf8 doesn't include the £ symbol
> (can't find a quick and easy ref to say if it does or not) and as such the
> function outputs junk?
>
>
>
>
>
> Kind Regards
>
>
>
> Chris Dean
>
>
>
--- End Message ---
--- Begin Message ---
At 1:14 PM +0000 12/5/06, Chris Dean wrote:
Hi Nunners,
Just the £ and in my case I need to use that
symbol, can't really get round it sensibly with
£
Chris
Chris:
A simple way I've found to display such
characters is to first find their Unicode
code-point -- in this case 00A3. Then take the
DEC of that, which is 163. Then add the prefix
"$#" and suffix of ";" and you have the html
entity -- rendering:
£
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
[snip]
I am going to need to build LDAP and AD modules for a project that I'm
working on. Could any of you who have delt with PHP/LDAP/AD point me in
the
direction of some decent resources/papers/books?
[/snip]
http://www.php.net/ldap
--- End Message ---
--- Begin Message ---
Hi. First thanks for the replies.
Can anyone confirm that the php 5.2.0 engine takes the file name from the
path automatically and so basename() can be omitted? I understand that
leaving basename() in the code won't hurt, but I need the info for other
purpose. Thanks.
> Hi. There seems to be a minor error in the page
> http://www.php.net/manual/en/features.file-upload.php. In Example 38-2
> "Validating file uploads", there is a line:
>
> $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
>
> It looks like basename() is not required there. Because i found that
> when i
> upload a file using IE6 (IE6 includes the whole path to the uploaded
> file,
> see
>
http://jakarta.apache.org/commons/fileupload/faq.html#whole-path-from-IE),
> the value of $_FILES['userfile']['name'] is a file name but not a
> path. It
> looks like php has taken the file name from the path automatically. (I
> am
> using php 5.2.0 and win2k.) Can someone check if i am correct? Thanks.
There are probably other reasons to keep that there...
For starters, IE is not the only browser, much less the only User Agent.
In particular, I would presume somebody out there has crafted an evil
uploader that sends paths like, oh, "../../../../../../etc/passwd" as
the 'name' of the upload.
If you are silly enough to blindly use that and overwrite your passwd
file, well, there ya go.
The 'name' field should not be trusted. It comes from tbe user, and
anybody who can count past 10 with their shoes on could spoof it to
any value they like, including malicious values.
Plus, unless you check every single minor release version of PHP, you
can't be sure it ALWAYS stripped the path out.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
_________________________________________________________________
Learn English via Shopping Game, FREE!
http://www.linguaphonenet.com/BannerTrack.asp?EMSCode=MSN06-03ETFJ-0211E
--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2006-12-05 21:50:44 +0800:
> Hi. First thanks for the replies.
>
> Can anyone confirm that the php 5.2.0 engine takes the file name from the
> path automatically and so basename() can be omitted? I understand that
> leaving basename() in the code won't hurt, but I need the info for other
> purpose. Thanks.
Anyone can do it, including you: http://cvs.php.net/viewvc.cgi/
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
--- End Message ---
--- Begin Message ---
Hi,
I'm having a strange problem when trying to show a array after its value
was defined on a file that was included. Something like this:
<?php
$lang = 'pt_BR';
include('lang/'. $lang .'/login.php');
echo $lang['Username'];
?>
On the file lang/pt_BR/login.php i have this...
<?php
$lang['Username'] = 'Usuário';
?>
But the result of the first script is 'S' (without quotes).
If i change lang/pt_BR/login.php to
<?php
$lang['Username'] = 'Usuário';
echo $lang['Username'];
?>
I get 'Usuário' (without quotes again).
Why does this happens?
Thanks,
Fernando.
--- End Message ---
--- Begin Message ---
How can you use an array as string in the include statement and two lines lower
as array?
Think it echo's 'S' because it see's $lang as a string and not an array.
On Tue, 05 Dec 2006 13:11:12 -0200, "Fernando M. M." <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm having a strange problem when trying to show a array after its value
> was defined on a file that was included. Something like this:
>
> <?php
> $lang = 'pt_BR';
>
> include('lang/'. $lang .'/login.php');
>
> echo $lang['Username'];
> ?>
>
> On the file lang/pt_BR/login.php i have this...
>
> <?php
> $lang['Username'] = 'Usuário';
> ?>
>
> But the result of the first script is 'S' (without quotes).
>
> If i change lang/pt_BR/login.php to
>
> <?php
> $lang['Username'] = 'Usuário';
>
> echo $lang['Username'];
> ?>
>
> I get 'Usuário' (without quotes again).
>
> Why does this happens?
>
> Thanks,
>
> Fernando.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
T.Lensselink,
Ok, problem solved. I didn't realized that i was using the same variable.
Thanks for the help!
T.Lensselink escreveu:
How can you use an array as string in the include statement and two lines lower
as array?
Think it echo's 'S' because it see's $lang as a string and not an array.
On Tue, 05 Dec 2006 13:11:12 -0200, "Fernando M. M." <[EMAIL PROTECTED]> wrote:
Hi,
I'm having a strange problem when trying to show a array after its value
was defined on a file that was included. Something like this:
<?php
$lang = 'pt_BR';
include('lang/'. $lang .'/login.php');
echo $lang['Username'];
?>
On the file lang/pt_BR/login.php i have this...
<?php
$lang['Username'] = 'Usuário';
?>
But the result of the first script is 'S' (without quotes).
If i change lang/pt_BR/login.php to
<?php
$lang['Username'] = 'Usuário';
echo $lang['Username'];
?>
I get 'Usuário' (without quotes again).
Why does this happens?
Thanks,
Fernando.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Tue, December 5, 2006 9:11 am, Fernando M. M. wrote:
> Hi,
>
> I'm having a strange problem when trying to show a array after its
> value
> was defined on a file that was included. Something like this:
>
> <?php
> $lang = 'pt_BR';
>
> include('lang/'. $lang .'/login.php');
>
> echo $lang['Username'];
You are using $lang for BOTH the language to include, and then again
as an array for content within that language.
Don't do that.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
This is the head of my doc. It is supposed to change the page height based
on the selection from the menu. It works in IE and validates ok but it is no
go in firefox. Any ideas?? You can see it in action here...
http://suruchitoo.com/menu.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>SuruchiToo - Menu</title>
<link href="suruchi.css" rel="stylesheet" type="text/css" />
<?php
$select = isset($_REQUEST['select']) ? $_REQUEST['select'] : '';
switch ($select) {
case "starters":
$selection = "starters.php";
break;
case "mains":
$selection = "mains.php";
?><style type="text/css">#side, #main, #holder, {height: 1400px;}
#menu_insert {height:950px;}</style><?
break;
case "veg":
$selection = "veg.php";
?><?
break;
case "rice":
$selection = "rice.php";
?><style type="text/css">#side, #main, #holder, {height: 1000px;}
#menu_insert {height:950px;}</style><?
break;
case "drinks":
$selection = "drinks.php";
?><style type="text/css">#side, #main, #holder, {height: 1600px;}
#menu_insert {height:950px;}</style><?
break;
default:
$selection = "starters.php";
?><style type="text/css">#side, #main, #holder, {height: 1400px;}
#menu_insert {height:950px;}</style><?
break;
}
?>
--- End Message ---
--- Begin Message ---
Ross wrote:
> This is the head of my doc. It is supposed to change the page height based
> on the selection from the menu. It works in IE and validates ok but it is no
> go in firefox. Any ideas??
try a CSS list ; google for CSS-Discuss (Eric Meyers list)
> You can see it in action here...
>
> http://suruchitoo.com/menu.php
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> <title>SuruchiToo - Menu</title>
> <link href="suruchi.css" rel="stylesheet" type="text/css" />
>
> <?php
>
>
> $select = isset($_REQUEST['select']) ? $_REQUEST['select'] : '';
>
> switch ($select) {
> case "starters":
> $selection = "starters.php";
>
> break;
> case "mains":
> $selection = "mains.php";
> ?><style type="text/css">#side, #main, #holder, {height: 1400px;}
> #menu_insert {height:950px;}</style><?
> break;
>
>
> case "veg":
> $selection = "veg.php";
> ?><?
> break;
>
> case "rice":
> $selection = "rice.php";
> ?><style type="text/css">#side, #main, #holder, {height: 1000px;}
> #menu_insert {height:950px;}</style><?
> break;
> case "drinks":
> $selection = "drinks.php";
> ?><style type="text/css">#side, #main, #holder, {height: 1600px;}
> #menu_insert {height:950px;}</style><?
>
> break;
> default:
> $selection = "starters.php";
> ?><style type="text/css">#side, #main, #holder, {height: 1400px;}
> #menu_insert {height:950px;}</style><?
> break;
>
> }
>
> ?>
>
--- End Message ---
--- Begin Message ---
Assuming you mean URLs as GET variable values, urlencode() and urldecode()
might be the ticket:
http://ca.php.net/urlencode
Aaron
On 12/4/06, Graham Anderson <[EMAIL PROTECTED]> wrote:
What is a good/accepted way to pass a relative or absolute path
into a clean url ?
I could replace the relative url's slashes with another character,
but would love to know a cleaner less confusing way...if it exists
example url:
http://localhost/testscript/../image.png/jpeg/420000/0/
example php:
list($dummy,$relative_path,$type, $color, $cache) = explode('/',
$_SERVER['PATH_INFO']);
where:
$relative_path=../image.png
$type=jpeg
$color=420000
$cache=0
many thanks in advance
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
+-------------------------------------------------
| Aaron Koning
| Information Technologist
| Prince George, BC, Canada.
+-------------------------------------------------
| Flexible Internet Spatial Template:
| http://fist-mapping.org
+-------------------------------------------------
--- End Message ---
--- Begin Message ---
If you are composing these on the fly, you could use
http://php.net/dirname for each element in front of a "../" and wipe
out the subdir and the "../"
Or, perhaps something like:
$url = preg_replace("|/[^/]/\\.\\./|", "/", $url);
On Mon, December 4, 2006 9:11 pm, Graham Anderson wrote:
> What is a good/accepted way to pass a relative or absolute path
> into a clean url ?
>
> I could replace the relative url's slashes with another character,
> but would love to know a cleaner less confusing way...if it exists
>
>
> example url:
> http://localhost/testscript/../image.png/jpeg/420000/0/
>
> example php:
> list($dummy,$relative_path,$type, $color, $cache) = explode('/',
> $_SERVER['PATH_INFO']);
>
>
> where:
> $relative_path=../image.png
> $type=jpeg
> $color=420000
> $cache=0
>
>
> many thanks in advance
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
thanks :)
I'll give that a try
g
On Dec 5, 2006, at 10:48 AM, Richard Lynch wrote:
If you are composing these on the fly, you could use
http://php.net/dirname for each element in front of a "../" and wipe
out the subdir and the "../"
Or, perhaps something like:
$url = preg_replace("|/[^/]/\\.\\./|", "/", $url);
On Mon, December 4, 2006 9:11 pm, Graham Anderson wrote:
What is a good/accepted way to pass a relative or absolute path
into a clean url ?
I could replace the relative url's slashes with another character,
but would love to know a cleaner less confusing way...if it exists
example url:
http://localhost/testscript/../image.png/jpeg/420000/0/
example php:
list($dummy,$relative_path,$type, $color, $cache) = explode('/',
$_SERVER['PATH_INFO']);
where:
$relative_path=../image.png
$type=jpeg
$color=420000
$cache=0
many thanks in advance
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving 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
--- End Message ---
--- Begin Message ---
On Mon, December 4, 2006 3:03 pm, Mark London wrote:
> Is there any way for PHP to know whether it is being called due to a
> browser refresh versus a mouse click? I think the answer is no but I
> just want to be sure. Thanks.
You could embed a random token in all your links and input forms, and
if they re-use a token, then you know they are re-loading something
they have seen at some time in the past.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
Hi - Thanks! This is the solution I actually realized myself last
night, after many hours of looking at the other solutions and finding
problems with them. Thanks to everyone who responded! - Mark
Richard Lynch wrote:
On Mon, December 4, 2006 3:03 pm, Mark London wrote:
Is there any way for PHP to know whether it is being called due to a
browser refresh versus a mouse click? I think the answer is no but I
just want to be sure. Thanks.
You could embed a random token in all your links and input forms, and
if they re-use a token, then you know they are re-loading something
they have seen at some time in the past.
--- End Message ---
--- Begin Message ---
On Mon, December 4, 2006 10:43 am, M.Ozan Hazer wrote:
> [04-Dec-2006 18:21:56] PHP Warning: Unknown: The session id contains
> illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in
> Unknown
> on line 0
Find your session_start() and do this after it:
var_dump(session_id());
If you have sessions turned on in php.ini automatically, just put the
var_dump() at the top of your pages.
Oh, and check if there is a session_name or session_prefix or somesuch
in the php.ini
If you have set that to an invalid value, it would cause this.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Mon, December 4, 2006 8:11 am, Janet Smith wrote:
> We have an application using PHP. If users have forgotten their
> password, they click on the link 'Forgot Password' and enter this
> e-mail
> address. This is suppose to send their new password to the e-mail
> address provided.
Errr.
So if I give you my email address and ask for the password to somebody
else's account, I can get their password?
I'm thinking you mean only if it's an email already tied to the
account, right?...
You may want to consider giving another way to find an account, as I
can never remember which custom email I gave to people who want my
email...
> We can not get the e-mail to be sent. I have changed
> the php.ini file to include the SMTP, the sendmail_from and the
> sendmail_path. Does anyone have any suggestions as to what else I need
> to look at?
Windows or Un*x?
If it's Un*x, log in and su to the PHP user, and see if that user can
actually send out an email from the command line. If not, PHP scripts
won't do any better at it.
If it's Un*x, turn off the SMTP php.ini setting, as you don't need
that, almost-for-sure.
If it's Windows, the other way around -- leave the sendmail_path blank
and fix up the SMTP.
And, on Windows, see if you can connect to SMTP as the PHP User. See
http://php.net/phpinfo to find out what user PHP is running as.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Mon, December 4, 2006 6:55 am, Jochem Maas wrote:
> but given that the ENV var is only available to the shell php in
> currently running in (and any subshells) so
> the script is only vulnerable to mistakes/attacks from 'inside' the
> script - basically I'm assuming that
> whatever is stored in the ENV of a shell is not accessible/visible to
> other users on the given system.
>
> is that assumption correct?
I think it's wiser to phrase it as "not supposed to be accessible" or
"not accessible via normal means"
If somebody works hard enough at it, with some kind of RAM snooper and
a hacked kernel and whatnot, they *could* get to it... :-v
It's important to phrase these things with that tinge of gray, just to
remind ourselves that there's always some kind of hack to beat any
system.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Mon, December 4, 2006 4:53 am, Tony Marston wrote:
> No, otherwise I would have quoted them. Generally speaking when people
> say
> that "X is inefficient or bad for performance" all they can prove is
> that if
> something extra is done then it takes extra processing time to perform
> that
> extra work, and they usually quote from an out-of-date source. While
> the
> time taken for Apace to process an htaccess file may have been
> significant
> on a 1Mhz processor it is barely noticeable on a 3Ghz processor.
>
> If the time taken to process an htaccess file on one of today's
> processors
> adds 0.000001 seconds to a page's load time, would that be regarded as
> "significant"? Would this be a small price to pay for the advantage of
> being
> able to change Apache's configuration with an htaccess file?
The time to process the .htaccess file is chump-change.
The time to do the fstat calls and disk seeks on EVERY PAGE HIT in
each sub-directory to find and load any .htaccess files that MIGHT be
there, and MIGHT have changed is not chump-change, almost for sure, to
this day. Disk I/O is still relatively expensive.
Feel free to find or create some benchmarks if you wish to disprove
this oft-quoted "myth".
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Mon, December 4, 2006 1:37 am, Le Phuoc Canh wrote:
> Dears,
> I want to make a web app about music online. But i don't know how to
> use
> streaming in PHP to load a music file for playing. Please help me for
> the
> best direction.
> Thanks alot and best regard.
You are making this too complicated.
Fortunately, I've had to explain this to many many musicians in other
forums, and can simplify it:
Step #1.
Create your MP3 somehow with a CD-ripper/encoder or whatever.
Step #2.
Upload the MP3 to your website, just like an HTML page, but be sure it
uploads as "BINARY" and not "ASCII"
Step #3.
Test the uploaded file as a download.
Just make a link to the MP3, the same way you'd link to an HTML page,
only it will have somethine like "somesong.mp3" in it.
That should do a download for your MP3 player.
If not, and it prompts you to save it as an "unknown" type, or shows a
bunch of gibberish on the browser window, then you have to figure out
how to convince your web-server that the correct mime-type for that
file ending in .mp3 is: audio/mpeg
Step #4.
Copy/paste the URL to the MP3 into a plain text file.
Not MS Word, nor even FrontPage nor DreamWeaver, but just plain old
Notepad (SimpleText on the Mac).
Save the file as "somesong.m3u"
The .m3u is crucial for the file type.
Step #5.
Upload that .m3u file to your webserver, and make a link to THAT URL,
just like you do for HTML files and just like you did in Step#2, only
with the .m3u URL instead.
Step #6.
Test the .m3u link, and it should be a streaming audio file for your
MP3 player.
Again, if not, you have to convince your web-server that the correct
mime-type for an .m3u file is: audio/mpeg-url
That's it. You now have streaming audio on your server.
None of this has anything to do with PHP, really, so some obligatory
PHP comments are in order. :-)
You can use a script like "sample" to sort of funnel requests for the
MP3s and have that be a PHP script which keeps a log who played what,
or it can do something fun like prepend the ID3 tags to the MP3
stream, so that your ID3 data can easily be changed without dinking
around with monstrous MP3 files to edit them.
Here is a sample script for that purpose, and more:
http://uncommonground.com/sample.phps
This script also has some stuff in it to upload the MP3 from a second
tier server into a caching system, which you can mostly ignore. Or
steal, as you see fit.
YMMV
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---