DEV Community

Discussion on: php link shortener (simplelink)

Collapse
 
suckup_de profile image
Lars Moelleken

Your URL validation is not very solid: johnnychoo.000webhostapp.com/Foo2/

With e.g. this as input

"); echo file_get_contents("../index.php"); // (https://)

so I can upload every php command that I want.

I would use the strpos check with 0 instead of false (so that we protect us against something like "file://" + a build in URL check from php: FILTER_VALIDATE_URL

If you have more question, please contact me, I am happy if I can help. 🙋

Collapse
 
johnnychoo profile image
johnny-choo

Hi Lars Moelleken,

Really appreciate your comment. I have updated my code following your advises.
Pls check it out and if possible feel free to contribute to this project. This project needs a better UI and some extra features.