Forum Moderators: coopster
$input = mysql_real_escape_string($input);
function mysql_prep( $value ) {
$magic_quotes_active = get_magic_quotes_gpc();
$new_enough_php = function_exists( "mysql_real_escape_string" ); // i.e. PHP >= v4.3.0
if( $new_enough_php ) { // PHP v4.3.0 or higher
// undo any magic quote effects so mysql_real_escape_string can do the work
if( $magic_quotes_active ) { $value = stripslashes( $value ); }
$value = mysql_real_escape_string( $value );
} else { // before PHP v4.3.0
// if magic quotes aren't already on then add slashes manually
if( !$magic_quotes_active ) { $value = addslashes( $value ); }
// if magic quotes are active, then the slashes already exist
}
return $value;
} $query = "insert into messages(text, facebook, twitter, custom, up, down, date) values('{$input}', '{$fb}', '{$twt}', '{$cust}', 0, 0, '{$time}');"; <?php
$input =mysql_prep($_POST['text']);
$fb =mysql_prep($_POST['facebook']);
$twt =mysql_prep($_POST['twitter']);
$cust =mysql_prep($_POST['custom']);
continue
?> &query ="INSERT INTO messages (
text, facebook, twitter, custom, up, down, date
)VALUES (
'{$input}', '{$fb}', '{$twt}', '{$cust}', 0, 0, '{$time}')";
$result= mysql_query($query); $query = "insert into messages(text, facebook, twitter, custom, up, down, date) values('{$input}', '{$fb}', '{$twt}', '{$cust}', 0, 0, '{$time}');"; } $query = "insert into messages(text, facebook, twitter, custom, up, down, date) values('{$input}', '{$fb}', '{$twt}', '{$cust}', 0, 0, '{$time}')";