RE: [PHP] mail(): carriage return required??

2001-03-22 Thread Eelco de Vries

  I read the mail fine in my hotmail.com account, but when I read
 that same
  mail in my MS Outlook client the mail is one long line of text:
  "this is line 1 this is line 2 this the 3rd etc etc"
 
  I understand from this difference in layout that the 'carriage
 return' is
  required. Is there a function that adds a 'carriage return' after every
  'newline' found in a string? Or is this another problem?

 Use \r\n for email line breaks.



Should I write a function that replace any corrance of '\n' with '\r\n' in a
string myself?
Hard to believe that the PHP guys haven't encountered this before and didn't
write some PHP function to do this for us, not?

Cheers;
Eelco.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] mail(): \r\n gives extra empty line between each line in Outlook

2001-03-22 Thread Eelco de Vries

Hi all,

First I had a problem that text from a textarea form object passed to mail()
ended up as a single line of text in MS Outlook.
I changed the newlines to newlines _with_ carriage returns:
strtr($mailbody, "\n", "\r\n");

Now it's not a single line of text but every newline skips an extra line
?!?!
The following is typed in the textarea en passed to mail():
"line 1
line 2
line 3"

In Outlook it shows as:
"line 1

line 2

line 3"

The "\n" alone gives a single line of text, the "\r\n" gives an extra empty
line between each line. (the "\r" alone ends up the same as "\r\n").

What is going on here?
How can I fix this?


Regards;
Eelco.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Content-Type: image/gif and send the image in hex

2001-03-03 Thread Eelco de Vries

Hi all,

I'm trying to make a demonstration script (using PHP) that demonstrates the
use of MIME types in HTTP headers. It should send the Content-Type header
and than sends an image to the browser in hex.
I run the script in my browser and get the bare decimal values displayed and
not the GIF image:

Content-type: image/gif
717370565597701024701280001280128128000128128012801281281921921921922201
92166202240643209632012832016032019
--snip--

I also tried to use:
header("Content-type: image/gif");
But no success.
I don't want to use the header() function cause it doesn't help my
demostration script show the workings.
Where does it go wrong? (See script below)

Regards;
Eelco.




?php

// 7x1 pixel GIF image data
$img = array (
0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x07, 0x00, 0x01, 0x00, 0xF7, 0x00,
0x00, 0x00, 0x00, 0x00,
0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80,
0x80, 0x00, 0x80, 0x00,
0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xDC, 0xC0, 0xA6, 0xCA, 0xF0, 0x40,
0x20, 0x00, 0x60, 0x20,
0x00, 0x80, 0x20, 0x00, 0xA0, 0x20, 0x00, 0xC0, 0x20, 0x00, 0xE0, 0x20,
0x00, 0x00, 0x40, 0x00,
0x20, 0x40, 0x00, 0x40, 0x40, 0x00, 0x60, 0x40, 0x00, 0x80, 0x40, 0x00,
0xA0, 0x40, 0x00, 0xC0,
0x40, 0x00, 0xE0, 0x40, 0x00, 0x00, 0x60, 0x00, 0x20, 0x60, 0x00, 0x40,
0x60, 0x00, 0x60, 0x60,
0x00, 0x80, 0x60, 0x00, 0xA0, 0x60, 0x00, 0xC0, 0x60, 0x00, 0xE0, 0x60,
0x00, 0x00, 0x80, 0x00,
0x20, 0x80, 0x00, 0x40, 0x80, 0x00, 0x60, 0x80, 0x00, 0x80, 0x80, 0x00,
0xA0, 0x80, 0x00, 0xC0,
0x80, 0x00, 0xE0, 0x80, 0x00, 0x00, 0xA0, 0x00, 0x20, 0xA0, 0x00, 0x40,
0xA0, 0x00, 0x60, 0xA0,
0x00, 0x80, 0xA0, 0x00, 0xA0, 0xA0, 0x00, 0xC0, 0xA0, 0x00, 0xE0, 0xA0,
0x00, 0x00, 0xC0, 0x00,
0x20, 0xC0, 0x00, 0x40, 0xC0, 0x00, 0x60, 0xC0, 0x00, 0x80, 0xC0, 0x00,
0xA0, 0xC0, 0x00, 0xC0,
0xC0, 0x00, 0xE0, 0xC0, 0x00, 0x00, 0xE0, 0x00, 0x20, 0xE0, 0x00, 0x40,
0xE0, 0x00, 0x60, 0xE0,
0x00, 0x80, 0xE0, 0x00, 0xA0, 0xE0, 0x00, 0xC0, 0xE0, 0x00, 0xE0, 0xE0,
0x00, 0x00, 0x00, 0x40,
0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x60, 0x00, 0x40, 0x80, 0x00, 0x40,
0xA0, 0x00, 0x40, 0xC0,
0x00, 0x40, 0xE0, 0x00, 0x40, 0x00, 0x20, 0x40, 0x20, 0x20, 0x40, 0x40,
0x20, 0x40, 0x60, 0x20,
0x40, 0x80, 0x20, 0x40, 0xA0, 0x20, 0x40, 0xC0, 0x20, 0x40, 0xE0, 0x20,
0x40, 0x00, 0x40, 0x40,
0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x60, 0x40, 0x40, 0x80, 0x40, 0x40,
0xA0, 0x40, 0x40, 0xC0,
0x40, 0x40, 0xE0, 0x40, 0x40, 0x00, 0x60, 0x40, 0x20, 0x60, 0x40, 0x40,
0x60, 0x40, 0x60, 0x60,
0x40, 0x80, 0x60, 0x40, 0xA0, 0x60, 0x40, 0xC0, 0x60, 0x40, 0xE0, 0x60,
0x40, 0x00, 0x80, 0x40,
0x20, 0x80, 0x40, 0x40, 0x80, 0x40, 0x60, 0x80, 0x40, 0x80, 0x80, 0x40,
0xA0, 0x80, 0x40, 0xC0,
0x80, 0x40, 0xE0, 0x80, 0x40, 0x00, 0xA0, 0x40, 0x20, 0xA0, 0x40, 0x40,
0xA0, 0x40, 0x60, 0xA0,
0x40, 0x80, 0xA0, 0x40, 0xA0, 0xA0, 0x40, 0xC0, 0xA0, 0x40, 0xE0, 0xA0,
0x40, 0x00, 0xC0, 0x40,
0x20, 0xC0, 0x40, 0x40, 0xC0, 0x40, 0x60, 0xC0, 0x40, 0x80, 0xC0, 0x40,
0xA0, 0xC0, 0x40, 0xC0,
0xC0, 0x40, 0xE0, 0xC0, 0x40, 0x00, 0xE0, 0x40, 0x20, 0xE0, 0x40, 0x40,
0xE0, 0x40, 0x60, 0xE0,
0x40, 0x80, 0xE0, 0x40, 0xA0, 0xE0, 0x40, 0xC0, 0xE0, 0x40, 0xE0, 0xE0,
0x40, 0x00, 0x00, 0x80,
0x20, 0x00, 0x80, 0x40, 0x00, 0x80, 0x60, 0x00, 0x80, 0x80, 0x00, 0x80,
0xA0, 0x00, 0x80, 0xC0,
0x00, 0x80, 0xE0, 0x00, 0x80, 0x00, 0x20, 0x80, 0x20, 0x20, 0x80, 0x40,
0x20, 0x80, 0x60, 0x20,
0x80, 0x80, 0x20, 0x80, 0xA0, 0x20, 0x80, 0xC0, 0x20, 0x80, 0xE0, 0x20,
0x80, 0x00, 0x40, 0x80,
0x20, 0x40, 0x80, 0x40, 0x40, 0x80, 0x60, 0x40, 0x80, 0x80, 0x40, 0x80,
0xA0, 0x40, 0x80, 0xC0,
0x40, 0x80, 0xE0, 0x40, 0x80, 0x00, 0x60, 0x80, 0x20, 0x60, 0x80, 0x40,
0x60, 0x80, 0x60, 0x60,
0x80, 0x80, 0x60, 0x80, 0xA0, 0x60, 0x80, 0xC0, 0x60, 0x80, 0xE0, 0x60,
0x80, 0x00, 0x80, 0x80,
0x20, 0x80, 0x80, 0x40, 0x80, 0x80, 0x60, 0x80, 0x80, 0x80, 0x80, 0x80,
0xA0, 0x80, 0x80, 0xC0,
0x80, 0x80, 0xE0, 0x80, 0x80, 0x00, 0xA0, 0x80, 0x20, 0xA0, 0x80, 0x40,
0xA0, 0x80, 0x60, 0xA0,
0x80, 0x80, 0xA0, 0x80, 0xA0, 0xA0, 0x80, 0xC0, 0xA0, 0x80, 0xE0, 0xA0,
0x80, 0x00, 0xC0, 0x80,
0x20, 0xC0, 0x80, 0x40, 0xC0, 0x80, 0x60, 0xC0, 0x80, 0x80, 0xC0, 0x80,
0xA0, 0xC0, 0x80, 0xC0,
0xC0, 0x80, 0xE0, 0xC0, 0x80, 0x00, 0xE0, 0x80, 0x20, 0xE0, 0x80, 0x40,
0xE0, 0x80, 0x60, 0xE0,
0x80, 0x80, 0xE0, 0x80, 0xA0, 0xE0, 0x80, 0xC0, 0xE0, 0x80, 0xE0, 0xE0,
0x80, 0x00, 0x00, 0xC0,
0x20, 0x00, 0xC0, 0x40, 0x00, 0xC0, 0x60, 0x00, 0xC0, 0x80, 0x00, 0xC0,
0xA0, 0x00, 0xC0, 0xC0,
0x00, 0xC0, 0xE0, 0x00, 0xC0, 0x00, 0x20, 0xC0, 0x20, 0x20, 0xC0, 0x40,
0x20, 0xC0, 0x60, 0x20,
0xC0, 0x80, 0x20, 0xC0, 0xA0, 0x20, 0xC0, 0xC0, 0x20, 0xC0, 0xE0, 0x20,
0xC0, 0x00, 0x40, 0xC0,
0x20, 0x40, 0xC0, 0x40, 0x40, 0xC0, 0x60, 0x40, 0xC0, 0x80, 0x40, 0xC0,
0xA0, 0x40, 0xC0, 0xC0,
0x40, 0xC0, 0xE0, 0x40, 0xC0, 0x00, 0x60, 0xC0, 0x20, 0x60, 0xC0, 0x40,
0x60, 0xC0, 0x60, 0x60,
0xC0, 0x80, 0x60, 0xC0, 0xA0, 0x60, 0xC0, 0xC0, 

RE: [PHP] Session With Cookies

2001-02-05 Thread Eelco de Vries

no offense for anyone at all. I was just wondering myself and threw it in
the group discussion.

Eelco.


 I never wanted this question to be an offense for anyone. I thank you all
 for your answers.

 Regards
 PHPLover

 Lux [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  It's unlikely I suppose, but there's a must-have book you should look at
  if you want info on hacks, including browser hacks (Hacking Exposed:
  Network Security Secrets and Solutions, 2nd Edition).  The cookie hack
  that comes to mind only works in IE or MS products (but that's only
  what, 90% of the web), but all it is is a line or so of html code that
  somebody places on their site (say in an iframe...) that sends them all
  your cookie data (if the user uses outlook, they can also just place it
  in an email).  from there, they use the cookie data to pose as that
  person on various sites trying to gain sensitive info.  but if you're
  already giving them the password, how much more sensitive can you get?
 
  so really, if they don't close their browser for a while, this
  possibility increases.  and it may be a slim possibility, but it's
  better to be safe than sorry.
 
  later
 
  lux
 
   Well .. I am ... nobody but the user itself can see the login and
 password
  
   in the cookie. Unless it's on non-SSL connection and somebody is
  
   packet-shiffing around. Otherwise there would be no leak for somebody
 else
  
   to get this information, is there?
  
   And if the user doesn't logout, the cookie is still destroyed when the
  
   browser is closed anyway.
  
  
  
   Eelco.
 
 
  --
 
  John Luxford
  Simian Systems
 
  w: www.simian.ca
  e: [EMAIL PROTECTED]
  p: 204.946.5955
 
  --
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] % operator

2001-02-04 Thread Eelco de Vries

It doesn't have a use in only PHP but in all programming languages.
It's a math thing .. u can get a remainder of a division.
10%8 = 2
12%8 = 4
10%5 = 0
12%5 = 2

Simple application:
$ppl = 23;
$grpsize = 7;
echo ("when $ppl people are divided over groups of $grpsize, ".
$ppl%$grpsize  ." people are ungrouped.");

This operator can be used for more complex situations.

Cheers;
Eelco.


 Hi!

 what is the use of %
 Is it called modulo..what is it's use in PHP.?


 Thanx!
 Dhaval Desai

 __
 Get personalized email addresses from Yahoo! Mail - only $35
 a year!  http://personal.mail.yahoo.com/

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Session With Cookies

2001-02-04 Thread Eelco de Vries


This will store a cookie with a userid and an unique number ($token) as
session-id (??).
If I'm not mistaken, this session-id is not checked here. Thus serves no
purose. Anybody who retrieve the cookie from the cookie file on the system
can use it to resume the session (if done within the set 3600sec.). Even if
the browser has been closed.

In case of login/password required sites, I use the login and password as
cookie values and have _no_ expiredate set. Every time a request is made
_both_ cookie values (login and password) are checked with that on the
server. When the browser is closed, the cookie is gone.
It works but I think it's quite an unconventional way ... any
suggestions/comments on this method?

Cheers;
Eelco.


 Try this:

 // Set Cookie if not already set
  if (!isset($user_id)) {
   $token = md5(uniqid(rand()));
   setcookie("user_id", $token, time()+3600,"/",".yourdomain.com");
  }

 look at the setcookie function on php.net to figure out all the
 parameters:
 http://www.php.net/manual/en/function.setcookie.php

 -Shane

 - Original Message -
 From: "phpLover" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, February 03, 2001 11:25 PM
 Subject: [PHP] Session With Cookies


  How can I maintain a user session using cookies?
 
  Thanks
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Session With Cookies

2001-02-04 Thread Eelco de Vries

  In case of login/password required sites, I use the login and
 password as
  cookie values and have _no_ expiredate set. Every time a request is made
  _both_ cookie values (login and password) are checked with that on the
  server.

 I would hope that you are not storing and matching the user's plaintext
 password...


Well .. I am ... nobody but the user itself can see the login and password
in the cookie. Unless it's on non-SSL connection and somebody is
packet-shiffing around. Otherwise there would be no leak for somebody else
to get this information, is there?
And if the user doesn't logout, the cookie is still destroyed when the
browser is closed anyway.

Eelco.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] php_imap4r2.dll not loaded ?!?! (win2k)

2001-02-03 Thread Eelco de Vries

Hello,

I'm trying to use some POP3 functions and the manual states I would need to
use the IMAP functions.
So I uncommented the ";extension=php_imap4r2.dll" line in my
"c:\winnt\php.ini" file. But it gave me the following error:

"Unable to load dynamic library './php_imap4r2.dll' - The specified module
could not be found".


I read I needed the download install the "imap-4.5.tar" module. The README
file has only instructions how to "make" it for UNIX. The default "MakeFile"
is for UNIX. So I tried to clown around and rename "MakeFile.nt" to
"MakeFile" and make it. But I only get errors:

Could Not Find D:\temp\imap-4.5\c-client\LINKAGE.*
NMAKE : fatal error U1077: 'C:\WINNT\system32\cmd.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: 'C:\WINNT\system32\cmd.exe' : return code '0x2'
Stop.


I also tried this with the "MakeFile.ntk" (don't know what ntk stands for),
but no fix.
Can anybody help me with this problem?

Regards;
Eelco.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]