[PHP] Problems with Zip+IE6

2006-12-05 Thread Javier Ruiz

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!


[PHP] Send emails from PHP ... in a secure way

2006-12-05 Thread Ruben Rubio
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

I have a question sending mails from PHP. Actually I am using phpmailer
(is good!!) but when this class sends an email and there is an error
(Mail server is not ready) It just reports error and email is lost.

Is out there any way to save failed emails, and resend if is it  possible?

Thanks in advance
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFdSs8Io1XmbAXRboRAozTAJ9OScgvOYrALnuFo+JQaSXL1KBRSwCeJ+So
/uiRgT6xPeKNV4mosGWQYRw=
=sD5W
-END PGP SIGNATURE-

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



Re: [PHP] Send emails from PHP ... in a secure way

2006-12-05 Thread clive

Ruben Rubio wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

I have a question sending mails from PHP. Actually I am using phpmailer
(is good!!) but when this class sends an email and there is an error
(Mail server is not ready) It just reports error and email is lost.


how are you sending the email , via smtp or sendmail or what ever mta is 
on the system. With the MTA it should be que'd. Id you get an error with 
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?


clive

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



Re: [PHP] Send emails from PHP ... in a secure way

2006-12-05 Thread Ruben Rubio
-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



[PHP] Re: EZ array problem - What's wrong with my brain?

2006-12-05 Thread Colin Guthrie
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.

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



Re: [PHP] Send emails from PHP ... in a secure way

2006-12-05 Thread T . Lensselink
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

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



Re: [PHP] Send emails from PHP ... in a secure way

2006-12-05 Thread Ruben Rubio
-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-

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



[PHP] Fwd: Problems with Zip+IE6

2006-12-05 Thread Javier Ruiz

BUMP!

-- Forwarded message --
From: Javier Ruiz <[EMAIL PROTECTED]>
Date: Dec 5, 2006 9:07 AM
Subject: Problems with Zip+IE6
To: php-general@lists.php.net

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!


Re: [PHP] Send emails from PHP ... in a secure way

2006-12-05 Thread Jochem Maas
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.

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



[PHP] utf8 encoding £ to £ problem

2006-12-05 Thread Chris Dean
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 

 



RE: [PHP] utf8 encoding £ to £ problem

2006-12-05 Thread James Nunnerley
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: php-general@lists.php.net
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 

 

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



RE: [PHP] utf8 encoding £ to £ problem

2006-12-05 Thread Edward Kay
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: php-general@lists.php.net
> 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
>
>
>
>

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



RE: [PHP] utf8 encoding £ to £ problem

2006-12-05 Thread Chris Dean
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: php-general@lists.php.net
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: php-general@lists.php.net
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 

 

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



RE: [PHP] LDAP & Active Directory Authentication

2006-12-05 Thread Jay Blanchard
[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

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



Re: [PHP] utf8 encoding £ to £ probl em

2006-12-05 Thread Jochem Maas
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: php-general@lists.php.net
> 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: php-general@lists.php.net
> 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 
> 
>  
> 

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



Re: [PHP] Error in php doc?

2006-12-05 Thread MS P

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


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



Re: [PHP] Error in php doc?

2006-12-05 Thread Roman Neuhauser
# [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

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



[PHP] Error with array and include

2006-12-05 Thread Fernando M. M.

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:




On the file lang/pt_BR/login.php i have this...



But the result of the first script is 'S' (without quotes).

If i change lang/pt_BR/login.php to



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



Re: [PHP] Error with array and include

2006-12-05 Thread T . Lensselink
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:
> 
>  $lang = 'pt_BR';
> 
> include('lang/'. $lang .'/login.php');
> 
> echo $lang['Username'];
> ?>
> 
> On the file lang/pt_BR/login.php i have this...
> 
>  $lang['Username'] = 'Usuário';
> ?>
> 
> But the result of the first script is 'S' (without quotes).
> 
> If i change lang/pt_BR/login.php to
> 
>  $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

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



Re: [PHP] Error with array and include

2006-12-05 Thread Fernando M. M.

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:



On the file lang/pt_BR/login.php i have this...



But the result of the first script is 'S' (without quotes).

If i change lang/pt_BR/login.php to



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



  


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



Re: [PHP] Pass a relative path [with slashes] into a 'clean' url

2006-12-05 Thread Aaron Koning

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/42/0/

example php:
list($dummy,$relative_path,$type, $color, $cache) = explode('/',
$_SERVER['PATH_INFO']);


where:
$relative_path=../image.png
$type=jpeg
$color=42
$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
+-


Re: [PHP] Error with array and include

2006-12-05 Thread Richard Lynch
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:
>
>  $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?

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



Re: [PHP] Problems with Zip+IE6

2006-12-05 Thread Richard Lynch
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?

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



Re: [PHP] Distinguishing between a mouse click and a refresh?

2006-12-05 Thread Richard Lynch
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?

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



Re: [PHP] Pass a relative path [with slashes] into a 'clean' url

2006-12-05 Thread Richard Lynch
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/42/0/
>
> example php:
> list($dummy,$relative_path,$type, $color, $cache) = explode('/',
> $_SERVER['PATH_INFO']);
>
>
> where:
> $relative_path=../image.png
> $type=jpeg
> $color=42
> $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



Re: [PHP] illegal characters

2006-12-05 Thread Richard Lynch
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?

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



Re: [PHP] Sending E-mail

2006-12-05 Thread Richard Lynch
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?

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



Re: [PHP] hiding passwd in cmdlines that appear in the process list

2006-12-05 Thread Richard Lynch
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?

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



Re: [PHP] problem with register globals on new server

2006-12-05 Thread Richard Lynch
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.01 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?

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



Re: [PHP] Pass a relative path [with slashes] into a 'clean' url

2006-12-05 Thread Graham Anderson

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/42/0/

example php:
list($dummy,$relative_path,$type, $color, $cache) = explode('/',
$_SERVER['PATH_INFO']);


where:
$relative_path=../image.png
$type=jpeg
$color=42
$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


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



RE: [PHP] utf8 encoding £ to £ problem

2006-12-05 Thread tedd

At 1:14 PM + 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

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



Re: [PHP] Help me about audio stream...

2006-12-05 Thread Richard Lynch
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?



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



Re: [PHP] Distinguishing between a mouse click and a refresh?

2006-12-05 Thread Mark London
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.

  


Re: [PHP] firefox only problem

2006-12-05 Thread Jochem Maas
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
> 
> 
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> 
> SuruchiToo - Menu
> 
> 
>  
> 
> $select = isset($_REQUEST['select']) ? $_REQUEST['select'] : '';
> 
> switch ($select) {
> case "starters":
>   $selection = "starters.php";
> 
>break;
> case "mains":
>$selection = "mains.php";
>?>#side, #main, #holder, {height:  1400px;} 
> #menu_insert {height:950px;}break;
> 
> 
> case "veg":
>$selection = "veg.php";
>  ?>break;
> 
> case "rice":
>$selection = "rice.php";
>  ?>#side, #main, #holder, {height:  1000px;} 
> #menu_insert {height:950px;}break;
> case "drinks":
>$selection = "drinks.php";
>  ?>#side, #main, #holder, {height:  1600px;} 
> #menu_insert {height:950px;} 
>break;
> default:
>  $selection = "starters.php";
>?>#side, #main, #holder, {height:  1400px;} 
> #menu_insert {height:950px;}   break;
> 
>  }
> 
> ?> 
> 

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



[PHP] Newsgroup connect time has become very long

2006-12-05 Thread Al
Anyone having problems connecting the last few days? Or, is there something 
wrong on my end. Al other sites are working just fine.


Thanks.

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



[PHP] Newsgroup connect time has become very long

2006-12-05 Thread Al
Anyone having problems connecting the last few days? Or, is there something 
wrong on my end. All other sites are working just fine.


Thanks.

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