- This topic is empty.
-
AuthorPosts
-
February 15, 2012 at 5:51 pm #36676
ahmed18
ParticipantHey guys
I make this
echo $val ;
?>$val will display HTML code by user like this code
but image not appear and display this
http://localhost/wp/%5C%22http://localhost/val.jpg%5C%22
February 15, 2012 at 6:16 pm #96769bungle
MemberI would guess that the user HTML code is not being escaped and unescaped correctly when it is being stored. Are you storing it in a database and if so are you handing the strings correctly with addslashes() or mysql_real_escape_string() before storing and then unescaping them afterwards before echoing them out? Or are you sending them as a get variable and then not using urldecode()?
It looks like a combination of both has happened – i.e. that result looks like it has first been escaped and then url encoded
February 15, 2012 at 7:11 pm #96770ahmed18
ParticipantNo I don’t use database , I am getting HTML code from textarea content will user put
February 15, 2012 at 8:01 pm #96773bungle
Memberso the user is posting it with a form? what’s the rest of your code?
February 15, 2012 at 9:04 pm #96775ahmed18
ParticipantI want only make variable display HTML code correctly
February 15, 2012 at 11:11 pm #96785bungle
Membersorry but you are not providing enough information to tell you why that is happening.
PHP is a pre processing language, your user input must be getting to the php somehow, either by being passed as a GET or POST variable, or by being recalled from a database.
How is the $var variable being set? and how is it being read to generate your unwanted output?
Need to see all the code to figure that out, what you have provided isn’t enough.
February 16, 2012 at 4:44 am #96792ahmed18
Participantit is not script , it is options page for wp theme
and i make textarea for putting analytical code and then i use echo to print it in footer
February 16, 2012 at 9:34 am #96808ahmed18
ParticipantIt is the same problem I face
http://www.wptavern.com/forum/plugins-hacks/1859-theme-options-page-problem-html-text-textarea-inputs.htmlbut when I use code for solution give me error
echo stripslashes(get_settings('content')
February 16, 2012 at 10:09 am #96818ahmed18
Participantthx alot
I have been used htmlentities() and htmlspecialchare()
but both of them display HTML code like text not give it’s function for displaying imageFebruary 16, 2012 at 3:57 pm #96834ahmed18
Participantthx but still not working
February 17, 2012 at 8:08 am #96881Zeriz
Member -
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.