[PHP] a href problem

2002-03-29 Thread Anders Henke

Hi folks!

Im running this forum for Flash users and I have created it in Flash. Now,
I've got this little problem... If a users writes a URL like
http://www.test.com, the url becomes clickable thanks to the code below.

$text = str_replace(, lt;, $text);
$text = str_replace(, gt;, $text);
$text = str_replace(www., http://www.;, $text);
$text = str_replace(http://http://;, http://;, $text);
$text = eregi_replace(([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/=]),
ua href=\\\1://\\2\\3\ target=\_blank\\\1://\\2\\3/a/u,
$text);
$text =
eregi_replace((([a-z0-9_]|\\-|\\.)+([^[:space:]]*)([[:alnum:]-])), ua
href=\mailto:\\1\;\\1/a/u, $text);
$text = urlencode($text);

Everything works just fine, until someone writes a
href=http://www.test.com;http://www.test.com/a. The output then becomes
a href=a href=http://www.test.com;
target=_blankhttp://www.test.com/a
target=_blankhttp://www.test.com/a.


Does anyone have a solution for this?

Regards

Anders Henke



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




Re: [PHP] urlencode and decode are producing \\\' instead of \'

2002-03-29 Thread Anders Henke

Hi!

What about using stripslashes:
$variable = stripslashes($variable);

Also see http://www.php.net/stripslashes

/Anders Henke


Jason Wong [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]...
 On Friday 29 March 2002 20:56, andy wrote:
  does not work. Just like the decode function is out of order!
  It is not even decoding \'

 I am trying to fill a form again when an error occures, therefore
I
   
redirect
   
 to the form and pass the values via url like this:
  
 
HEADER(Location:/profiles/6.$recipient_id.2.html?subject=.rawurlencode
  (
  
$
   
 subject).message=.rawurlencode($message).);
 
 then I put it in again like this
  textarea name=message rows=10 style=width:485px;
cols=58
 wrap=virtual'.rawurldecode($message).'/textarea
 
 The problem is, that this is causing a message like this:
 test  \\\'
 
 So what's wrong? Can anybody help on this?

 Well your problem is not caused by the rawurlencode, rawurldecode. It's
 probably because you have magic_quotes_gpc set to on.

 Try this:

 For your URL: rawurlencode(stripslashes($subject)), and same for $message.

 For your textarea: htmlspecialchars($subject),  $message.

 If you're putting $subject  $message into a DB you would probably want to
do
 the reverse of htmlspecialchars() before inserting them into the DB.

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk

 /*
 If you don't know what game you're playing, don't ask what the score is.
 */




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




[PHP] Mail problems on Mac

2002-03-28 Thread Anders Henke

Hi folks!

When I send mail (using the mail-function) and the subject line contains
non-english letters like å, ä, ö the special caracters turns into strange
symbols. This only happens on Mac OS, wich is pretty strange. Have anyone
else encounter this problem? Does anyone have a solution for it, or do I
just have to accept it?

Cheers!

Anders Henke



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