Monday, October 7, 2013

Clean Mysql Insert Data in php

function clean_input($instr) {

     // Note that PHP performs addslashes() on GET/POST data.
     // Avoid double escaping by checking the setting before doing this.
    if(get_magic_quotes_gpc()) {
        $str = stripslashes($instr);
    }
    return mysql_real_escape_string(strip_tags(trim($instr)));
}


$output = clean_input($input);

Friday, October 4, 2013

PHP Application File Permission - Linux ( Secured File Permission )

I suspect what you really want to do is set the directories to 755 and either leave the files alone or set them to 644. For this, you can use the find command. For

example:

To change all the directories to 755 (-rwxr-xr-x):
 
 find /opt/lampp/htdocs -type d -exec chmod 755 {} \;


To change all the files to 644 (-rw-r--r--):
 
 find /opt/lampp/htdocs -type f -exec chmod 644 {} \;