Delete image code-PHP source code

Source: Internet
Author: User
Delete the image code in the image code project. I hope you can give some security suggestions.

If (isset ($ _ SERVER ['http _ X_REQUESTED_WITH ']) & strtolower ($ _ SERVER ['http _ X_REQUESTED_WITH']) = 'xmlhttprequest ') {$ url = $ _ GET ['json']; $ url = $ _ SERVER ['document _ root']. urldecode ($ url ['picurl']); $ pictype = array ("gif", "jpg", "jpeg", "png", "bmp "); if (file_exists ($ url) {$ infos = pathinfo ($ url); if (in_array ($ infos ['extension'], $ pictype) & strpos ($ url, "uploadfile") {if (unlink ($ url) {echo json_encode (array ( "Status" => "1", "info" => L ('deleted successfully! ');} Else {echo json_encode (array ("status" => "2", "info" => L ("deletion failed, please check the permission! ") ;}} Else {echo json_encode (array (" status "=>" 2 "," info "=> L (" deletion failed, please check the permission! ") ;}} Else {echo json_encode (array (" status "=>" 0 ", "info" => L ("The file does not exist or has been deleted ")));}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.