I have added an extra bit of condition
Code: PHP
if (@fclose(@fopen($rightlink, "r")))
so that if the link is not reachable you dont have to open the file.