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
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.

Link to comment
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.

 

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.