"; echo "
"; echo "
KURONEKO SOFT
"; echo "
Locus Solus
"; /* echo "
Locus Solus Toon World
"; */ echo "
Tkl Online
"; echo "
開発ブログ
"; echo "
"; echo ""; echo ""; } #---------------------------------------------# # footer #---------------------------------------------# function Disp_Foot() { echo "\n"; echo "\n"; echo ""; } #---------------------------------------------# # 日付の計算 #---------------------------------------------# function FutureDay($DAT='',$d='',$m='',$y='') { // 未来の日付を求める $DAT=substr($DAT,0,8)."0000"; $stamp=TimeStamp($DAT,$d,$m,$y); $f_day=date("Ymd", $stamp);//."0000"; return $f_day; } #---------------------------------------------# # タイムスタンプを求める #---------------------------------------------# function TimeStamp($DAT=array(),$d=0,$m=0,$y=0,$h=0) { $date["year"]= ereg_replace("([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})", "\\1", $DAT); $date["mon"]= ereg_replace("([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})", "\\2", $DAT); $date["mday"]= ereg_replace("([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})", "\\3", $DAT); $date["hour"]= ereg_replace("([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})", "\\4", $DAT); $date["min"]= ereg_replace("([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})", "\\5", $DAT); // 未来の日付を求める //$stamp = mktime(0, 0, 0, $date["mon"] + $m, $date["mday"] + $i, $date["year"] + $y); $stamp = mktime($date["hour"] + $h,$date["min"],0, $date["mon"] + $m, $date["mday"] + $d, $date["year"] + $y); return $stamp; } #---------------------------------------------# # デコード処理 #---------------------------------------------# function decode($req) { if(!sizeof($req)) { return; }; foreach ($req as $key => $value) { if($key!=""){ if(is_array($value)){ foreach($value as $k => $v){ if (get_magic_quotes_gpc()) $v = (addslashes($v));//クォート追加 $v=htmlspecialchars($v); $P[$key][$k] = str_replace('\\\\','\\',$v);//不要な\削除 } }else{ if (get_magic_quotes_gpc()) $value = (addslashes($value));//クォート追加 $value=htmlspecialchars($value); $P[$key] = str_replace('\\\\','\\',$value);//不要な\削除 } } } return $P; } #---------------------------------------------# # 文字数チェック #---------------------------------------------# function enc_font_check($com,$max) { //copy_decodeを通った場合のみ $str_search = array("'",'"',"!","$","^","`","*","\\","\t","\r\n","\r","\n","\0"); //一時変換 $str_replace = array("'",""","!","$","^","`","*","¥","","","","",""); //元の文字 $com = str_replace($str_replace,$str_search,$com); $com=html_entity_decode($com); if(mb_strlen($com)>$max) return false; else return true; } #---------------------------------------------# # POST decode #---------------------------------------------# function copy_decode($req) { if(!sizeof($req)) { return; }; $str_search = array("'",'"',"!","$","^","`","*","\\","\t","\r\n","\r","\n","\0"); //不都合な文字(配列1) $str_replace = array("'",""","!","$","^","`","*","¥","","","","",""); //置き換える文字(配 //文字コード検出順番 mb_language("Japanese"); mb_internal_encoding("SJIS"); mb_detect_order("SJIS,UTF-8, ASCII, JIS, EUC-JP"); //decode; foreach ($req as $key => $value) { if($key=="PHPSESSID"){ break; }; if($key!=""){ if(is_array($value)){ foreach($value as $k => $v){ if (get_magic_quotes_gpc()) $v = (addslashes($v));//クォート追加 $v=htmlspecialchars($v); $v = str_replace($str_search,$str_replace,$v); $Q[$key][$k] = str_replace('\\\\','\\',$v);//不要な\削除 } }else{ if (get_magic_quotes_gpc()) $value = (addslashes($value));//クォート追加 $value=htmlspecialchars($value); $value = str_replace($str_search,$str_replace,$value); $Q[$key] = str_replace('\\\\','\\',$value);//不要な\削除 } } } return $Q; } #---------------------------------------------# # text encode #---------------------------------------------# function encode_text($req) { if(!$req) { return; }; $str_search = array("
","<br>"); //置き換える文字(配 ,"'",""",""","$","^","`","*","<",">" $str_replace = array("\n","\n"); //不都合な文字(配列1) ,"'","!",'"',"$","^","`","<",">" //encode; //$req = str_replace('\\','\\\\',$req);//不要な\追加 $R = str_replace($str_search,$str_replace,$req); //if (get_magic_quotes_gpc()) $R = (stripcslashes($R));//クォート削除 return $R; } #---------------------------------------------# # 任意のエラー画面 #---------------------------------------------# function error($f) { echo($f."
"); exit; } #---------------------------------------------# # sql読み込みモジュール #---------------------------------------------# //mysqlを読み込みデータ配列を作成する //変数でリクエスト function loadsqldata($query='',$value=array(),$NO='',$PAGE=''){ if(!SQL_FLAG || !$query) die ('error-c1'); //echo $query."

"; $TEMPDATA=array(); try { $options = array( PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES SJIS', ); $db = new PDO("mysql:dbname=".sql_database.";host=".sql_local,sql_user,sql_pass, $options); if($db == null) die ('error-c2'); if(!$NO){ $NO=0; }; if($PAGE){ $query.=" limit ".$NO.",".$PAGE; }; //クエリー生成 if(!$value){ $st = $db->query($query); }else{ $st = $db->prepare($query); $st->execute($value); } // データ配列作成 $TEMPDATA=array(); while ($row = $st->fetch(PDO::FETCH_ASSOC)) { $TEMPDATA[] = $row; } } catch (PDOException $e) { //var_dump($e); $err = $db->errorInfo(); die ('error-c3'); } unset($db); return $TEMPDATA; } #---------------------------------------------# # sql書き込みモジュール #---------------------------------------------# //mysqlを書き込みデータ配列を作成する function savesqldata($query,$value=array()){ if(!SQL_FLAG || !$query) die ('error-c4'); //echo $query."

"; try { $options = array( PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8', ); $db = new PDO("mysql:dbname=".sql_database.";host=".sql_local,sql_user,sql_pass, $options); if($db == null) die ('error-c5'); //クエリー生成 if(!$value){ $st = $db->query($query); }else{ $st = $db->prepare($query); $st->execute($value); } } catch (PDOException $e) { //var_dump($e); $err = $db->errorInfo(); die ('error-c6'); } unset($db); return true; } #---------------------------------------------# # AUTO_INCREMENT取得 #---------------------------------------------# //mysqlを書き込みデータ配列を作成する function autosqlidno($query,$TABLE){ if(!SQL_FLAG) die ('error-c4'); try { $options = array( PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8', ); $db = new PDO("mysql:dbname=".sql_database.";host=".sql_local,sql_user,sql_pass, $options); if($db == null) die ('error-c5'); $st = $db->query($query); $at = $db->query("select last_insert_id() as lid from ".$TABLE); $row = $at->fetch(PDO::FETCH_ASSOC); $lid=$row[lid]; } catch (PDOException $e) { $err = $db->errorInfo(); die ('error-c6'); } unset($db); return $row; } #---------------------------------------------# # 実ファイルの読込 #---------------------------------------------# // 機能 ファイルの読込 // 引数 $file: ファイル名 //   $str: ファイル内容 function loadfile($file='',$NO=0,$PAGE=0) { if(!file_exists($file)) { return; }; $t=0;$TEMP=array();$S=array(); $str = @file($file); if($str){ while($str[$t]){ if($t<$NO) continue; $str[$t]=preg_replace("/\r|\n/","",$str[$t]); $TEMP=split(",",$str[$t]); $S[]=$TEMP; $t++; if($t>$PAGE && $PAGE) break; } } return $S; } #---------------------------------------------# # セッション開始/言語 #---------------------------------------------# function checklang($La,$G='') { ini_set("session.save_path", DOMAINF."session"); ini_set("session.gc_maxlifetime", "9999"); ini_set("session.gc_probability", "1"); ini_set("session.gc_divisor", "100"); session_start(); $N="lang"; if($_SESSION[$N]!='' && !$G) $La=$_SESSION[$N]; if($G!='') $La=$G; if ($_SESSION[$N]!= $La) $_SESSION[$N]=$La; return $La; } #---------------------------------------------# # セッション開始/汎用 #---------------------------------------------# function checksession($name='') { del_sesfile(); ini_set("session.save_path", DOMAINF."session"); ini_set("session.gc_maxlifetime", "1800"); ini_set("session.gc_probability", "1"); ini_set("session.gc_divisor", "1"); if($name) ini_set("session.name", $name); session_start(); } #---------------------------------------------# # セッション破棄 #---------------------------------------------# function del_session() { $_SESSION = array(); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } session_destroy(); } #---------------------------------------------# # セッションdir削除 #---------------------------------------------# function del_sesfile() { //削除期限 $expire = strtotime("24 hours ago"); $dir = DOMAINF . '/session/'; $list = scandir($dir); foreach($list as $value){ $file = $dir . $value; if(!is_file($file)) continue; $mod = filemtime( $file ); if($mod < $expire){ //chmod($file, 0666); unlink($file); } } } #---------------------------------------------# # メール送信 #---------------------------------------------# function form_send($POST,$subject,$to="kuronekosoft@kuronekosoft.com"){ //文字コード設定 mb_language("Japanese"); mb_internal_encoding("SHIFT-JIS"); //件名 $header = "From: ". $POST["email"]; //本文格納 $body =""; foreach($POST as $k => $v) $body .="■".$k.":" . $v ."\n"; if(!mb_send_mail($to,$subject,$body,$header)){ return "メール送信失敗しました。
しばらく時間をおきまして再送ください。

[ 戻る ]"; } return; } #---------------------------------------------# # 暗号化 #---------------------------------------------# function form_crypt(){ //投稿キー生成 $KEYIMG = rand(1000,9999); $Crypt=crypt($KEYIMG,date("d")); $Crypt=substr($Crypt,2); $_SESSION['seskey'] = $KEYIMG; $_SESSION['sesCKEY']=$_SESSION['sesCrypt'] = $Crypt; $CKEY = substr(preg_replace("[^a-z]", "", $Crypt),0,4).'key'; //英数字以外を削除 return array($KEYIMG,$CKEY); } ?>