sterlingdezine

sterlingdezine does not currently provide support for this item.

15 comments found.

Hi,

kool class, very useful.

Thank you very much! If you ever have any suggestions, you can send me a message because I’d love to keep working on this class to make more improvements and make it even more useful.

Warning: preg_replace() [function.preg-replace]: Compilation failed: range out of order in character class at offset 13 in /home/sterli21/public_html/simplesanitize/simplesanitize.php on line 212

I got this error while testing your script. Just letting you know, good luck with sales, seems to be a cool idea.

Actually, I was making some changes to my script and didn’t realize I was changing the live copy yesterday. I reverted things back and all is well. Sorry about that.

How does this differ from using PHP ’s filters?

You have more control over it plus all the different filtering methods are found in one place. I find this class much easier to use than PHP ’s built in functions. This is a class I use myself all the time. You type much less in most cases with this class. You can also filter various different pieces of user data different ways even though they all reside in $_POST.

filter_var($_POST[‘name’], FILTER _SANITIZE_SPECIAL_CHARS);

as opposed to:

$post->get(‘name’); or $post->get(‘name’, ‘html’);

You can do all your filtering with this class so you never have to manually use the $_POST or $_GET variables. It basically just makes everything much easier. The end product after filtering is basically the same, but it’ll be easier on you, the programmer, getting to that end product.

Very cool, thanks!

yay i’m gonna buy it, looks awesome!

yay i’m gonna buy it, looks awesome!

sorry for double-post

Hello sterlingdezine, I bought and tested your script. Really good one.

I believe you need to add / change 2 things;

1. What about if I want to check a variable, without $_GET or $_POST?

To achieve this; a. Go to line 168, change

private function cleanUp

to

public function cleanUp

Read the manual and check what cleanUp method needs as arguments to sanitize any variable without setting any data type such as $_GET or $_POST.

2. Sanitizing data is not completed. There is no protection from SQL Injection with HEX codes. I wouldn’t like to post here my solution, better to have a new version for this problem.

Once again, thank you for your work.

Hello once again

I just noticed a big mistake. When I try to sanitize my data before adding to database, I am having character set problems. If I don’t sanitize, I don’t have any character set problems.

To fix this issue, find (line 216, I edited a bit so I’m not sure about the line);

$input = htmlentities($input, ENT_QUOTES);

Replace with;

$input = htmlentities($input, ENT_QUOTES, "UTF-8");

You are done. You should also fix it in your script dude so people can use it in any language they want without decoding.

Thank you for your suggestions for my script. I have taken a look at them and will be making a couple changes soon. Thanks again.

Grreat script saves time and easy to use, definitely recommended!

Hi, I had an issue with preg_replace in case ‘strict’ and utf-8 encoding. I had resolved it this way (simplesanitize.php in private function sanitizeString(...)):

case 'strict':                                
$input = preg_replace('/[^a-zA-Z0-9_-]/u', '', $input);                
break;

Thought it may help somebody…

And here’s solution for russian characters and utf-8 (must be allright for other nonelatin alphabets)

case 'strict':
unset($string);
$input =explode(' ', $input);                
foreach ($input as $value) { 
$string .= preg_replace('/[^a-zA-Z0-9_-]/u', '', $value).' ';
}
unset($input); $input =trim($string);
break;

*Could not add russian characters in regexpression – comment system turns them into question marks (((

if i use \n or \n\r or
i can’t get the string to go to a new line because of the sanitizer any help please …........

if i use \n or \n\r or
i can’t get the string to go to a new line because of the sanitizer any help please …........

Will you please email me your email address? You can send me a message using the form found on my profile page (bottom right). I will send you an updated copy of the sanitizer with a fix :)

By the way, it only removes trailing or leading whitespace.

is this script prevent also XSS attacks?

by
by
by
by
by
by