RE: [PHP] Re: get file from directory.
| From: | hadi | Date: | Mon, 23 Jun 2014 19:27:28 +0000 |
| Subject: | RE: [PHP] Re: get file from directory. | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323520@lists.php.net to get a copy of this message | ||
> Does $ip represent the entire file name or is it a partial file name?
$ip getting passed to the function with the system ip.
I have files with system ips names in directory. Ip name of file.
I want my code to get the ip which already done and match it with directory
which not done. Can you do it according to my code.
> On 06/23/2014 12:10 PM, hadi wrote:
> >> If you know the directory and you know the filename, why do a search at
> > all?
> >> Just open it.
> >
> > Here is my problem I want to search a directory and get file match "$ip"
> > variable as mention in my code.
> >
> > Can this be done.
> >
>
> Does $ip represent the entire file name or is it a partial file name?
>
> >
> >
> >> <?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);
> >>> }
> >>> }
> >>> }
> >>>
> >>> }
> >>> ?>
> >
> >> On 6/23/2014 2:17 PM, hadi wrote:
> >>> Can someone help.
> >>>
> >>> How to get specific file from directory.
> >>>
> >>> Thank you.
> >>>
> >>>
> >>>
> >> If you know the directory and you know the filename, why do a search at
> > all?
> >> Just open it.
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
> >> http://www.php.net/unsub.php
> >
>
>
> --
> Jim Lucas
>
> http://www.cmsws.com/
> http://www.cmsws.com/examples/
Attachment: [application/pkcs7-signature] smime.p7s
Attachment: [application/pkcs7-signature] smime.p7s