Mercurial > hgrepos > hgweb.cgi > skipweb
view opencampus2015/quest.rb @ 2596:11e291bdd90a
hoge
author | ARAKI Tsuyohito <c113007@e.koeki-u.ac.jp> |
---|---|
date | Thu, 22 Oct 2015 18:40:12 +0900 |
parents | |
children | 667f8ae73792 |
line wrap: on
line source
#!/usr/bin/env ruby22 # -*- coding: utf-8 -*- require 'sqlite3' require 'kconv' require 'cgi' c = CGI.new(:tag_maker => "html5", :accept_charest => "UTF-8") db = SQLite3::Database.new("sql/main.sq3") id = c.cookies["id"][0].to_i cmps = c["cmps"] #card = "select " 設定してる予定のi1,i2,i3を選びたい。どこから? メインテーブル? それようのテーブル? exppoint = "select e1 from box where id = ?" #じぶんのidのboxにある一体目の経験値 expup = "update box set e1 = ? where id = ?" exp2 = db.execute(exppoint,id) exp = exp2[0][0].to_i if cmps == "↑" exp += 2 end db.execute(expup,exp,id) printf(<<_EOS_,cmps) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"> <meta name="format-detection" content="telephone=no"> <link media="only screen and (max-device-width:480px)" href="smart.css" type="text/css" rel="stylesheet" /> <link media="screen and (min-device-width:481px)" href="profeel.css" type="text/css" rel="stylesheet" /> <link rel="shortcut icon" href="./img/cabage.png"/> <title>だぁんじょん</title> <style type="text/css"> <!-- --> </style> </head> <body> <h1>だぁんじょん%s</h1> <div class="gage"> <p class="gage">exp</p> </div> <p>こうえきポイント:</p> <form method="POST" action="quest.rb"> <input type="submit" name="cmps" value="←" disabled> <input type="submit" name="cmps" value="↑"> <input type="submit" name="cmps" value="→"> </form> <footer></footer> </body> </html> _EOS_