Posts

Showing posts from February, 2021

How to set and get log in MySQL?

Using below MySQL statement, we can set and get the MySQL log: For getting the log, we must need set global log using command as below: SET global general_log = 1 ; Now need execute command using storing output:     SET global log_output = 'table' ;   Now you can see the log using below query: SELECT * FROM mysql.general_log; If you want to disable log, then need to run below query:      SET global general_log = 0 ;

How to increase the security for login and prevention for SQL injection in PHP?

Sometimes developers are set the user name and password directly to query without using any plain text checking function like addslashes() of PHP function or mysqli_real_escape_string()  of mysqli functions for entered username and password by user. And some time end uses are setting the password very poorly like set our simple name or birthday and name etc. So we need care about below things: For end user, password should not be be your personal details like birth date or your first or last name. For developer, Should to set restriction like allowed three wrong attempts after that block the user for 24 hours. From preventing SQL injection, Should to add addslashes()  for PHP and for My SQL  mysqli_real_escape_string() before executing the query to database. Understanding with examples: <?php /* For query */ $con = mysqli_connect ( "localhost" , "user" , "password" , "dbname" ); $user_name = mysqli_real_escape_string( $c

Changing upload_max_filesize on PHP

Using below lines, we can set the upload_max_filesize at run time in php: First of all you need to check current set upload_max_filesize: <?php echo "Upload max file zise =  " . ini_get("upload_max_filesize") ; ?> Now set the upload_max_filesize 200 MB: <?php ini_set('upload_max_filesize', '200MB'); ?> Now check the changed size: <?php echo "Upload max file zise =  " . ini_get("upload_max_filesize") ; ?> We can also get and set the post_max_size as per above example.