간단한 카운트
페이지 정보
본문
############# 카운트 시작 ###########################
$today = date("Y-m-d");
$n_time = (int)trim(date("H"));
// 쿠키보관시간
$tm = time() + 3600;
$CntID = "특정단어";
if(!$HTTP_COOKIE_VARS["OneClick_Count"] || $HTTP_COOKIE_VARS["OneClick_Count"] != "$CntID"){
SetCookie("OneClick_Count","$CntID",$tm,"/");
$CoSQL = "select count(idx) from table_name where CntID = '$CntID' and n_date = '$today'";
$CoRow = mysql_fetch_row(mysql_query($CoSQL));
if(!$CoRow[0] || $CoRow[0] < 1){
$CoSQL = "insert into table_name (CntID, n_date";
for($i=0; $i <= 23; $i++){
$CoSQL .= ", H{$i}";
}
$CoSQL .= ", n_total) values ('$CntID', '$today'";
for($i=0; $i <= 23; $i++){
if($i == $n_time){
$CoSQL .= ",'1'";
}else{
$CoSQL .= ",'0'";
}
}
$CoSQL .= ",'1')";
}else{
$CoSQL = "update table_name set H".$n_time." = H".$n_time."+1, n_total = n_total+1 where CntID = '$CntID' and n_date = '$today'";
}
mysql_query($CoSQL);
}
############# 카운트 끝 ###########################
CREATE TABLE ` table_name` (
`idx` int(11) NOT NULL auto_increment,
`CntID` varchar(25) NOT NULL default '',
`n_date` varchar(11) default NULL,
`H0` int(11) default NULL,
`H1` int(11) default NULL,
`H2` int(11) default NULL,
`H3` int(11) default NULL,
`H4` int(11) default NULL,
`H5` int(11) default NULL,
`H6` int(11) default NULL,
`H7` int(11) default NULL,
`H8` int(11) default NULL,
`H9` int(11) default NULL,
`H10` int(11) default NULL,
`H11` int(11) default NULL,
`H12` int(11) default NULL,
`H13` int(11) default NULL,
`H14` int(11) default NULL,
`H15` int(11) default NULL,
`H16` int(11) default NULL,
`H17` int(11) default NULL,
`H18` int(11) default NULL,
`H19` int(11) default NULL,
`H20` int(11) default NULL,
`H21` int(11) default NULL,
`H22` int(11) default NULL,
`H23` int(11) default NULL,
`n_total` int(11) default NULL,
PRIMARY KEY (`idx`)
) ;
$today = date("Y-m-d");
$n_time = (int)trim(date("H"));
// 쿠키보관시간
$tm = time() + 3600;
$CntID = "특정단어";
if(!$HTTP_COOKIE_VARS["OneClick_Count"] || $HTTP_COOKIE_VARS["OneClick_Count"] != "$CntID"){
SetCookie("OneClick_Count","$CntID",$tm,"/");
$CoSQL = "select count(idx) from table_name where CntID = '$CntID' and n_date = '$today'";
$CoRow = mysql_fetch_row(mysql_query($CoSQL));
if(!$CoRow[0] || $CoRow[0] < 1){
$CoSQL = "insert into table_name (CntID, n_date";
for($i=0; $i <= 23; $i++){
$CoSQL .= ", H{$i}";
}
$CoSQL .= ", n_total) values ('$CntID', '$today'";
for($i=0; $i <= 23; $i++){
if($i == $n_time){
$CoSQL .= ",'1'";
}else{
$CoSQL .= ",'0'";
}
}
$CoSQL .= ",'1')";
}else{
$CoSQL = "update table_name set H".$n_time." = H".$n_time."+1, n_total = n_total+1 where CntID = '$CntID' and n_date = '$today'";
}
mysql_query($CoSQL);
}
############# 카운트 끝 ###########################
CREATE TABLE ` table_name` (
`idx` int(11) NOT NULL auto_increment,
`CntID` varchar(25) NOT NULL default '',
`n_date` varchar(11) default NULL,
`H0` int(11) default NULL,
`H1` int(11) default NULL,
`H2` int(11) default NULL,
`H3` int(11) default NULL,
`H4` int(11) default NULL,
`H5` int(11) default NULL,
`H6` int(11) default NULL,
`H7` int(11) default NULL,
`H8` int(11) default NULL,
`H9` int(11) default NULL,
`H10` int(11) default NULL,
`H11` int(11) default NULL,
`H12` int(11) default NULL,
`H13` int(11) default NULL,
`H14` int(11) default NULL,
`H15` int(11) default NULL,
`H16` int(11) default NULL,
`H17` int(11) default NULL,
`H18` int(11) default NULL,
`H19` int(11) default NULL,
`H20` int(11) default NULL,
`H21` int(11) default NULL,
`H22` int(11) default NULL,
`H23` int(11) default NULL,
`n_total` int(11) default NULL,
PRIMARY KEY (`idx`)
) ;
- 이전글일반적인 디비 퀘리 21.02.09
- 다음글특정파일에서 연타방지 (급한대로..) 21.02.09
댓글목록
등록된 댓글이 없습니다.