Jump to content

[SOLVED] Figuring out secure form input


siwelis

Recommended Posts

I'm trying to figure out how to do this while hoping it's the right way to do it;

 

The part that determines if user inputs "ANY IRREGULAR CHARACTERS OR CODE" (sql/php) what I don't know how to do.

 

$inputerrors = "You've had some inputting problems, dude."
if($_POST['article_title'] HAS ANY IRREGULAR CHARACTERS OR CODE)
//then return;
$inputerrors .= "It seems as though you're trying to pass code into our servers. Your IP address is $gosun and your ISP is $goto. A likely photo and address of you may be $crossreferenced. If this happens more than 3 times, you will be banned and $goto will be informed of any malicious conduct. If you would just like to hack please go to my hacking server and have some educational malicious fun there.";
echo $inputerrors;
exit();

 

Thank you for all of your help. I try to answer questions on here if I can so I can give back too... And once I'm making money from my site of course, I will still be coming here for help most likely and definitely donating to show my appreciation. Thank you! Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/52062-solved-figuring-out-secure-form-input/
Share on other sites

function checkInput($string)
{
  return preg_match('/^[a-z0-9\s]*$/i', $string);
}

This will accept letters, number and spaces. If you want full stops and other punctuation just escape the character and add within the square brackets. eg [a-z09\s\.] will let people add a full stop at the end of a sentence.

function checkInput($string)
{
  return preg_match('/^[a-z0-9\s]*$/i', $string);
}

This will accept letters, number and spaces. If you want full stops and other punctuation just escape the character and add within the square brackets. eg [a-z09\s\.] will let people add a full stop at the end of a sentence.

 

I'm actually still trying to figure out where to use this code...

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.