Forum Moderators: coopster

Message Too Old, No Replies

URL backslash error

str_replace error

         

NoviceMaster

11:53 pm on Feb 28, 2008 (gmt 0)

10+ Year Member



using firefox browser.apache server 2.2.8

when i click on a link in my website
(exp. gallery) it directs me to [domain].\/gallery.php ,so i get "server not found" error.

i think the problem is here:

function clean_value($value)
{
$value = str_replace("\\\"", "\"", $value);
$value = str_replace("\\'", "'", $value);
$value = str_replace("\\\\", "\\", $value);

and here also :
$mmhclass->info->user_session = unserialize(stripslashes(str_replace(""", "\"", urldecode($mmhclass->input->cookie_vars['mmh_user_session']))));

or maybe it's an html error :
block_id.innerHTML = "<input type=\"text\" id=\"" + id + "_rename\" maxlength=\"25\" style=\"width: 165px;\" class=\"input_field\" value=\"" + block_id.innerHTML + "\" />";

please help !

[edited by: NoviceMaster at 12:03 am (utc) on Feb. 29, 2008]

le_gber

4:17 pm on Feb 29, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi NoviceMaster,

Not sure where it comes from but I thought I try to give you some coding pointer (please note I am not the greatest coder)

1. It is not usually recommended to modify value entered in a form field. I am saying this because of all the str_replace code you have. If this comes from a form it is usually best to fail the verification rather than 'trying to clean' the data.

2. make your js code cleaner, you could use single quotes for your vars ie.

block_id.innerHTML = "<input type=\"text\" id=\"" + id + "_rename\" maxlength=\"25\" style=\"width: 165px;\" class=\"input_field\" value=\"" + block_id.innerHTML + "\" />";

becomes

block_id.innerHTML = '<input type="text" id="' + id + '"_rename" maxlength="25" style="width: 165px;" class="input_field" value="' + block_id.innerHTML + '" />';