#!/usr/bin/perl
use DBI;
use CGI qw/:standard/;

$percent=0;$total=0;$correct=0;
$main_table="log_student";
$sid=param("session_id");
$sid=~s/\D/\./g;
$turn=param("turn");
$turn=~s/\D/\./g;
$qid=param("question_id");
$qid=~s/\D/\./g;
$a=param("answer");
$a=~s/\W/\./g;

if($sid ne "-1")
{
    $dbh=DBI->connect("DBI:mysql:database=mc;host=localhost","bill","passw0rd");
    if($qid!=-1){$dbh->do("INSERT INTO $main_table (session_id, question_id, answer,turn) values ($sid,$qid,\'$a\',$turn);");}
    $dbh->disconnect;
}

#HTML
print"Content-type: text/html;charset=utf8;\n\n";
#print"<html><body bgcolor=#e0e0e0 style=\"font-family: monospace; font-size: 24px;\">";
#if($a eq "correct"){print"<center>Приз в студию.</center>";}
#else{print"<center>Все будет хорошо.</center>";}
print"<html><body></body></html>";
