Discussion:
Search directory
hadi
2014-06-21 22:19:22 UTC
Permalink
Hi,

Can some body lookup and fix my code please.
What exactly I need is "$ip" variable should look into "$iplookup"
directory and locate its ip file.
"$ip" variable it pass to the funcation along with the "$username" as you
can see in my code.
But im not able to fix how "$ip" well search "$iplookup" directory. And get
the ip file match to it.



<?php


function timeout($username, $ip)

{


$iplookup = glob('/var/log/phplogs/iplogs/');


foreach(glob('/tmp/sess*') as $file) {
if (time()- filemtime($ip) > 60)

{
$old = "$username";
$content = file_get_contents($file);
if(strpos($content, $old) !== false) {
unlink($file);
}
}
}

}
?>
Jim Giner
2014-06-22 00:12:34 UTC
Permalink
Post by hadi
Hi,
Can some body lookup and fix my code please.
What exactly I need is "$ip" variable should look into "$iplookup"
directory and locate its ip file.
"$ip" variable it pass to the funcation along with the "$username" as you
can see in my code.
But im not able to fix how "$ip" well search "$iplookup" directory. And get
the ip file match to it.
<?php
function timeout($username, $ip)
{
$iplookup = glob('/var/log/phplogs/iplogs/');
foreach(glob('/tmp/sess*') as $file) {
if (time()- filemtime($ip) > 60)
{
$old = "$username";
$content = file_get_contents($file);
if(strpos($content, $old) !== false) {
unlink($file);
}
}
}
}
?>
Maybe you could explain what you want to do in english and leave the
coding to us. What you are "saying" and what you are doing are not the
same thing.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
hadi
2014-06-23 18:04:25 UTC
Permalink
Post by Jim Giner
Maybe you could explain what you want to do in english and leave the
coding
Post by Jim Giner
to us. What you are "saying" and what you are doing are not the same
thing.

What im trying to say here I would like to search a directory for a file
name.
Post by Jim Giner
Post by hadi
Hi,
Can some body lookup and fix my code please.
What exactly I need is "$ip" variable should look into "$iplookup"
directory and locate its ip file.
"$ip" variable it pass to the funcation along with the "$username" as
you can see in my code.
But im not able to fix how "$ip" well search "$iplookup" directory.
And get the ip file match to it.
<?php
function timeout($username, $ip)
{
$iplookup = glob('/var/log/phplogs/iplogs/');
foreach(glob('/tmp/sess*') as $file) {
if (time()- filemtime($ip) > 60)
{
$old = "$username";
$content = file_get_contents($file);
if(strpos($content, $old) !== false) {
unlink($file);
}
}
}
}
?>
Maybe you could explain what you want to do in english and leave the
coding
Post by Jim Giner
to us. What you are "saying" and what you are doing are not the same
thing.
Post by Jim Giner
--
http://www.php.net/unsub.php
Loading...