-1

I own an online FTP using PHP and since mcrypt has been deprecated I wanted to switch to openssl to continue encrypting and storing user credentials as a cookie (deletes when the browser session ends). I know for a fact that the encryption process is working correctly as I have full functionality of everything, but the ftp:// path. I have also echoed out the values inside the cookie after it has been encrypted and decrypted and they were exactly what they were before I encrypted them.

This is just one example of something that doesn't work now, but worked before:

$file=fopen("ftp://$u:$p@$h".$_GET['dir'],"r") or die("Couldn't open file");

Warning: fopen() expects parameter 1 to be a valid path, string given in hidden on line hidden

I don't understand why this is happening and I would be very applicable to give any code that might be needed in determining why this is occurring. However, I can't post code that may compromise the security of my site. Thank you in advance.

1 Answers1

-1

The issue is that there are extra characters in the decryption. You can't see these characters so you don't know that they are there. Use the following:

strval(str_replace("\0", "","ftp://$u:$p@$h".$_GET['dir']))