Ruby掲示板のスパム対策
以前、PHPの掲示板にスパム投稿があったので対策したという記事を書きました。
今度はRubyで作った掲示板での対策です。
(クロカンという野球漫画のファンページの掲示板なので、興味のある方は是非)

今回の招かれざる客はこんなのです。

http://fam-stahmann.de/cms chichis
http://patrick-schiffer.de/joomla mensaje de navidad
http://bluhm-tiefbau.de/cms dedicatorias de navidad
http://oxl.ch/oxl lawama
http://ismailaligago.es/joomla lawaloca
http://raumausstattung-kunz.de/kunz mensajes de navidad
http://demirspor.com.tr/web frases de navidad
http://djkamen.cba.pl uam azcapotzalco
http://fotostudio-unimedia.de/unimedia fuentes gratis
http://tention.be/peeler h extremo
http://rogalitzki.de/joomla tipos de letras
http://oxl.ch/oxl uam
http://tyrfabrika.ru uam azc
http://dallasoutdoors.com/site fuentes
http://losjuanes.net78.net/sitio dorismar h extremo
http://pasan.net78.net/joomla wanders lover h extremo
http://drive83.be/nieuw h extremo noviembre 2010
http://g1g4.site90.net mensajes de navidad para tarjetas
http://varudal.com/oldversion xxx
http://bisotoun.net/joomla career launcher
http://darrettlepel.com/home dignitas
http://yep4110mexico.org/programa wanders lover h extremo noviembre 2010
http://pro-weststadt-weinheim.de/cms fluevog
http://one2kite.com/new nalgas
http://prsgroup.ru tecnopolis
http://raubtierdressur.de/joomla fuentes de letras
http://privaterealtyservice.ru la wama
http://okna-darom.ru hay days
http://brasiliahotel.net/joomla revista h extremo
http://smartmediahosting.de/seniorenstudium brooke greenberg
http://s182283832.online.de/fze hay days 2010
http://mrmfirm.com/us gifs animados
http://zwergschnauzer-schwarz.info gaby ramirez h extremo


どう対処したかは以下で。

続き▽
| Ruby | 00:06 | comments (0) | trackback (0) |
.indexメソッドが急に使えなくなった
rubyを使ったwebページを公開しているのですが、そこで下記のロジックが使えなくなりました。

<% if ENV['REQUEST_URI'].index("ここにURL") #=> 0 then %>
ここにHTMLタグや文章
<% end %>


複数のURLで使われるcgiなのですが、あるURLの時だけタグや文章を記述したかったので、上のようなIF文を利用していました。
(例えば、トップページにだけ広告を出すとか)

しかし、昨日からこのロジックが働かなくなっているのを発見。
公開しているレンタルサーバ(ハッスルサーバ)の設定でも変わったのか……。
ともかく、仕方ないので下記のように変更。

<% if ENV['REQUEST_URI'].include?("ここにURL") == true then %>
ここにHTMLタグや文章
<% end %>


こうすると働くようになりました。

でも、indexメソッドのような基本中の基本が使えなくなる設定なんて、あるのでしょうか。
| Ruby | 23:23 | comments (0) | trackback (0) |
変数の内容を複数行にわたって挿入する時の注意
変数の内容を複数行にわたって入れたい時には、下のように書きます。

text = <<EOF
入れたい内容
入れたい内容
入れたい内容
EOF

この時、挿入の終わりにあたるEOFの前にインデントを入れていると、終わりと判断されません。

ifなどの制御文の中に上記のロジックを書く際は、注意しましょう。
| Ruby | 10:12 | comments (0) | trackback (0) |


  
CALENDAR
S M T W T F S
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30     
<<   04 - 2024   >>
LOGIN
現在のモード: ゲストモード
USER ID:
PASS:
CATEGORIES
ARCHIVES
COMMENTS
TRACBACK
PROFILE
OTHERS
POWERED BY
POWERED BY
ぶろぐん