Tadashi Okoshi
slash****@users*****
2005年 7月 2日 (土) 01:24:41 JST
Index: affelio/lib/Affelio/Managing/AccessLogManager.pm
diff -u affelio/lib/Affelio/Managing/AccessLogManager.pm:1.6 affelio/lib/Affelio/Managing/AccessLogManager.pm:1.7
--- affelio/lib/Affelio/Managing/AccessLogManager.pm:1.6 Fri Jul 1 11:00:08 2005
+++ affelio/lib/Affelio/Managing/AccessLogManager.pm Sat Jul 2 01:24:40 2005
@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# $Id: AccessLogManager.pm,v 1.6 2005/07/01 02:00:08 slash5234 Exp $
+# $Id: AccessLogManager.pm,v 1.7 2005/07/01 16:24:40 slash5234 Exp $
package Affelio::Managing::AccessLogManager;
{
@@ -62,12 +62,12 @@
my $af=$self->{af};
my $cur_time = get_timestamp();
- my $today = get_today();
+ my $startoftheday = get_today();
################################
#Check the table
################################
- my $create_tbl_cmd = "CREATE TABLE AFuser_CORE_accesslog(id INTEGER PRIMARY KEY, id2 INTEGER, timestamp INTEGER, nickname TEXT, afid TEXT, type TEXT)";
+ my $create_tbl_cmd = "CREATE TABLE AFuser_CORE_accesslog(id INTEGER PRIMARY KEY, id2 INTEGER, timestamp BIGINT, nickname TEXT, afid TEXT, type TEXT)";
eval{
$af->{db}->do($create_tbl_cmd);
};
@@ -81,7 +81,8 @@
################################
my $query1; my $sth1; $@="";
my @row1=();
- $query1 = "SELECT * FROM AFuser_CORE_accesslog WHERE timestamp >= $today AND afid = '$afid'";
+ $query1 = "SELECT * FROM AFuser_CORE_accesslog WHERE timestamp >= $startoftheday AND afid = '$afid'";
+ debug_print("AccessLog:save: q=[$query1]");
eval{
$sth1 = $af->{db}->prepare($query1);
$sth1->execute();
@@ -92,6 +93,7 @@
}
if(@row1 == () ){
+ debug_print("AccessLog:save: This is your 1st access today. proceed.");
my $newid=0; my $maxid=0;
##############################
@@ -108,6 +110,8 @@
my @row2 = $sth2->fetchrow_array;
$maxid = $row2[0];
+ debug_print("AccessLog:save: maxid=[$maxid]");
+
if(defined($row2[0])){
$maxid = $row2[0];
}else{
@@ -130,6 +134,7 @@
@row2 = $sth2->fetchrow_array;
$maxid2 = $row2[0];
+ debug_print("AccessLog:save: maxid2=[$maxid2]");
if(defined($row2[0])){
$maxid2 = $row2[0];
}else{
@@ -147,9 +152,14 @@
$sth3 = $af->{db}->prepare($query3);
$sth3->execute();
};
+ debug_print("AccessLog:save: inserted [$query3]");
if($@){
throw Affelio::exception::DBException($af->{db}->errstr);
}
+
+ debug_print("AccessLog:save: recorded!");
+ }else{
+ debug_print("AccessLog:save: You are a repeater. ignore you.");
}
}