Escapes special characters in a string for use in an SQL statement. howewer it check get_magic_quotes_gpc function is enable or no. if true , it strips string from slashes and escaped string from special characters in a string for use in an SQL statement.
function sql_escape_string( $str, $conn = '' )
{
if ( get_magic_quotes_gpc() )
$str = stripslashes( $str );
//check if this function exists
if ( function_exists( "mysql_real_escape_string" ) and $conn )
$str = mysql_real_escape_string( $str, $conn );
else
$str = addslashes( $str ); //for PHP version < 4.3.0 use addslashes
return $str;
}Tags
No tag here. Recommended pages
Resize image function...Resize image function for jpg format. $mood between max and min. if you choose max, this mean max size of image is $ta otherwise min size of image is $ta.
function makeTheThumb( $ppath, $ta, $mood )
...
Download a file from web to local...Use this function to download a file from web to local machine.
function WgetFile( $URL, $dir )
{
$nomefile = $dir . "/" . basename( $URL );
if ( copy( $URL, $nomefile ) ) {
retu...
Best way to get user ip address in php...Here is a function to getting ip using filter of local and lan ip's.
function get_ip()
{
$list = array( 'REMOTE_ADDR', 'CLIENT_IP', 'HTTP_CLIENT_IP',
'HTTP_PROXY_CONNECTION',...
Email Address Checker...This function check if an e-mail address is valid or not.
function valid_email($email)
{
return preg_match('/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/',
$email);...