Re: [PHP-DB] Flush database

2002-09-30 Thread wade

Could anyone help me to figure out how to write a piece of code that says
if the time now time( ) is greater than 1 hour of the time( )then do
something.
I have a script that gets the time as of now and I also have the time of
(lets say then) stored in a database.
 how would I write the code to say if the old time is greater than 1 hour do
something?

  $subtracted_time = $time_now - $stored_database_time;
if ($subtracted_time  mktime(1,0,0,0,0,0))

Thank you



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




[PHP-DB] Flush database

2002-09-27 Thread wade

I am storing IP addresses in a database, but after an hour has passed I
want to delete all the IP addresses from that database. I want to do
this based on the server time. Example.. Someone comes to my web page, I
store their IP address in my database. So now I write a PHP script that
says if that IP returns to my page within an hour, they can't view my
page. If they come back after an hour has passed they can view the
contents of that page. but only after an hour has passed.

Can anyone help me with the syntax or functions that will clear the
database after an hour of waiting has passed?
Is this possible? Any suggestions, logic or any help on this matter will
be greatly appreciated.

Thank you

--
Should you have any questions, comments or concerns, feel free to call
me at 318-338-2033.

Thank you for your time,

Wade Kelley, Design Engineer

Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com





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




Re: [PHP-DB] Flush database

2002-09-27 Thread Ignatius Reilly

why not simply store the server time at log in in the DB after a successful
log in together with the IP address; and at the next log in request perform
a SQL time difference comparison?

Ignatius

- Original Message -
From: wade [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, September 27, 2002 10:53 PM
Subject: [PHP-DB] Flush database


 I am storing IP addresses in a database, but after an hour has passed I
 want to delete all the IP addresses from that database. I want to do
 this based on the server time. Example.. Someone comes to my web page, I
 store their IP address in my database. So now I write a PHP script that
 says if that IP returns to my page within an hour, they can't view my
 page. If they come back after an hour has passed they can view the
 contents of that page. but only after an hour has passed.

 Can anyone help me with the syntax or functions that will clear the
 database after an hour of waiting has passed?
 Is this possible? Any suggestions, logic or any help on this matter will
 be greatly appreciated.

 Thank you

 --
 Should you have any questions, comments or concerns, feel free to call
 me at 318-338-2033.

 Thank you for your time,

 Wade Kelley, Design Engineer
 
 Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
 Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
 Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com
 




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




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




Re: [PHP-DB] Flush database

2002-09-27 Thread Brad Bonkoski

How about writting the IP address to the database with a timestamp,
then when a matching IP address arrives you view the timestamp and if it has
been more then a hour, they can view the page, which would force you to
update the timestamp.  Of course you would probably need to write a
stand-alone (i.e. non-web) php script that would act as a cron job to clean
out the database periodically, whatever period you define (depending on
traffic and size of DB).

-Brad
wade wrote:

 I am storing IP addresses in a database, but after an hour has passed I
 want to delete all the IP addresses from that database. I want to do
 this based on the server time. Example.. Someone comes to my web page, I
 store their IP address in my database. So now I write a PHP script that
 says if that IP returns to my page within an hour, they can't view my
 page. If they come back after an hour has passed they can view the
 contents of that page. but only after an hour has passed.

 Can anyone help me with the syntax or functions that will clear the
 database after an hour of waiting has passed?
 Is this possible? Any suggestions, logic or any help on this matter will
 be greatly appreciated.

 Thank you

 --
 Should you have any questions, comments or concerns, feel free to call
 me at 318-338-2033.

 Thank you for your time,

 Wade Kelley, Design Engineer
 
 Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
 Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
 Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com
 

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


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




Re: [PHP-DB] Flush database

2002-09-27 Thread Jim Hunter

First make sure that you are storing the IP and the time it was saved in the
database.
Then I would have 3 queries:
1) a query to see if the IP address is in the database and less then an hour
old.
2) a query to save the IP and time into the database
3) a query to delete all entries over 1 hour old.

Then when you get a new visitor see if the IP address is in the database and
is not less then 1 hour old. Once it clears that test, save the IP and time,
then always run the delete query to clear out entries. If you have a lot of
traffic to your site you are going to generate a lot of database hits. 

Good luck.
Jim
 
---Original Message---
 
From: wade
Date: Friday, September 27, 2002 02:02:50 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Flush database
 
I am storing IP addresses in a database, but after an hour has passed I
want to delete all the IP addresses from that database. I want to do
this based on the server time. Example.. Someone comes to my web page, I
store their IP address in my database. So now I write a PHP script that
says if that IP returns to my page within an hour, they can't view my
page. If they come back after an hour has passed they can view the
contents of that page. but only after an hour has passed.

Can anyone help me with the syntax or functions that will clear the
database after an hour of waiting has passed?
Is this possible? Any suggestions, logic or any help on this matter will
be greatly appreciated.

Thank you

--
Should you have any questions, comments or concerns, feel free to call
me at 318-338-2033.

Thank you for your time,

Wade Kelley, Design Engineer

Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com





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

. 


Re: [PHP-DB] Flush database

2002-09-27 Thread Brad Bonkoski

Sounds like we are all on similar pages with timestamping, but if you issue a
delete query every time the page is viewed it could create some sub-par
performance based on number of hits.  i.e. if the site gets 100 hits in the
first 10 minutes of operation, it would issue delete logic and queries 100
times, but since they are all *new* the logic would not really do anything,
right?  So, depening on what kind of traffic you plan to generate a cron job may
be your best bet, if you plan to generate a whoel bunch, you may even need to
kick it off every hour.

-or- you could use this logic, but store in a different table a timestamp for
last delete and every time view that timestamp, and if more then a hour has
passed, then go ahead with your database clean-up routine.

-Brad


Jim Hunter wrote:

 First make sure that you are storing the IP and the time it was saved in the
 database.

 Then I would have 3 queries:

 1) a query to see if the IP address is in the database and less then an hour
 old.

 2) a query to save the IP and time into the database

 3) a query to delete all entries over 1 hour old.

 Then when you get a new visitor see if the IP address is in the database and
 is not less then 1 hour old. Once it clears that test, save the IP and time,
 then always run the delete query to clear out entries. If you have a lot of
 traffic to your site you are going to generate a lot of database hits.

 Good luck.

 Jim



 ---Original Message---



 From: wade

 Date: Friday, September 27, 2002 02:02:50 PM

 To: [EMAIL PROTECTED]

 Subject: [PHP-DB] Flush database



 I am storing IP addresses in a database, but after an hour has passed I

 want to delete all the IP addresses from that database. I want to do

 this based on the server time. Example.. Someone comes to my web page, I

 store their IP address in my database. So now I write a PHP script that

 says if that IP returns to my page within an hour, they can't view my

 page. If they come back after an hour has passed they can view the

 contents of that page. but only after an hour has passed.

 Can anyone help me with the syntax or functions that will clear the

 database after an hour of waiting has passed?

 Is this possible? Any suggestions, logic or any help on this matter will

 be greatly appreciated.

 Thank you

 --

 Should you have any questions, comments or concerns, feel free to call

 me at 318-338-2033.

 Thank you for your time,

 Wade Kelley, Design Engineer

 

 Bayou Internet...(888) 30-BAYOU...http://www.bayou.com

 Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net

 Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com

 

 --

 PHP Database Mailing List (http://www.php.net/)

 To unsubscribe, visit: http://www.php.net/unsub.php

 .


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




[PHP-DB] Flush database

2002-09-27 Thread wade

So how would one compare the timestamp?
how would you write
if timestamp is greater than timestamp + 1 hour
{
Ok to view page
run query to update that IP to new timestamp -- I think this will
be better than a delete statement
}
else
{
Can't view page
}


I know you will have to compare the timestamps. the one in the database
against the current hit.
How would one do this comparison?






--
Should you have any questions, comments or concerns, feel free to call
me at 318-338-2033.

Thank you for your time,

Wade Kelley, Design Engineer

Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com





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




Re: [PHP-DB] Flush database

2002-09-27 Thread Micah Stevens

Using UNIX timestamps:


if (time() - $timestamp  mktime(1,0,0,0,0,0)) {
 //  Difference it greater than one hour. Perform rejection 
code here
} else {
 // Difference is one hour or less. Perform acception code here.
}







At 04:35 PM 9/27/2002 -0500, wade wrote:
So how would one compare the timestamp?
how would you write
if timestamp is greater than timestamp + 1 hour
 {
 Ok to view page
 run query to update that IP to new timestamp -- I think this will
be better than a delete statement
 }
 else
 {
 Can't view page
 }


I know you will have to compare the timestamps. the one in the database
against the current hit.
How would one do this comparison?






--
Should you have any questions, comments or concerns, feel free to call
me at 318-338-2033.

Thank you for your time,

Wade Kelley, Design Engineer

Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com





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


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