Login Retreive lost passwordRegister

Forum Index / General / quotes and backslashes

[ This topic is unsolved! ]

  Recmo D. 02 April 09 / 16:46  
I've searched for a while now but cannot find an answer to my problem.
My config: Win2K server, MS-SQL server 2000, Apache 2.2.9, PHP 5.2.6, Formhandler :)

Note: To avoid quote problems in this post I replace them with , (comma)

The problem:
I call the page (see code below): edit.php?order_id=2
The first time the field name is empty.
Then I fill it with AABB and press enter
The page reloads the form, it says okidoki, the value AABB is stored in de the database and the form contains AABB.
When I change it to AA,BB and press enter the same happens, which is fine. AA,BB in the database and in the form on the screen again.
When I close the browser and then reopen it (as a complete new load of the page and no cache or back function) and go to my page again the same way then it displays the following: AA\,BB which is bad.
But... The database contains AA,BB which is good.
Now when I only hit the save button the database is also goes bad AA\,BB.
Then it goes from bad to worse because the \ is escaped to \\ so I finally end up with unwanted \ in my database and on the screen.
My magic quotes are ON and that and the needs to stay that way because this is just one of many other scripts on my server.
Somehow somewhere there is a problem with the escaping of , and \

Last thing to say: help :D

The code for edit.php is:

$form=&new dbFormHandler();








  Johan Wiegel (Admin) 02 April 09 / 17:22  
how is Magic Quotes set in your php configuration?
(enabled or disabled)

  Recmo D. 02 April 09 / 18:35  
Changed at 02 April 09 / 18:50
It's on.. Can't be set to off due to other scripts that needs it on.

magic_quotes_gpc = On

PS: Thanks for the login info.. don't understand why I missed that..

  Recmo D. 03 April 09 / 09:53  
The php ini setting magic_quotes_gpc is not the issue.
I tested the problem without FH3 plain and simple and come to the conclusion that mssql_fetch_assoc escapes the database value so $ becomes \$.
This is on my server... I can't say it for others.
Is this also a setting which can be done in some ini file?

=mssql_connect ("""aaa""bbb");
$db_selected mssql_select_db("orders"$connection);

$query "SELECT * FROM tbl_orders";
$result mssql_query($query);

$row mssql_fetch_assoc($result))
'<li>' $row['bedrijfsnaam'] . '</li>';

  Recmo D. 03 April 09 / 15:32  
I've solved it for my situation but I guess some more attention is needed by you guys..
Somewhere somehow the addslashes, magicquotes, posts and database reads were not going as it should. This is my workaround:

// file: fh3/yadal/class.mssql.php  

function getRecord$sql )
$record mssql_fetch_assoc$sql );

            if (
$record as $key=>$value)


// file: fh3/fields/class.TextField.php

function getField()
// view mode enabled ?
if( $this -> getViewMode() )
// get the view value..
return $this -> _getViewValue();


$tmp=(isset($this->_mValue) ? htmlspecialchars($this->_mValue):'');

'<input type="text" name="%s" id="%1$s" value="%s" size="%d" %s/>%s',
$tmp,                                        // (isset($this->_mValue) ? htmlspecialchars($this->_mValue):''),
$this->_iMaxlength) ? 'maxlength="'.$this->_iMaxlength.'" ':'').
$this->_iTabIndex) ? 'tabindex="'.$this->_iTabIndex.'" ' '').
$this->_sExtra) ? ' '.$this->_sExtra.' ' :''),
$this->_sExtraAfter) ? $this->_sExtraAfter :'')


© 2004 - 2017 FormHandler. All rights reserved.   -   Open source license