Hi everyone im back with a new problem I have no idea why this is not working...
Ok this is my IF command
if(file_exists(__DIR__."/uploads/json_".$hash) &&
filesize(__DIR__."/uploads/json_".$hash) > 100 &&
time()-filemtime(__DIR__."/uploads/json_".$hash) < 168 * 3600 ===FALSE)
What I am trying to do is....A) check if the file exists and is over 100bytes and not older then a week...
I really need a inline solution as I have to do a find and replace in notepad as I have this in a few places in my script
Any help would be great
Ok here is the full code ignore the ##url## and ##key## with my last group attempt
$hash = hash("sha1","##key##");
if(file_exists(__DIR__."/uploads/json_".$hash) && (filesize(__DIR__."/uploads/json_".$hash) > 100) && (time()-filemtime(__DIR__."/uploads/json_".$hash) < 168 * 3600)){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "###URL###");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
$credits = curl_exec($ch);
curl_close($ch);
$f = fopen(__DIR__."/uploads/json_".$hash,"wb");
fwrite($f,$credits);
fclose($f);
echo "
<script>
alert(\"Updated Record\");
</script>";
}else {
$credits = file_get_contents(__DIR__."/uploads/json_".$hash);
}
$creditsun= json_decode($credits, true); // Decode the results into an array