Jump to content

[SOLVED] htmlentities


Mr. R

Recommended Posts

Right.. i was looking at this and just wanted to ask a question..

 

When people register on my site i dont want them to use any characters that could be a problem, like <,>,/....

 

<?php
$str = "A 'quote' is <b>bold</b>";

// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str);

?>

(Taken from PHP site)

 

so if i used this on there username and then entered this into the database then wouldn't there username be changed to something that they didnt want?

 

if they wanted to register as the name "<blah>", i want to enter "blah" into the database.

 

is there a function i can use to output their username after changing it to what is suitable, and only output the changed username if it was actually changed?

 

Thanks, hope you understand what i want to know.

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/49519-solved-htmlentities/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.