Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > Comparing file creating dates...
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 17th April 20:46
genphp
External User
 
Posts: 1
Default Comparing file creating dates...



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

############# 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_addr ess.".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
  Reply With Quote


  sponsored links


2 17th April 21:54
lists
External User
 
Posts: 1
Default Comparing file creating dates...



From the manual

This returns a timestamp
int strtotime ( string $time [, int $now ] )

This returns an hash array with all the date/time info in it.
array getdate ([ int $timestamp ] )

You are trying to compare two things that are completely different.

Get rid of the getdate() function. All you need is the filectime()
call, it returns a unix timestamp.
  Reply With Quote
3 17th April 21:54
news
External User
 
Posts: 1
Default Comparing file creating dates...


you may need to use filemtime() and not filectime();
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666