"; //echo $_SERVER['HTTP_REFERER']; if(!strstr($_SERVER['HTTP_REFERER'],$_SERVER['PHP_SELF'])){ exit ("

caution!!
incorrect access!

"); } if(empty($_POST["author"]) || empty($_POST["text"])){ exit ("

caution!!
please input your name & message,at least.

"); } if(!empty($_POST["text"])){ if(strlen($_POST["text"]) > 2000){ exit ("

caution!!
please input text within the limits of 2000 chars.

"); } } if(!empty($_POST["pass"])){ if(strlen($_POST["pass"]) < 4 || strlen($_POST["pass"]) > 12){ exit ("

caution!!
please input pass in the range of 4 to 12.

"); } } if(!empty($_POST["email"])){ $format1 = "^[^@]+@[^@]+[^@]+$"; if(!ereg($format1,$_POST["email"])){ exit ("

caution!!
e-mail address is incorrect.

"); }else{ $at = split("@",$_POST["email"]); if(strlen($at[0]) < 2){ exit ("

caution!!
e-mail address is incorrect.

"); }else{ if(strpos($at[1],".") == false){ exit ("

caution!!
e-mail address is incorrect.

"); }else{ $dot = split("\.",$at[1]); $cnt = count($dot); if($cnt < 2){ exit ("

caution!!
e-mail address is incorrect.

"); }else{ for($i=0; $i<$cnt; $i++){ if(strlen($dot[$i]) < 2){ exit ("

caution!!
e-mail address is incorrect.

"); } } } } } } } if(!empty($_POST["url"])){ $format2 = "(https?|ftp):\/\/.+"; if(!ereg($format2,$_POST["url"])){ exit ("

caution!!
url is incorrect.

"); }else{ if(strpos($_POST["url"],".") == false){ exit ("

caution!!
url is incorrect.

"); }else{ $dot = split("\.",$_POST["url"]); $cnt = count($dot); if($cnt < 2){ exit ("

caution!!
url is incorrect.

"); }else{ for($i=0; $i<$cnt; $i++){ if(strlen($dot[$i]) < 2){ exit ("

caution!!
url is incorrect.

"); } } } } } } foreach($_POST as $k => $v){ if(get_magic_quotes_gpc()){ $v = stripslashes($v);//エスケープの解除。 } $v = strip_tags($v);//タグの除去。 //strip_tags($text, "
");//特定のタグのみ、使用可能(多分)... //$v = htmlspecialchars($v);//特殊文字をHTMLエンティティーに変換する。 $array[$k] = $v; extract($array);//配列名を、変数として展開。 } //パスワード未入力の場合、 if($pass == ""){ $pass = $admin;//管理者権限として仮登録。 } if(isset($_POST["cookie"])){ setcookie("author","$author",time() + 60*60*24*14); setcookie("email","$email",time() + 60*60*24*14); setcookie("url","$url",time() + 60*60*24*14); setcookie("cookie","checked",time() + 60*60*24*14); //setcookie("pass","$pass",time() + 60*60*24*14); }else{ setcookie("author","$author",time() - 1); setcookie("email","$email",time() - 1); setcookie("url","$url",time() - 1); setcookie("cookie","",time() - 1); //setcookie("pass","$pass",time() - 1); } $PX = $_SERVER['HTTP_FORWARDED'];//プロキシ $RA = $_SERVER['REMOTE_ADDR'];//IPアドレス $HN = gethostbyaddr($RA);//ホスト名 $UA = $_SERVER['HTTP_USER_AGENT'];//ブラウザ情報 if($PX == ""){$PX = "none";} if($_FILES['userfile']['name'] != ""){ $str = strrchr($_FILES['userfile']['name'],".");//検索。ファイル名の、"."以降、 if($str != false){ $ext = substr($str,1);//さらに、"."の次の文字以降(拡張子に相当)を取得、 }else{ exit ("

caution!!
incorrect file!

"); } $dir = getcwd(); $id = uniqid(""); //拡張子が、"jpg"の場合... if($ext == "jpg"){ $default = $dir . "/data/" . $id . ".jpg"; $resized = $dir . "/data/" . $id . "_small.jpg"; move_uploaded_file($_FILES['userfile']['tmp_name'], $default); list($lw,$lh,$type,$attr) = getimagesize($default); if($lw >= $lh){$tl = $lw;}else{$tl = $lh;} $ratio = $tl/120; $sw = $lw/$ratio; $sh = $lh/$ratio; $img1 = @imagecreatefromjpeg($default); $img2 = @imagecreatetruecolor($sw,$sh); imagecopyresampled($img2,$img1,0,0,0,0,$sw,$sh,$lw,$lh); imagejpeg($img2,$resized); $aim = "./data/" . $id . ".jpg"; $aim_small = "./data/" . $id . "_small.jpg"; //拡張子が、"png"の場合... }elseif($ext == "png"){ $default = $dir . "/data/" . $id . ".png"; $resized = $dir . "/data/" . $id . "_small.png"; move_uploaded_file($_FILES['userfile']['tmp_name'], $default); list($lw,$lh,$type,$attr) = getimagesize($default); if($lw >= $lh){$tl = $lw;}else{$tl = $lh;} $ratio = $tl/120; $sw = $lw/$ratio; $sh = $lh/$ratio; $img1 = @imagecreatefrompng($default); $img2 = @imagecreatetruecolor($sw,$sh); imagecopyresampled($img2,$img1,0,0,0,0,$sw,$sh,$lw,$lh); imagepng($img2,$resized); $aim = "./data/" . $id . ".png"; $aim_small = "./data/" . $id . "_small.png"; }else{ exit ("

caution!!
jpeg & png only!

"); } } //デバッグ用 //echo "デフォルト  "; //echo "リサイズ"; //$pattern = "(http|ftp|news)(:\/\/[a-zA-Z0-9_\.\~\-\/\?\&\+\=\:\;\@\%\#]+)"; $pattern = "(https?|ftp|news)(://[[:alnum:]\+\$\;\?\.%,!#~*/:@&=_-]+)"; $text = ereg_replace($pattern,"\\1\\2",$text); $str = $author . $S . $email . $S . $url . $S . $pass . $S . str_replace("\n", "
", $text) . $S . date("H:i:s, M j, Y") . $S . $PX . $S . $RA . $S . $HN . $S . $UA . $S . @$aim . $S . @$aim_small . "\n"; $H = fopen($F, "a") or die("error is occurred while opening file."); flock($H, LOCK_EX); fputs($H, $str); flock($H, LOCK_UN); fclose($H); //バックアップ。 $H = fopen($C, "a") or die("error is occurred while opening file."); flock($H, LOCK_EX); fputs($H, $str); flock($H, LOCK_UN); fclose($H); //リワインド。 $max = 100;//最大表示件数、"$max"に達すると... $limit = 50;//限界値、"$limit"まで、リワインド。 $all_messages = file($F); if(count($all_messages) >= $max - 1){ for($i=$limit; $i<=count($all_messages); $i++){ $trim_messages .= $all_messages[$i]; } $H = fopen($F,"w") or die("error is occurred while opening file."); flock($H,LOCK_EX); fputs($H,$trim_messages); flock($H,LOCK_UN); fclose($H); } //新規投稿の通知。 $admin = "草森冬弥";//管理者名 $to = "aprilsnow#ek.ciao.jp";//管理者のメールアドレス。 $subject = "mail from bbs";//管理者宛のメールのタイトル。日本語可、 $message = ""; $message .= "新規投稿のお知らせ。" . "\n"; $message .= $_SERVER['HTTP_REFERER'] . " " . "\n\n";//まず、bbsのurl。 $message .= "date : " . date("Y/m/d(D) H:i:s") . "\n";//以下、記事の内容... $message .= "name : " . $author . "\n"; $message .= "e-mail : " . $email . "\n"; $message .= "url : " . $url . "\n"; $message .= "message : " . "\n" . $text . "\n\n"; $message .= "proxy : " . $PX . "\n"; $message .= "remote address : " . $RA . "\n"; $message .= "host name : " . $HN . "\n"; $message .= "user agent : " . $UA . "\n"; $admin = mb_convert_encoding($admin,"EUC-JP","auto"); $to = mb_convert_encoding($to,"EUC-JP","auto"); $subject = mb_convert_encoding($subject,"EUC-JP","auto"); $message = mb_convert_encoding($message,"EUC-JP","auto"); //ヘッダー。半角英数字のみ。 //$header = "From: " . $admin . "<" . $to . ">"; //ヘッダー。日本語込み。おそらくMacでは、文字化け必至... $header = "From:" . mb_encode_mimeheader($admin) . "<" . $to . ">"; mb_send_mail($to,$subject,$message,$header); } //記事の削除 if(!empty($_POST["delete"])){ if(!strstr($_SERVER['HTTP_REFERER'],$_SERVER['PHP_SELF'])){ exit ("

caution!!
incorrect access!

"); } foreach($_POST as $k => $v){ if(get_magic_quotes_gpc()){ $v = stripslashes($v);//エスケープの解除。 } $v = strip_tags($v);//タグの除去。 $array[$k] = $v; extract($array);//配列名を、変数として展開。 } //$admin = "admin";//管理者用、パスワード。 $lines = file($F); for($i=0; $i« $title »"; echo ""; //echo ""; echo ""; echo "\n"; for($x=0; $x<7; $x++){ echo ""; } echo "\n"; for($y=0; $y<6; $y++){ echo ""; for($x=0; $x<7; $x++){ $d = $y*7+$x+1-$wday;//日付け /* if($cm == $this_month && $d==$this_day){ $quote1 = "["; $quote2 = "]"; }else{ $quote1 = ""; $quote2 = ""; } */ $aim = $year.$month; $path = "../data"; $dir_name = dir($path); while($file_name = $dir_name->read()){ $files[] = $file_name; } rsort($files); foreach($files as $file){ if(strstr($file,$aim) != ""){ $list[] .= $file;//ファイル名 $days[] .= substr($file,6,2);//投稿日(二桁表記)。ファイル名より抽出... } } $d2 = sprintf("%02d",$d);//「投稿日」との比較のため、二桁表記の「日付け」も準備する。 $path = sprintf("../entry.php?path=./data/%04d%02d%02d.txt",$year,$month,$d);//permalink url if(($cm == $this_month && $d==$this_day) && (is_array($days) && in_array($d2,$days))){//「本日」かつ「投稿日」の場合 $tag1 = ""; $tag2 = ""; }elseif($cm == $this_month && $d==$this_day){//「本日」の場合 $tag1 = ""; $tag2 = ""; }elseif(is_array($days) && in_array($d2,$days)){//「投稿日」の場合 $tag1 = ""; $tag2 = ""; }else{//「本日」以外、かつ「投稿日」以外、の場合 $tag1 = ""; $tag2 = ""; } echo "\n"; } echo "\n"; } echo "
« $title »
« $title »
$wtxt[$x]
"; $param = sprintf("date=%04d%02d%02d",$cy,$cm,$d); $addr = sprintf("%s?%s",$self,$param); if($d>0 && $d<($maxd+1)){ //echo "{$quote1}{$d}{$quote2}"; echo "{$tag1}{$d}{$tag2}"; }else{echo " ";}; echo "
\n"; } function archives(){ $path = "../data"; $dir_name = dir($path); while($file_name = $dir_name->read()){ if(strstr($file_name,".txt") != ""){ $files[] = $file_name; } } rsort($files); foreach($files as $file){ $archive = substr($file,0,6); $list[] .= $archive; } $list = array_unique($list);//重複する要素を排除し、 $list = array_values($list);//連番のインデックスに再設定... echo "

archives

"; echo ""; } function recent_entries(){ $path = "../data"; $dir_name = dir($path); while($file_name = $dir_name->read()){ if(strstr($file_name,".txt") != ""){ $files[] = $file_name; } } rsort($files); foreach($files as $file){ $list[] .= $file; } echo "

recent entries

"; echo ""; } //$self = $HTTP_SERVER_VARS['PHP_SELF']; $self = "../diary.php"; if($_GET['date'] == ""){ $year = date("Y"); $month = date("m"); $date = date("d"); }else{ $year = substr($_GET['date'],0,4); $month = substr($_GET['date'],4,2); $date = substr($_GET['date'],6,2); } $fn = "../summary.txt"; $all = file_get_contents($fn); $parts = explode("###",$all); $mytitle = $parts[0]; $myurl = $parts[1]; $mydescription = $parts[2]; $link1 = sprintf("%s?date=%04d%02d%02d",$self,$year,$month-1,$date); $link2 = sprintf("%s?date=%04d%02d%02d",$self,$year,$month+1,$date); ?> <br /> <b>Notice</b>: Undefined variable: mytitle in <b>/home/users/2/ciao.jp-aprilsnow/web/test/diary/bbs/bbs.php</b> on line <b>473</b><br />

*name :

*e-mail :

*url :

*file :

*cookie :   *pass :

";//"$_SERVER["PHP_SELF"]"は、""内では、出力されない模様... //インデント mt_srand((double)microtime()*1000000); $random1 = mt_rand(1,6); $indent = str_repeat(" ",24); //$omikuji = array("大吉","中吉","小吉","吉","半吉","末吉","末小吉","凶","小凶","半凶","末凶","大凶"); $omikuji = array("大吉かよ","中吉かよ","小吉かよ","吉かよ","半吉かよ","末吉かよ","末小吉かよ","凶かよ","小凶かよ","半凶かよ","末凶かよ","大凶かよ"); array_walk($omikuji,"callback"); mt_srand((double)microtime()*1000000); $random2 = mt_rand(0,11); echo "

"; echo "

" . $author . " "; if($email != ""){ echo "  | e-mail |"; } if($url != ""){ echo "  | url |"; } echo "

"; if($aim != "" and $aim_small != ""){ list($lw,$lh,$type,$attr) = getimagesize($aim); switch($type){ case 2: $type = "jpeg"; break; case 3: $type = "png"; break; default: $type = "undefined"; } //サイズ指定のサブウィンドウ。 //$str = "javascript:void window.open('{$aim}','sample','width={$lw},height={$lh},directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,left=0,top=0')"; echo "

"; //echo "

"; //無理矢理、1行に書くと、こんな感じ(長い)... //echo "

"; //"_blank"による、通常のサブウィンドウ。 //echo "

"; echo "


size : " . $lw . " × " . $lh . "
type : " . $type; } echo "

$text

"; echo "

+ $time + 

"; echo "

*pass :    


"; echo ""; echo ""; } /*Back or Next $prev = $page-1; $next = $page+1; if($prev > -1){ echo "Back  "; } if(count($R) > $next*$num){ echo "Next"; } */ /*All if($page == "All"){ $num = 10;//再設定 } */ $a1 = floor(count($R)/$num);//商 $a2 = count($R)%$num;//剰余 $all_pages = $a1;//「商」分のページ数 if($a2 != 0){ $all_pages += 1;//「剰余」は、ログの端数に相当。割り切れない場合は、プラス1ページ。 } echo "

"; echo "page : "; if($all_pages == 0 or $all_pages == 1){ echo "" . 1 . ""; }elseif(($_GET["page"]+1) < $all_pages){//($_GET["page"]+1) → 現在のページ、 for($i=0; $i<$all_pages; $i++){ if($_GET["page"] == $i){ echo "" . ($i+1) . "* | "; }else{ echo "" . ($i+1) . " | "; } } echo "»"; echo "

"; }else{ echo "« | "; for($i=0; $i<$all_pages; $i++){ if($_GET["page"] == $i){ echo "" . ($i+1) . "* | "; }else{ echo "" . ($i+1) . " | "; } } echo "

"; } } ?>
skip to content
skip to navigation