/*기본설정*/ include_once $RootDIR."_include/_DbConn.php"; include_once $RootDIR."_include/_Common.php"; $table = "kigepe_survey_question"; $idx_nm = "seq"; $query = " SELECT * FROM ".$table." WHERE 1=1 and use_yn='Y'"; $result = mysql_query($query); $query2 = " SELECT count(*) FROM ".$table." WHERE 1=1 and use_yn='Y'"; $result2 = mysql_query($query2); $row2 = mysql_fetch_row($result2); $affect_num = $row2[0]; session_start(); if($_SESSION['user_id'] != ""){ }else{ $_SESSION['user_id'] = generateRandomString(15); } $query3 = " SELECT count(*) FROM kigepe_survey_master WHERE 1=1 and id ='".$_SESSION['user_id']."'"; $result3 = mysql_query($query3); $row3 = mysql_fetch_row($result3); $affect_num2 = $row3[0]; if($affect_num2 > 0 ){ $sql = "update kigepe_survey_master set reg_date = now() where id = '".$_SESSION["user_id"]."' "; $result4 = mysql_query($sql); }else{ $sql = "insert into kigepe_survey_master set id = '".$_SESSION["user_id"]."' ,reg_date = now() ,gubun = '5' "; $result4 = mysql_query($sql); } ?> function generateRandomString($length) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } if(checkid($randomString)){ return $randomString; }else{ generateRandomString(15); } } function checkid($strid){ $fusql = "select count(*) as cnt from kigepe_survey_master where id = '".$strid."'"; $furesult = mysql_query($fusql); $furow = mysql_fetch_row($furesult); $fucnt = $furow[0]; if($fucnt > 0){ return false; }else{ return true; } } ?>
include "_inc/title.php"; ?>