Forum Moderators: coopster
For example if there are 10 pages of results you throw a warning if they change the number to 11 or and non numeric parameter.
Are there risks with an SQL injection and how do you cover all the angles and prevent naughtiness occurring.
Any online resources that you would recommend.
Cheers
They don't or at least they didn't trap for '
therefore in members.asp page,
the input (M_NAME) is not checked for.
As a result, you can add extra SELECT statement to the query with UNION and you can view any data in the forum's database.
also check for exact match's with an exclude filter!#$%^&*()=+{}[]¦\;:/?>,<'
Dave
Also, make sure the search returns some form of "normal" page if any values are invalid. You don't want the user to know that his/her manipulation caused an error. You want them to think that it just returned another valid set of data.
To handle this I keep magic_quotes turned off (because I don't like them) and instead I run all my text data through this function..
function textToHtml( $text, $flags=0) {
$html = $text;
if ( ($flags & TEXTTOHTML_CONVERT_ENTITIES) > 0 ) {
// Convert weird characters to entity tags
$html = htmlentities($html, ENT_QUOTES);
// Handle euros
$html = str_replace( "\x80", '€', $html );
}
if ( ($flags & TEXTTOHTML_IGNORE_NEWLINES) == 0 ) {
// Use \n for newline on all systems
$html = preg_replace("/(\r\n¦\n¦\r)/", "\n", $html);
// Only allow two newline in a row.
$html = preg_replace("/\n\n+/", "\n\n", $html);
// Put <p>..</p> around paragraphs
$html = preg_replace('/\n?(.+?)(\n\n¦\z)/s', "<p>$1</p>", $html);
// Convert newlines not preceded by </p> to a <br /> tag
$html = preg_replace('¦(?<!</p>)\s*\n¦', "<br />", $html);
}
return $html;
}
Its a little basic at the moment (I'm still in the testing stages) but basically it converts plain text into html.
If you set the TEXTTOHTML_CONVERT_ENTITIES flag then it will handle all weird characters and quotes for you.
If you don't set the TEXTTOHTML_IGNORE_NEWLINES then it will also add <p> around paragraphs (i.e. text seperated by a blank line) and <br> for line breaks.