PHP Code:
<?php
// why are you doing this?
ignore_user_abort(true);
// same question?
// your web host will probably kill the script if it takes close to this long anyway.
// at least, I'd hope they would;
// otherwise you might hang the server if someone kept clicking "refresh."
set_time_limit(70000000000000000000000000000000000);
// this is a big problem right now -
// something is going wrong, and you can't find out what it is
// because you're suppressing all errors.
// remove this (or set it very high) and see what you get.
// error_reporting(99999999);
$time=date('g A');
$directory = 'users/';
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$file = preg_replace('/(.*)\..*/', '$1', $file);
// are you trying to use the $file variable you created above?
// if so, don't "quote" the variable name
// $fp=fopen("$file/log.txt","r");
$fp=fopen($file."/log.txt","r");
$date=fgets($fp);
// same deal
// $fp=fopen("$file/email.txt","r");
$fp=fopen($file."/email.txt","r");
$newemail=fgets($fp);
$newdate = $date - 3;
$today=date('d');
// here, you are *setting* $time, _not_ *comparing* $time.
// if ($time = "3 am") {
// I assume you meant to do this:
if( $time == "3 am" ){
if ($date == $today - 4) {/*....do whatever.....*/}
}
}
}
closedir($handle);
}
?>
It looks like this is only part of the code you're working with - it doesn't seem to do anything, and leaves several things unused. Also, though I have no real idea of what you're trying to do, I'm sure there's an easier way to do it.
(I am curious as to what you can only do at 3am, four days after you did it last.)
Perhaps you could explain what you're trying to accomplish?
Bookmarks