Guest User

Untitled

a guest
Oct 21st, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.73 KB | None | 0 0
  1. res=db.query("SELECT active,mail, CONVERT(message USING utf8) FROM autoresponder WHERE moddate >= SUBTIME(NOW(), \"666:15:0\");")
  2.  
  3. # jeśli zapytanie nie zwraca wyników, zakończ
  4.  
  5. if res.num_rows<1
  6.  res.free
  7.  db.close
  8.  exit
  9. end
  10.  
  11. # główna pętla
  12.  
  13. for t in res
  14.   # jeśli active == 1
  15.   if t[0] == "1"
  16.     # wyciąganie loginu z pola mail
  17.     login=t[1].split("@")[0]
  18.     # wyciąganie domeny z pola mail
  19.     tmp=t[1].split(".")
  20.     tmp.shift
  21.     domain=tmp.join(".")
  22.     msg=t[2]
  23.     File.open("#{login}", "w") do |f|
  24.       f.write("#{msg}")
  25.     end
  26. #  else
  27. #    puts "to sa nieaktywne autorespondery"
  28. #    puts "active: #{t[0]}"
  29. #    puts "mail: #{t[1]}"
  30. #    puts "message: #{t[2]}"
  31.   end
  32. end
  33. res.free
  34. db.close
Add Comment
Please, Sign In to add comment