On Tuesday 20 July 2004 18:34, [EMAIL PROTECTED] wrote:
> Ok, this may or may not be a tricky one I will try and be succinct in my
> statement.
>
> I have a database (mysql 4.0) with radius log entries for each day, we
> receive emails about Acceptable Use Abuses and must figure out exactly
> who was online with a certain IP address when the abuse occurred. As you
> will see below there are multiple starts and stops for any given IP
> address so here is the scenario:
>
> Problem: Spam Abuse
> IP of offender: 66.50.xxX.245
> Date of offense: 2004-07-05
> Time of offense: 16:15
>
[..]
>  now of course I changed the usernames and modified the IP for  this
> mailing but that doesn't matter, now, the time field in the Database IS
> a time data type. What I need to be able to do is find the start before
> the offense time, and the stop after the offense time so I know that the
> person with the start and the stop is the one that committed the abuse.
>
> I haven't actually put code to bits yet, because I am not exactly sure
> how to go about creating this logic code. I don't think I can just say
> if $timefield < time of offense and $timefield > time of offense; return
> some stuff.
>

Wouldn't it be enough if you would get the first entry before the "time of 
offense"? You could do something like:

select *
from your_table_name
where ip = 'xxx.xxx.xxx.xxx'
  and timefield < time_of_offense
order by timefield desc

I'm not sure about the "order by" part (either it must be "asc" or "desc"), 
but if you select everything before the time of offense and take the first 
entry, you should get the guy who logged in last.

HTH,

Philipp

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to