|
-
Jan 29th, 2008, 12:02 PM
#1
Thread Starter
Addicted Member
[RESOLVED] mysql_real_escape_string problem
I am having a problem when a user submits specific text to my database. If the user types a UNC path to a server and the server starts with an 'R' then the data is malformed as it gets entered into the mySQL database.
For example, if the user typesI submit the data to the database using the mysql_real_escape_string. Which changes the data to now readThis causes a problem when pulling the data out of the database and displaying it because of that \r\n. It does some tricky formatting and then the data printed in HTML looks likeAny help on this?
Last edited by kzatu; Jan 29th, 2008 at 12:05 PM.
Changes are not permanent, but change is. {Neil Peart}
-
Jan 30th, 2008, 04:02 AM
#2
Re: mysql_real_escape_string problem
This could be a bug. What happens if the path starts with \\n?
-
Jan 30th, 2008, 10:29 AM
#3
Thread Starter
Addicted Member
Re: mysql_real_escape_string problem
I just tried your suggestion and it does the same thing. I typedand it replaced it withand when I pull it out of the database and print it, it looks like
Changes are not permanent, but change is. {Neil Peart}
-
Jan 30th, 2008, 11:04 AM
#4
Re: mysql_real_escape_string problem
Show us some code: specifically, everything that happens to the value "\\name\share" after the user submits it.
Escaping \r and \n characters is documented behaviour for this function but it should not be replacing literal \r with literal \r\n. There must either be some other issue with how you are handling the submitted data or the function is buggy.
-
Jan 30th, 2008, 01:16 PM
#5
Thread Starter
Addicted Member
Re: mysql_real_escape_string problem
Hmm. I was trimming the excess fat off of my code so that I could show you the bare essentials of what my code is doing when I stumbled upon a discovery. The problem appears to lie with TinyMCE which is something that I just installed and deployed a few weeks ago.
So here is the code in its simplest form with its suspected bug.
Code:
<?php
$newcontent=$_POST['newcontent'];
echo $newcontent;
?>
<HTML>
<head>
<script language="javascript" type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "simple"
});
</script>
</head>
<form method="post" action="test.php">
<textarea name="newcontent" id="newcontent"><?php echo $newcontent ?></textarea>
<input class="button" type="submit" name="submit" value="Submit">
</form>
</html>
You can actually go to the live example on TinyMCE's page and witness this bug for yourself at http://tinymce.moxiecode.com/example...p?example=true
And this appears to be reported as a bug, here http://sourceforge.net/tracker/index...81&atid=635682
Also, I'll go ahead and mark this thread as closed, but if you want to add something, please do.
Last edited by kzatu; Jan 30th, 2008 at 01:48 PM.
Changes are not permanent, but change is. {Neil Peart}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|