Solved

Time how long script takes

Posted on 2006-11-24
2
236 Views
Last Modified: 2008-02-20
I'd like to add into this script some code that will time how long it takes to parse the IP addresses. It must then print the time with the 'banned' or 'login' message

$banned_list   =   file("allowed.lst");
$banned = false;

foreach($banned_list as $value) {
     if ($_SERVER['REMOTE_ADDR']==$value) {
           $banned = true;
           break;
     }
}

if ($banned==true) {
       echo("You are banned");
} else {
       echo("You can login");
}
0
Comment
Question by:zattz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
rhickmott earned 500 total points
ID: 18006897
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;

$banned_list   =   file("allowed.lst");
$banned = false;

foreach($banned_list as $value) {
     if ($_SERVER['REMOTE_ADDR']==$value) {
           $banned = true;
           break;
     }
}

if ($banned==true) {
       echo("You are banned");
} else {
       echo("You can login");
}



$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;

$totaltime = ($endtime - $starttime);

echo("             This page was created in $totaltime seconds<br/>  ");
0
 

Author Comment

by:zattz
ID: 18006914
Thanks :)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question