Jump to content

eddie

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by eddie

  1. Hello, Thanks a lot, you were right! Just to clarify for anyone else who has this problem... I tried the top three character sets and nelow is the results: $value = "Rosé Wine"; echo htmlentities($value, ENT_QUOTES, "ISO8859-1"); // Output: Rosé Wine echo htmlentities($value, ENT_QUOTES, "ISO8859-15"); // Output: Rosé Wine echo htmlentities($value, ENT_QUOTES, "UTF-8"); // Output: Rosé Wine So you need to set the character set to UTF-8: echo htmlentities($value, ENT_QUOTES, "UTF-8");
  2. I have had some trouble with this kind of thing before. Could you post your html code for the flash? Try adding this line of code if the flash is in object tags.
  3. Hello again I am having trouble converting special characters when a form is submitted. These include symbols like 'é'. I have tried using the php functions: htmlspecialchars and htmlentities, but these don't produce my desired result. Below are the two results of using the php functions above to convert 'Rosé Wine': Using htmlspecialchars $value = "Rosé Wine"; echo htmlspecialchars($value); // Output: Rosé Wine Using htmlentities $value = "Rosé Wine"; echo htmlentities($value); // Output: Rosé Wine Using str_replace $value = "Rosé Wine"; echo str_replace("é","é",$value); // Output: Rosé Wine As you can see this is not what i am looking for, below is the output that i am after. Using some magical php function that google cannot help me find $value = "Rosé Wine"; echo cleverfunction($value); // Output: Rosé Wine Also i would prefer not to have to create a custom made function as there maybe characters that i miss. Do you know how to do this? Thankyou very much!! Eddie
  4. Thanks very much guys!! Just for anyone that reads this and has this problem, I removed the and that fixed it. Like you said, it was trying to find a 'root' element within the 'root' tags. Thanks again chaps
  5. Hello, I have wrote a PHP script that writes a sitemap so that it can be dynamically updated when a user changes the website layout. Below is the xml structure that i cannot see any problems with but i cannot get it validated. The error that comes up is: Content of element type "root" must match "(url)". Here is the xml code, ]> http://whatever.co.uk/ http://whatever.co.uk/about/ http://whatever.co.uk/contact/ http://whatever.co.uk/services/ http://whatever.co.uk/ http://whatever.co.uk/ http://whatever.co.uk/test3/ http://whatever.co.uk/ http://whatever.co.uk/my-name/ http://whatever.co.uk/test5/ Can anyone help me here? Thanks a lot everyone. Eddie
  6. Ah right, include that into every script, got it Cheers for all your help Stephen.
  7. Thanks Steve!! That explains it I've been having to add stripslashes($_POST['data']) to everything that have been submited by the POST method in a form! Just to get a variable to equal what was actually submitted by the form haha. They have removed the option to change the magic quotes on/off in the newer PHP versions which is good, but on the other hand, when the company we host with upgrade their version of PHP we will need to change our scripts I have read the manual for disabling it and i don't quite understand how to do this. They have just wrote some text. Do you know how to do it?
  8. Hello, While i have been working on a few PHP scripts i have come across something and i cannot figure out why it is doing it, hopefully you may be able to tell me. When a form is submitted i have always used the following code to protect the mysql queries from sql injection and to strip any tags that have been entered: $data=mysql_real_escape_string(strip_tags($_POST['data']); The data variable is then passed through a mysql query and then i echo out a message like this. echo "The data you entered, ".$data.", was successfully added to the database."; The problem is this... When the data is echoed out, if the data contained a ' character then there is 3 backslahes before it. For example is a user entered: Eddie's code The message would say: The data you entered, Eddie\\\'s code, was successfully added to the database. I think that the ' character is being protected by a backslash and then both those characters are being protected so therefore it results in 3 backlashes and a ' character. When i remove the SQL protection (mysql_real_escape_string(strip_tags($_POST['data'])) then the data is passed through the query correctly without trouble... After all of that what i really want to know is, do mysql queries now protect themselves form SQL injection? I don't know which verison PHP the server i have my script hosted on it, but i would just like to know why this is and whether it is safe to remove all the SQL protection as the mysql quries execute the code with no trouble even when a ' character is used. Sorry for the essay haha, Thanks everyone for you time in helping me Eddie ##Edit## When a user submits a textfield with a ' characters in it, is that characters escaped using a backslash?
×
×
  • Create New...