Comparing file creating dates...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey all,

Heres what i am trying to do:

When someone sends a message from my site, i take their ip address and make a file with their ip address in a directory called "hash-directory", the file looks like this: 169.34.534.243.txt

I want to make sure they cant send too many messages because of the potential to spam, so I want to limit them to sending a message every X number of minutes... heres what i have written (its not working for some damn reason)

############# Start PHP file ################

if(isset($_SERVER['REMOTE_ADDR']))
{$rem_address=$_SERVER['REMOTE_ADDR'];}

$directory_with_files="hash-directory/";
$threshold = strtotime('-2 minutes');

echo "File created on: <b>".$rem_address .".txt - ". date("F d Y H:i:s.", filectime($directory_with_files.$rem_address.".txt"))." ".$file_time_details[0]."</b><br><br>";

if (file_exists($directory_with_files.$rem_address.".txt")) 
    {

        if (getdate(filectime($directory_with_files.$rem_address.".txt")) < $threshold)
            {echo "<b>Please wait more than 1 minute before posting.</b><br>";}
                else{echo "<b>Enough time has elapsed.</b><br>";}
    }

############# END PHP file ################


Where am I going wrong?

Thanks!
Ryan
 
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)




      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux