Posted 07 November 2012 - 08:00 AM
Hello everyone..
i was trying to program a Email server… and now that worked out fine… but is there any ways to make a SPAM FILTER… that if the receiver/server receives 5 messages within 5 seconds, then shutdown/ do something?
i did try something with os.startTimer(0) but that seems like, not to work out.
my current code:
if anyone could figure out how to help me, making that Spam filter, i would be really happy!
Thanks.
______________________________________________________________________
- mikk809h
i was trying to program a Email server… and now that worked out fine… but is there any ways to make a SPAM FILTER… that if the receiver/server receives 5 messages within 5 seconds, then shutdown/ do something?
i did try something with os.startTimer(0) but that seems like, not to work out.
my current code:
Spoiler
local running = true
local SM = 0
local Timer = 0
while running do
Timer = os.startTimer(0)
rednet.open("right")
if SM < 5 then
id, msg = rednet.receive()
print(msg)
IDToRe = tonumber(msg)
a1, ms1 = rednet.receive()
print("msg from - "..a1.." - "..ms1)
print(IDToRe)
print("------------------------------------------")
if Timer > 5 then
SM = SM + 1
else
Timer = Timer + 1
end
if Timer < 5 then
if SM < 5 then
SM = 0
end
end
else
running = false
print("EMAIL SPAMMING! STOPPING SERVER IN 10 seconds!")
sleep(10)
Timer = 0
SM = 0
running = true
os.reboot()
end
end
if anyone could figure out how to help me, making that Spam filter, i would be really happy!
Thanks.
______________________________________________________________________
- mikk809h