Usually code is if ($_FILES[‘input_field_name’][‘type’] == ‘image/jpeg’) { //some code } but it is not fully validating the file types(mime). The following code will output the correct file type and avoids the security vulnerabilities of php. $phpfileInfo = new finfo(FILEINFO_MIME_TYPE); $PhpfileContents = file_get_contents($_FILES[‘name_of_input_field’][‘tmp_name’]); $MimeFileType = $phpfileInfo->buffer(PhpfileContents);
Author: Sijo Thomas
csrf exception url codeigniter
Add the following line to application/config/config.php file. $config[‘csrf_exclude_uris’] = array(‘controller 1′,’controller 2′,’controller3/method 1′,’controller3/method 2’); system/core/Security.php Modify the public function csrf_verify() function in Security.php public function csrf_verify() { // If it’s not a POST request we will set the CSRF cookie if (strtoupper($_SERVER[‘REQUEST_METHOD’]) !== ‘POST’) { return $this->csrf_set_cookie(); } // this IF statement is the…
How to Check Expired Sessions using jQuery Ajax and PHP
We can achieve using the php and ajax.The following ajax call execute in every 10 seconds to check the status of session.If it expired the user redirected to seesionout page. Ajax call in every 10 seconds var check_current_session; function CheckForCurrentSession() { var strSession=”check_current_session=true”; jQuery.ajax({ type: “GET”, url: “check_current_session.php”, data: strSession, cache: false, success: function(result){…
Major security issues facing by the websites
Vulnerabilities Severity 1) Cross Site Scripting HIGH 2) File Upload Vulnerability HIGH 3) Directory Listing Vulnerability HIGH 4) Unencrypted Login Pages HIGH 5) Session Hijacking HIGH 6) Cross Site Request Forgery(csrf) HIGH 7) Weak Captcha Implementation MEDIUM 8) Cross Frame Scripting(css) MEDIUM 9)Internal Error Handling MEDIUM 10)Cookies are not marked as HTTPOnly LOW Recommendations…
Edge Case: Nested And Mixed Lists
Nested and mixed lists are an interesting beast. It’s a corner case to make sure that Lists within lists do not break the ordered list numbering order Your list styles go deep enough. Ordered – Unordered – Ordered ordered item ordered item unordered unordered ordered item ordered item ordered item ordered item Ordered – Unordered…
