Hi all!
i'm about to translate a perl script to php.
i'm stuck with the following part of the script:
it checks within a db file if the client has already accessed this page before on the current day.
Furthermore i need to set the current day in a variable. in perl it would look like this:
How would this look in PHP?
I'd appreciate your help!
Maximilian
i'm about to translate a perl script to php.
i'm stuck with the following part of the script:
it checks within a db file if the client has already accessed this page before on the current day.
Code:
# Check if user's IP is already in the daily log files.
# If it is, then set firsttoday to false (0).
if(-e "count.access.log")
{
open(LOG, "<count.access.log");
@ips = <LOG>;
close(LOG);
foreach $_ (@ips)
{
if ($_ eq $userip . "\n")
{
$firsttoday = 0;
}
}
}
Furthermore i need to set the current day in a variable. in perl it would look like this:
Code:
$today = (Sun, Mon, Tue, Wed, Thu, Fri, Sat, Sun)[(localtime)[6]];
# Set to the current weekday.
How would this look in PHP?
I'd appreciate your help!
Maximilian