RE: [PHP] my bugaboo.

2001-02-11 Thread PHPBeginner.com

What  I think you should do is to use php's build-in function addslashes()

It helps .


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-Original Message-
From: Anna [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 11, 2001 9:37 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] my bugaboo.


- Original Message -
From: "Floyd Baker" [EMAIL PROTECTED]



 Hello and thanks to all for the help on the magic quotes, etc.
 It gives me a better handle on what I'm dealing with.

 Except for one more thing.

 When I bring back text from a field which contains a ', and try to apply
it as
 the value of an input box, it still truncates in the box.

 When I simply print $text, it prints out correctly as *Don't do this* .
 When I make $text the default value of an input box, it shows as *Don*.

 If the slash is still in place, it reads *Don\'t* above the box and *Don\*
in
 the box.

 My bugaboo continues..  :-

 Thanks again for any further advice.

 Floyd


That's  a problem with HTML.
example:
input type='text' name='textName' value='Don't do this'
Sees the ' in Don't as the signal for the end of the value string.
I haven't come up with an automatic way to deal with this,
but what I have done is in these lines (where there might be an apostrophe)
make sure I use double quotes:
input type="text" name="textName" value="Don't do this"
or
print "input type=\"text\" name=\"textName\" value=\"Don't do this\"";

Of course, then you may have the same trouble with double quotes. To avoid
that you can do ereg_replace("\"", "''", $text) -- that is, replace a double
quote with two single quotes? I think, I've never bothered.

Hope this helps somehow.

Anna


--
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] my bugaboo.

2001-02-11 Thread Floyd Baker



The problem seems to be solved.

Some suggestions didn't work, in my application at least, but what I found from
a combination of them was that I can eliminate the problem using a character
entity for the apostrophe.  It prints a single quote but does not parse as a
single quote.

 $text = (stripslashes($text));
 $text = ereg_replace("'","#39;",$text);

 It doesn't work in one shot (ie \' to `).

Further; I originally placed the apostrophes into the database field as they
were, without escaping them with slashes.  I have since added slashes.  However
converting ' to #39 may eliminate the need for add/strip slashes?  I have to
try that.  

Many tnx to Anne and all.  

Floyd



On Sat, 10 Feb 2001 18:36:36 -0600, you wrote:

- Original Message -
From: "Floyd Baker" [EMAIL PROTECTED]



 Hello and thanks to all for the help on the magic quotes, etc.
 It gives me a better handle on what I'm dealing with.

 Except for one more thing.

 When I bring back text from a field which contains a ', and try to apply
it as
 the value of an input box, it still truncates in the box.

 When I simply print $text, it prints out correctly as *Don't do this* .
 When I make $text the default value of an input box, it shows as *Don*.

 If the slash is still in place, it reads *Don\'t* above the box and *Don\*
in
 the box.

 My bugaboo continues..  :-

 Thanks again for any further advice.

 Floyd


That's  a problem with HTML.
example:
input type='text' name='textName' value='Don't do this'
Sees the ' in Don't as the signal for the end of the value string.
I haven't come up with an automatic way to deal with this,
but what I have done is in these lines (where there might be an apostrophe)
make sure I use double quotes:
input type="text" name="textName" value="Don't do this"
or
print "input type=\"text\" name=\"textName\" value=\"Don't do this\"";

Of course, then you may have the same trouble with double quotes. To avoid
that you can do ereg_replace("\"", "''", $text) -- that is, replace a double
quote with two single quotes? I think, I've never bothered.

Hope this helps somehow.

Anna

--


-- 
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] my bugaboo.

2001-02-10 Thread Floyd Baker


Hello and thanks to all for the help on the magic quotes, etc.  
It gives me a better handle on what I'm dealing with.

Except for one more thing.  

When I bring back text from a field which contains a ', and try to apply it as
the value of an input box, it still truncates in the box.

When I simply print $text, it prints out correctly as *Don't do this* .
When I make $text the default value of an input box, it shows as *Don*.

If the slash is still in place, it reads *Don\'t* above the box and *Don\* in
the box.

My bugaboo continues..  :-

Thanks again for any further advice.

Floyd







On Sat, 03 Feb 2001 19:42:23 -0500, you wrote:


Hi..  

I have a routine where we input text to fields. When there is an apostrophe it
handles it correctly.  When the form is brought back for editing, the field
values show up in the input fields, with all apostrophes intact, just as it
should be. 

When I upload this script to my isp, it doesn't work..  The apostrophes truncate
the rest of the text.   'Don't cry over spilled milk', in a field, turns into
'Don'...  

I have php4 mod in my win32 devbox.  The isp is php3.  Is this the problem? 
What is the best way out of it please?

Thanks in advance.

Floyd

 
--

--


-- 
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] my bugaboo.

2001-02-10 Thread Anna

- Original Message -
From: "Floyd Baker" [EMAIL PROTECTED]



 Hello and thanks to all for the help on the magic quotes, etc.
 It gives me a better handle on what I'm dealing with.

 Except for one more thing.

 When I bring back text from a field which contains a ', and try to apply
it as
 the value of an input box, it still truncates in the box.

 When I simply print $text, it prints out correctly as *Don't do this* .
 When I make $text the default value of an input box, it shows as *Don*.

 If the slash is still in place, it reads *Don\'t* above the box and *Don\*
in
 the box.

 My bugaboo continues..  :-

 Thanks again for any further advice.

 Floyd


That's  a problem with HTML.
example:
input type='text' name='textName' value='Don't do this'
Sees the ' in Don't as the signal for the end of the value string.
I haven't come up with an automatic way to deal with this,
but what I have done is in these lines (where there might be an apostrophe)
make sure I use double quotes:
input type="text" name="textName" value="Don't do this"
or
print "input type=\"text\" name=\"textName\" value=\"Don't do this\"";

Of course, then you may have the same trouble with double quotes. To avoid
that you can do ereg_replace("\"", "''", $text) -- that is, replace a double
quote with two single quotes? I think, I've never bothered.

Hope this helps somehow.

Anna


-- 
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] my bugaboo.

2001-02-10 Thread Josh G

If replacing " characters for output to html, don't replace them with ''
(two single quotes), replace with the magic value quot; (including
the semicolon), which is a special html entity that means "put a
quotation mark here"

Search google for html entities for more.

Gfunk -  http://www.gfunk007.com/

I sense much beer in you. Beer leads to intoxication, intoxication to
hangovers, and hangovers to... suffering.


- Original Message -
From: "Anna" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, February 11, 2001 11:36 AM
Subject: Re: [PHP] my bugaboo.


 - Original Message -
 From: "Floyd Baker" [EMAIL PROTECTED]


 
  Hello and thanks to all for the help on the magic quotes, etc.
  It gives me a better handle on what I'm dealing with.
 
  Except for one more thing.
 
  When I bring back text from a field which contains a ', and try to apply
 it as
  the value of an input box, it still truncates in the box.
 
  When I simply print $text, it prints out correctly as *Don't do this* .
  When I make $text the default value of an input box, it shows as *Don*.
 
  If the slash is still in place, it reads *Don\'t* above the box and
*Don\*
 in
  the box.
 
  My bugaboo continues..  :-
 
  Thanks again for any further advice.
 
  Floyd
 

 That's  a problem with HTML.
 example:
 input type='text' name='textName' value='Don't do this'
 Sees the ' in Don't as the signal for the end of the value string.
 I haven't come up with an automatic way to deal with this,
 but what I have done is in these lines (where there might be an
apostrophe)
 make sure I use double quotes:
 input type="text" name="textName" value="Don't do this"
 or
 print "input type=\"text\" name=\"textName\" value=\"Don't do this\"";

 Of course, then you may have the same trouble with double quotes. To avoid
 that you can do ereg_replace("\"", "''", $text) -- that is, replace a
double
 quote with two single quotes? I think, I've never bothered.

 Hope this helps somehow.

 Anna


 --
 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] my bugaboo.

2001-02-04 Thread Matt

I had a problem similar to this myself a while ago...
I don't believe the issue is with the differing versions of PHP, but rather 
with the improper escaping of the quote characters.

There are two PHP functions:
addslashes() and stripslashes()

Call the former when you submit the information to properly escape the 
characters that need it, something like:

$new_data = addslashes($old_data);

should work... then when you go to display the information, call 
stripslashes to de-escape everything:

$display_str = stripslashes($new_data);

I hope this helps.

-Matt


At 06:42 PM 2/3/2001, you wrote:

Hi..

I have a routine where we input text to fields. When there is an apostrophe it
handles it correctly.  When the form is brought back for editing, the field
values show up in the input fields, with all apostrophes intact, just as it
should be.

When I upload this script to my isp, it doesn't work..  The apostrophes 
truncate
the rest of the text.   'Don't cry over spilled milk', in a field, turns into
'Don'...

I have php4 mod in my win32 devbox.  The isp is php3.  Is this the problem?
What is the best way out of it please?

Thanks in advance.

Floyd



-- 
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] my bugaboo.

2001-02-03 Thread Floyd Baker


Hi..  

I have a routine where we input text to fields. When there is an apostrophe it
handles it correctly.  When the form is brought back for editing, the field
values show up in the input fields, with all apostrophes intact, just as it
should be. 

When I upload this script to my isp, it doesn't work..  The apostrophes truncate
the rest of the text.   'Don't cry over spilled milk', in a field, turns into
'Don'...  

I have php4 mod in my win32 devbox.  The isp is php3.  Is this the problem? 
What is the best way out of it please?

Thanks in advance.

Floyd

 
--


-- 
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] my bugaboo.

2001-02-03 Thread Richard Lynch

 I have a routine where we input text to fields. When there is an
apostrophe it
 handles it correctly.  When the form is brought back for editing, the
field
 values show up in the input fields, with all apostrophes intact, just as
it
 should be.

 When I upload this script to my isp, it doesn't work..  The apostrophes
truncate
 the rest of the text.   'Don't cry over spilled milk', in a field, turns
into
 'Don'...

 I have php4 mod in my win32 devbox.  The isp is php3.  Is this the
problem?
 What is the best way out of it please?

You have magic quotes on.
Your ISP doesn't.

Edit .htaccess file in your root web directory on your ISP host, and add:
php_flag magic_quotes_gpc On

(If I remember the directive correctly...  See php.ini to be sure.)

Your ISP may also not be allowing you to use .htaccess files for performance
reasons.  Alternative:

Write a function not unlike this:

function maybe_addslashes($text){
if (magic_quotes_gpc()){
return $text;
}
else{
return addslashes($text);
}
}

And, everywhere you move data from input to the database, you'll need to
call this function on your text.

The bonus here is that you can move from server to server without caring
which ones have Magic Quotes on/off or whether they have enabled .htaccess

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
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]