check for 200 and 302 in error.php
use file_put_contents instead of fopen