How to fix an error when ftp: //, Thunder: //, and flashget are added to the phpcms Program

Source: Internet
Author: User
Tags ftp file

I recently used PHP Open SourceProgramI made a website and found that an error occurred while downloading the FTP file. So I checked plus/download. php to exclude it one by one, and finally found that it was the second to the last line.CodeError.

 
Header("Location :{$ Softurl}");Exit();

I have never systematically studied PHP, so I am not very familiar with it. I searched for it and learned the role of the header function here, I also searched for the PHP header FTP error page, found a similar problem http://topic.csdn.net/t/20060415/12/4688825.html

So I referred to his practice and used

 
Echo"<Meta HTTP-EQUIV = Refresh content = '0; url = {$ Softurl} '> ";

As a download, but now the http: // file has an error, but FTP can be downloaded normally, so I combined the two to make a judgment

If(Preg_match("# ^ Thunder: \/| ^ ftp: \/| ^ flashget: \/# I ",$ Softurl)){Echo"<Meta HTTP-EQUIV = Refresh content = '0; url = {$ Softurl} '>";Exit();}Header("Location :{$ Softurl}");Exit();

You can download all the tests in this way. If you have a better method, please feel free to talk about it. Thank you. I am a rookie in PHP. What is wrong? Please point out.

Phpcms V9 also has similar problems. The solution is the same:

Find the file modules/content/down. php

Find the Code:

         //  Remote File         If ( Strpos ( $ Fileurl ,':/')&&( Strpos ( $ Fileurl , Pc_base: load_config ('system', 'upload _ url') = False  )){  Header ("Location: $ Fileurl " );}  Else  {  If ($ D = 0 ){  Header ("Location :". $ Fileurl  );}  Else  {  $ Fileurl = Str_replace ( Array (Pc_base: load_config ('system', 'upload _ url '),'/'), Array (Pc_base: load_config ('system', 'upload _ path'), directory_separator ), $ Fileurl );  $ Filename = Basename ( $ Fileurl );

To:

         //  Remote File          If ( Strpos ( $ Fileurl ,':/')&&( Strpos ( $ Fileurl , Pc_base: load_config ('system', 'upload _ url') = False  )){ If ( Preg_match ("# ^ Thunder: \/| ^ ed2k :\/ \/| ^ ftp: \/| ^ flashget: \/# I ", $ Fileurl  )){  Echo "<Meta HTTP-EQUIV = Refresh content = '0; url = $ Fileurl '>" ;  Exit  ();}  Header ("Location: $ Fileurl " ); Exit  ();  }  Else  {  If ( $ D = 0 ){  Header ("Location :". $ Fileurl  );}  Else  {  $ Fileurl = Str_replace (Array (Pc_base: load_config ('system', 'upload _ url '),'/'), Array (Pc_base: load_config ('system', 'upload _ path'), directory_separator ), $ Fileurl  );  $ Filename = Basename ( $ Fileurl );

You can solve this problem.

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.