FORUM

Announcement


Adguard

BOARDS_VISITORS

User info

Welcome, Guest! Please login or register.


You are here » FORUM » FORUM » futaba.php v0.8 lot.051031


futaba.php v0.8 lot.051031

Posts 1 to 2 of 2

1

futaba.php v0.8 lot.051031

DOWNLOAD:

http://sharingfiles.ru/q2zyzk7cvgoh/futaba.php.html
http://sharingfiles.ws/3n9ryay3xn2q/futaba.php.html

0

2

<?
/* ‰æ‘œŒfŽ¦”Â

futaba.php v0.8 lot.051031

‚±‚̃XƒNƒŠƒvƒg‚̓ŒƒbƒcPHP!<http://php.s3.to/>‚Ìgazou.php‚ð‰ü‘¢‚µ‚½‚à‚Ì‚Å‚·B
”z•zðŒ‚̓ŒƒbƒcPHP!‚ɏ€‚¶‚Ü‚·B‰ü‘¢AÄ”z•z‚ÍŽ©—R‚É‚Ç‚¤‚¼B
‚±‚̃XƒNƒŠƒvƒg‚ÉŠÖ‚·‚鎿–â‚̓ŒƒbƒcPHP!‚É‚µ‚È‚¢‚悤‚É‚¨Šè‚¢‚µ‚Ü‚·B
ÅV”Å‚Í<http://www.2chan.net/script/>‚Å”z•z‚µ‚Ä‚¢‚Ü‚·B
‚²Ž¿–â‚͏€”õ”—‚Ó‚½‚Î<http://www.2chan.net/junbi/index2.html>‚Ü‚Å‚Ç‚¤‚¼B

Ý’u–@F
Š–]‚̃fƒBƒŒƒNƒgƒŠ‚̃p[ƒ~ƒbƒVƒ‡ƒ“‚ð777‚É‚µ‚Ü‚·B
srcƒfƒBƒŒƒNƒgƒŠ‚ÆthumbƒfƒBƒŒƒNƒgƒŠ‚ðì‚èAƒp[ƒ~ƒbƒVƒ‡ƒ“‚ð777‚É‚µ‚Ü‚·B<br>
futaba.php‚ð’u‚«Aƒuƒ‰ƒEƒU‚©‚çŒÄo‚µ‚Ü‚·(•K—v‚ȃtƒ@ƒCƒ‹‚ªŽ©“®Ý’肳‚ê‚Ü‚·)B
*/

extract($_POST,EXTR_SKIP);
extract($_GET,EXTR_SKIP);
extract($_COOKIE,EXTR_SKIP);
$upfile_name=isset($_FILES["upfile"]["name"]) ? $_FILES["upfile"]["name"] : "";
$upfile=isset($_FILES["upfile"]["tmp_name"]) ? $_FILES["upfile"]["tmp_name"] : "";

define("LOGFILE", 'img.log');    //ƒƒOƒtƒ@ƒCƒ‹–¼
define("TREEFILE", 'tree.log');    //ƒƒOƒtƒ@ƒCƒ‹–¼
define("IMG_DIR", 'src/');    //‰æ‘œ•Û‘¶ƒfƒBƒŒƒNƒgƒŠBfutaba.php‚©‚猩‚Ä
define("THUMB_DIR",'thumb/');    //ƒTƒ€ƒlƒCƒ‹•Û‘¶ƒfƒBƒŒƒNƒgƒŠ
define("TITLE", '‰æ‘œŒfŽ¦”Â');    //ƒ^ƒCƒgƒ‹i<title>‚ÆTOPj
define("HOME",  '../');    //uƒz[ƒ€v‚ւ̃Šƒ“ƒN
define("MAX_KB", '1500');    //“Še—e—ʐ§ŒÀ KBiphp‚̐ݒè‚É‚æ‚è2M‚Ü‚Å
define("MAX_W",  '250');    //“ŠeƒTƒCƒY•i‚±‚êˆÈã‚Íwidth‚ðk¬
define("MAX_H",  '250');    //“ŠeƒTƒCƒY‚‚³
define("PAGE_DEF", '10');    //ˆêƒy[ƒW‚É•\Ž¦‚·‚é‹LŽ–
define("LOG_MAX",  '500');    //ƒƒOÅ‘ås”
define("ADMIN_PASS", 'admin_pass'); //ŠÇ—ŽÒƒpƒX
define("RE_COL", '789922');               //„‚ª•t‚¢‚½Žž‚̐F
define("PHP_SELF", 'futaba.php'); //‚±‚̃XƒNƒŠƒvƒg–¼
define("PHP_SELF2", 'futaba.htm'); //“ü‚èŒûƒtƒ@ƒCƒ‹–¼
define("PHP_EXT", '.htm');    //1ƒy[ƒWˆÈ~‚ÌŠg’£Žq
define("RENZOKU", '5');    //˜A‘±“Še•b”
define("RENZOKU2", '5');    //‰æ‘œ˜A‘±“Še•b”
define("MAX_RES", '30');    //‹­§sageƒŒƒX”
define("USE_THUMB", 1);    //ƒTƒ€ƒlƒCƒ‹‚ðì‚é ‚·‚é:1 ‚µ‚È‚¢:0
define("PROXY_CHECK", 0);    //proxy‚̏‘ž‚݂𐧌À‚·‚é y:1 n:0
define("DISP_ID", 0);    //ID‚ð•\Ž¦‚·‚é ‹­§:2 ‚·‚é:1 ‚µ‚È‚¢:0
define("BR_CHECK", 15);    //‰üs‚ð—}§‚·‚és” ‚µ‚È‚¢:0
define("IDSEED", 'id‚ÌŽí');    //id‚ÌŽí
define("RESIMG", 1);    //ƒŒƒX‚ɉ摜‚ð“\‚é:1 “\‚ç‚È‚¢:0

$path = realpath("./").'/'.IMG_DIR;
$badstring = array("dummy_string","dummy_string2"); //‹‘â‚·‚镶Žš—ñ
$badfile = array("dummy","dummy2"); //‹‘â‚·‚éƒtƒ@ƒCƒ‹‚Ìmd5
$badip = array("addr.dummy.com","addr2.dummy.com"); //‹‘â‚·‚éƒzƒXƒg
$addinfo='';

/* ƒwƒbƒ_ */
function head(&$dat){
  $dat.='<html><head>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=Shift_JIS">
<!-- meta HTTP-EQUIV="pragma" CONTENT="no-cache" -->
<STYLE TYPE="text/css">
<!--
body,tr,td,th { font-size:12pt }
a:hover { color:#DD0000; }
span { font-size:20pt }
small { font-size:10pt }
-->
</STYLE>
<title>'.TITLE.'</title>
<script language="JavaScript"><!--
function l(e){var P=getCookie("pwdc"),N=getCookie("namec"),i;with(document){for(i=0;i<forms.length;i++){if(forms[i].pwd)with(forms[i]){pwd.value=P;}if(forms[i].name)with(forms[i]){name.value=N;}}}};onload=l;function getCookie(key, tmp1, tmp2, xx1, xx2, xx3) {tmp1 = " " + document.cookie + ";";xx1 = xx2 = 0;len = tmp1.length; while (xx1 < len) {xx2 = tmp1.indexOf(";", xx1);tmp2 = tmp1.substring(xx1 + 1, xx2);xx3 = tmp2.indexOf("=");if (tmp2.substring(0, xx3) == key) {return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));}xx1 = xx2 + 1;}return("");}
//--></script>
</head>
<body bgcolor="#FFFFEE" text="#800000" link="#0000EE" vlink="#0000EE">
<p align=right>
[<a href="'.HOME.'" target="_top">ƒz[ƒ€</a>]
[<a href="'.PHP_SELF.'?mode=admin">ŠÇ——p</a>]
<p align=center>
<font color="#800000" size=5>
<b><SPAN>'.TITLE.'</SPAN></b></font>
<hr width="90%" size=1>
';
}
/* “ŠeƒtƒH[ƒ€ */
function form(&$dat,$resno,$admin=""){
  global $addinfo; $msg=""; $hidden="";
  $maxbyte = MAX_KB * 1024;
  $no=$resno;
  if($resno){
    $msg .= "[<a href=\"".PHP_SELF2."\">ŒfŽ¦”‚ɖ߂é</a>]\n";
    $msg .= "<table width='100%'><tr><th bgcolor=#e04000>\n";
    $msg .= "<font color=#FFFFFF>ƒŒƒX‘—Mƒ‚[ƒh</font>\n";
    $msg .= "</th></tr></table>\n";
  }
  if($admin){
    $hidden = "<input type=hidden name=admin value=\"".ADMIN_PASS."\">";
    $msg = "<h4>ƒ^ƒO‚ª‚‚©‚¦‚Ü‚·</h4>";
  }
  $dat.=$msg.'<center>
<form action="'.PHP_SELF.'" method="POST" enctype="multipart/form-data">
<input type=hidden name=mode value="regist">
'.$hidden.'
<input type=hidden name="MAX_FILE_SIZE" value="'.$maxbyte.'">
';
if($no){$dat.='<input type=hidden name=resto value="'.$no.'">
';}
$dat.='<table cellpadding=1 cellspacing=1>
<tr><td bgcolor=#eeaa88><b>‚¨‚È‚Ü‚¦</b></td><td><input type=text name=name size="28"></td></tr>
<tr><td bgcolor=#eeaa88><b>E-mail</b></td><td><input type=text name=email size="28"></td></tr>
<tr><td bgcolor=#eeaa88><b>‘è@@–¼</b></td><td><input type=text name=sub size="35">
<input type=submit value="‘—M‚·‚é"></td></tr>
<tr><td bgcolor=#eeaa88><b>ƒRƒƒ“ƒg</b></td><td><textarea name=com cols="48" rows="4" wrap=soft></textarea></td></tr>
';
if(RESIMG || !$resno){
$dat.='<tr><td bgcolor=#eeaa88><b>“Y•tFile</b></td>
<td><input type=file name=upfile size="35">
[<label><input type=checkbox name=textonly value=on>‰æ‘œ‚È‚µ</label>]</td></tr>
';}
$dat.='<tr><td bgcolor=#eeaa88><b>íœƒL[</b></td><td><input type=password name=pwd size=8 maxlength=8 value=""><small>(‹LŽ–‚̍폜—pB‰p”Žš‚Å8•¶ŽšˆÈ“à)</small></td></tr>
<tr><td colspan=2>
<small>
<LI>Child Porn our imageboard Forbidden
<LI>“Y•t‰Â”\ƒtƒ@ƒCƒ‹FGIF, JPG, PNG ƒuƒ‰ƒEƒU‚É‚æ‚Á‚Ă͐³í‚É“Y•t‚Å‚«‚È‚¢‚±‚Æ‚ª‚ ‚è‚Ü‚·B
<LI>Å‘å“Šeƒf[ƒ^—Ê‚Í '.MAX_KB.' KB ‚Ü‚Å‚Å‚·Bsage‹@”\•t‚«B
<LI>‰æ‘œ‚͉¡ '.MAX_W.'ƒsƒNƒZƒ‹Ac '.MAX_H.'ƒsƒNƒZƒ‹‚ð’´‚¦‚é‚Ək¬•\Ž¦‚³‚ê‚Ü‚·B
'.$addinfo.'</small></td></tr></table></form></center><hr>';
}
/* ‹LŽ–•”•ª */
function updatelog($resno=0){
  global $path;$p=0;

  $tree = file(TREEFILE);
  $find = false;
  if($resno){
    $counttree=count($tree);
    for($i = 0;$i<$counttree;$i++){
      list($artno,)=explode(",",rtrim($tree[$i]));
      if($artno==$resno){$st=$i;$find=true;break;} //ƒŒƒXæŒŸõ
    }
    if(!$find) error("ŠY“–‹LŽ–‚ª‚݂‚©‚è‚Ü‚¹‚ñ");
  }
  $line = file(LOGFILE);
  $countline=count($line);
  for($i = 0; $i < $countline; $i++){
    list($no,) = explode(",", $line[$i]);
    $lineindex[$no]=$i + 1; //‹t•ÏŠ·ƒe[ƒuƒ‹ì¬
  }

  $counttree = count($tree);
  for($page=0;$page<$counttree;$page+=PAGE_DEF){
    $dat='';
    head($dat);
    form($dat,$resno);
    if(!$resno){
      $st = $page;
    }
    $dat.='<form action="'.PHP_SELF.'" method=POST>';

  for($i = $st; $i < $st+PAGE_DEF; $i++){
    if(empty($tree[$i])){continue;}
    $treeline = explode(",", rtrim($tree[$i]));
    $disptree = $treeline[0];
    $j=$lineindex[$disptree] - 1; //ŠY“–‹LŽ–‚ð’T‚µ‚Ä$j‚ɃZƒbƒg
    if(empty($line[$j])){continue;}   //$j‚ª”͈͊O‚Ȃ玟‚̍s
    list($no,$now,$name,$email,$sub,$com,$url,
         $host,$pwd,$ext,$w,$h,$time,$chk) = explode(",", $line[$j]);
    // URL‚ƃ[ƒ‹‚ɃŠƒ“ƒN
    if($email) $name = "<a href=\"mailto:$email\">$name</a>";
    $com = auto_link($com);
    $com = eregi_replace("(^|>)(&gt;[^<]*)", "\\1<font color=".RE_COL.">\\2</font>", $com);
    // ‰æ‘œƒtƒ@ƒCƒ‹–¼
    $img = $path.$time.$ext;
    $src = IMG_DIR.$time.$ext;
    // <imgƒ^ƒOì¬
    $imgsrc = "";
    if($ext && is_file($img)){
      $size = filesize($img);//alt‚ɃTƒCƒY•\Ž¦
      if($w && $h){//ƒTƒCƒY‚ª‚ ‚鎞
        if(@is_file(THUMB_DIR.$time.'s.jpg')){
          $imgsrc = "<small>ƒTƒ€ƒlƒCƒ‹‚ð•\Ž¦‚µ‚Ä‚¢‚Ü‚·.ƒNƒŠƒbƒN‚·‚é‚ÆŒ³‚̃TƒCƒY‚ð•\Ž¦‚µ‚Ü‚·.</small><br><a href=\"".$src."\" target=_blank><img src=".THUMB_DIR.$time.'s.jpg'.
      " border=0 align=left width=$w height=$h hspace=20 alt=\"".$size." B\"></a>";
        }else{
          $imgsrc = "<a href=\"".$src."\" target=_blank><img src=".$src.
      " border=0 align=left width=$w height=$h hspace=20 alt=\"".$size." B\"></a>";
        }
      }else{//‚»‚êˆÈŠO
        $imgsrc = "<a href=\"".$src."\" target=_blank><img src=".$src.
      " border=0 align=left hspace=20 alt=\"".$size." B\"></a>";
      }
      $dat.="‰æ‘œƒ^ƒCƒgƒ‹F<a href=\"$src\" target=_blank>$time$ext</a>-($size B)<br>$imgsrc";
    }
    // ƒƒCƒ“ì¬
    $dat.="<input type=checkbox name=\"$no\" value=delete><font color=#cc1105 size=+1><b>$sub</b></font> \n";
    $dat.="Name <font color=#117743><b>$name</b></font> $now No.$no &nbsp; \n";
    if(!$resno) $dat.="[<a href=".PHP_SELF."?res=$no>•ÔM</a>]";
    $dat.="\n<blockquote>$com</blockquote>";

     // ‚»‚ë‚»‚ëÁ‚¦‚éB
     if($lineindex[$no]-1 >= LOG_MAX*0.95){
      $dat.="<font color=\"#f00000\"><b>‚±‚̃XƒŒ‚͌¢‚̂ŁA‚à‚¤‚·‚®Á‚¦‚Ü‚·B</b></font><br>\n";
     }

    //ƒŒƒXì¬
    if(!$resno){
     $s=count($treeline) - 10;
     if($s<1){$s=1;}
     elseif($s>1){
      $dat.="<font color=\"#707070\">ƒŒƒX".
             ($s - 1)."ŒÈ—ªB‘S‚ēǂނɂ͕ԐMƒ{ƒ^ƒ“‚ð‰Ÿ‚µ‚Ä‚­‚¾‚³‚¢B</font><br>\n";
     }
    }else{$s=1;}
    for($k = $s; $k < count($treeline); $k++){
      $disptree = $treeline[$k];
      $j=$lineindex[$disptree] - 1;
      if($line[$j]=="") continue;
      list($no,$now,$name,$email,$sub,$com,$url,
           $host,$pwd,$ext,$w,$h,$time,$chk) = explode(",", $line[$j]);
      // URL‚ƃ[ƒ‹‚ɃŠƒ“ƒN
      if($email) $name = "<a href=\"mailto:$email\">$name</a>";
      $com = auto_link($com);
      $com = eregi_replace("(^|>)(&gt;[^<]*)", "\\1<font color=".RE_COL.">\\2</font>", $com);

    // ‰æ‘œƒtƒ@ƒCƒ‹–¼
    $img = $path.$time.$ext;
    $src = IMG_DIR.$time.$ext;
    // <imgƒ^ƒOì¬
    $imgsrc = "";
    if($ext && is_file($img)){
      $size = filesize($img);//alt‚ɃTƒCƒY•\Ž¦
      if($w && $h){//ƒTƒCƒY‚ª‚ ‚鎞
        if(@is_file(THUMB_DIR.$time.'s.jpg')){
          $imgsrc = "<small>ƒTƒ€ƒlƒCƒ‹•\Ž¦</small><br><a href=\"".$src."\" target=_blank><img src=".THUMB_DIR.$time.'s.jpg'.
      " border=0 align=left width=$w height=$h hspace=20 alt=\"".$size." B\"></a>";
        }else{
          $imgsrc = "<a href=\"".$src."\" target=_blank><img src=".$src.
      " border=0 align=left width=$w height=$h hspace=20 alt=\"".$size." B\"></a>";
        }
      }else{//‚»‚êˆÈŠO
        $imgsrc = "<a href=\"".$src."\" target=_blank><img src=".$src.
      " border=0 align=left hspace=20 alt=\"".$size." B\"></a>";
      }
      $imgsrc="<br> &nbsp; &nbsp; <a href=\"$src\" target=_blank>$time$ext</a>-($size B) $imgsrc";
    }

      // ƒƒCƒ“ì¬
      $dat.="<table border=0><tr><td nowrap align=right valign=top>c</td><td bgcolor=#F0E0D6 nowrap>\n";
      $dat.="<input type=checkbox name=\"$no\" value=delete><font color=#cc1105 size=+1><b>$sub</b></font> \n";
      $dat.="Name <font color=#117743><b>$name</b></font> $now No.$no &nbsp; \n";
      $dat.="$imgsrc<blockquote>$com</blockquote>";
      $dat.="</td></tr></table>\n";
    }
    $dat.="<br clear=left><hr>\n";
    clearstatcache();//ƒtƒ@ƒCƒ‹‚Ìstat‚ðƒNƒŠƒA
    $p++;
    if($resno){break;} //resŽž‚Ítree1s‚¾‚¯
  }
$dat.='<table align=right><tr><td nowrap align=center>
<input type=hidden name=mode value=usrdel>y‹LŽ–íœz[<input type=checkbox name=onlyimgdel value=on>‰æ‘œ‚¾‚¯Á‚·]<br>
íœƒL[<input type=password name=pwd size=8 maxlength=8 value="">
<input type=submit value="íœ"></form></td></tr></table>';

    if(!$resno){ //resŽž‚Í•\Ž¦‚µ‚È‚¢
      $prev = $st - PAGE_DEF;
      $next = $st + PAGE_DEF;
    // ‰üƒy[ƒWˆ—
      $dat.="<table align=left border=1><tr>";
      if($prev >= 0){
        if($prev==0){
          $dat.="<form action=\"".PHP_SELF2."\" method=get><td>";
        }else{
          $dat.="<form action=\"".$prev/PAGE_DEF.PHP_EXT."\" method=get><td>";
        }
        $dat.="<input type=submit value=\"‘O‚̃y[ƒW\">";
        $dat.="</td></form>";
      }else{$dat.="<td>Å‰‚̃y[ƒW</td>";}

      $dat.="<td>";
      for($i = 0; $i < count($tree) ; $i+=PAGE_DEF){
        if($st==$i){$dat.="[<b>".($i/PAGE_DEF)."</b>] ";}
        else{
          if($i==0){$dat.="[<a href=\"".PHP_SELF2."\">0</a>] ";}
          else{$dat.="[<a href=\"".($i/PAGE_DEF).PHP_EXT."\">".($i/PAGE_DEF)."</a>] ";}
        }
      }
      $dat.="</td>";

      if($p >= PAGE_DEF && count($tree) > $next){
        $dat.="<form action=\"".$next/PAGE_DEF.PHP_EXT."\" method=get><td>";
        $dat.="<input type=submit value=\"ŽŸ‚̃y[ƒW\">";
        $dat.="</td></form>";
      }else{$dat.="<td>ÅŒã‚̃y[ƒW</td>";}
        $dat.="</tr></table><br clear=all>\n";
    }
    foot($dat);
    if($resno){echo $dat;break;}
    if($page==0){$logfilename=PHP_SELF2;}
        else{$logfilename=$page/PAGE_DEF.PHP_EXT;}
    $fp = fopen($logfilename, "w");
    set_file_buffer($fp, 0);
    rewind($fp);
    fputs($fp, $dat);
    fclose($fp);
    chmod($logfilename,0666);
  }
  if(!$resno&&is_file(($page/PAGE_DEF+1).PHP_EXT)){unlink(($page/PAGE_DEF+1).PHP_EXT);}
}
/* ƒtƒbƒ^ */
function foot(&$dat){
  $dat.='
<center>
<small><!-- GazouBBS v3.0 --><!-- ‚Ó‚½‚Ήü0.8 -->
- <a href="http://php.s3.to" target=_top>GazouBBS</a> + <a href="http://www.2chan.net/" target=_top>futaba</a>-
</small>
</center>
</body></html>';
}
/* ƒI[ƒgƒŠƒ“ƒN */
function auto_link($proto){
  $proto = ereg_replace("(https?|ftp|news)(://[[:alnum:]\+\$\;\?\.%,!#~*/:@&=_-]+)","<a href=\"\\1\\2\" target=\"_blank\">\\1\\2</a>",$proto);
  return $proto;
}
/* ƒGƒ‰[‰æ–Ê */
function error($mes,$dest=''){
  global $upfile_name,$path;
  if(is_file($dest)) unlink($dest);
  head($dat);
  echo $dat;
  echo "<br><br><hr size=1><br><br>
        <center><font color=red size=5><b>$mes<br><br><a href=".PHP_SELF2.">ƒŠƒ[ƒh</a></b></font></center>
        <br><br><hr size=1>";
  die("</body></html>");
}

function  proxy_connect($port) {
  $a="";$b="";
  $fp = @fsockopen ($_SERVER["REMOTE_ADDR"], $port,$a,$b,2);
  if(!$fp){return 0;}else{return 1;}
}
/* ‹LŽ–‘‚«ž‚Ý */
function regist($name,$email,$sub,$com,$url,$pwd,$upfile,$upfile_name,$resto){
  global $path,$badstring,$badfile,$badip,$pwdc,$textonly;
  $dest="";$mes="";

  // ŽžŠÔ
  $time = time();
  $tim = $time.substr(microtime(),2,3);

  // ƒAƒbƒvƒ[ƒhˆ—
  if($upfile&&file_exists($upfile)){
    $dest = $path.$tim.'.tmp';
    move_uploaded_file($upfile, $dest);
    //ª‚ŃGƒ‰[‚Ȃ火‚ɕύX
    //copy($upfile, $dest);
    $upfile_name = CleanStr($upfile_name);
    if(!is_file($dest)) error("ƒAƒbƒvƒ[ƒh‚ÉŽ¸”s‚µ‚Ü‚µ‚½<br>ƒT[ƒo‚ªƒTƒ|[ƒg‚µ‚Ä‚¢‚È‚¢‰Â”\«‚ª‚ ‚è‚Ü‚·",$dest);
    $size = getimagesize($dest);
    if(!is_array($size)) error("ƒAƒbƒvƒ[ƒh‚ÉŽ¸”s‚µ‚Ü‚µ‚½<br>‰æ‘œƒtƒ@ƒCƒ‹ˆÈŠO‚͎󂯕t‚¯‚Ü‚¹‚ñ",$dest);
    $chk = md5_of_file($dest);
    foreach($badfile as $value){if(ereg("^$value",$chk)){
      error("ƒAƒbƒvƒ[ƒh‚ÉŽ¸”s‚µ‚Ü‚µ‚½<br>“¯‚¶‰æ‘œ‚ª‚ ‚è‚Ü‚µ‚½",$dest); //‹‘â‰æ‘œ
    }}
    chmod($dest,0666);
    $W = $size[0];
    $H = $size[1];

    switch ($size[2]) {
      case 1 : $ext=".gif";break;
      case 2 : $ext=".jpg";break;
      case 3 : $ext=".png";break;
      case 4 : $ext=".swf";break;
      case 5 : $ext=".psd";break;
      case 6 : $ext=".bmp";break;
      case 13 : $ext=".swf";break;
      default : $ext=".xxx";error("‘Ήž‚µ‚È‚¢ƒtƒH[ƒ}ƒbƒg‚Å‚·B",$dest);
    }

    // ‰æ‘œ•\Ž¦k¬
    if($W > MAX_W || $H > MAX_H){
      $W2 = MAX_W / $W;
      $H2 = MAX_H / $H;
      ($W2 < $H2) ? $key = $W2 : $key = $H2;
      $W = ceil($W * $key);
      $H = ceil($H * $key);
    }
    $mes = "‰æ‘œ $upfile_name ‚̃Aƒbƒvƒ[ƒh‚ª¬Œ÷‚µ‚Ü‚µ‚½<br><br>";
  }

  foreach($badstring as $value){if(ereg($value,$com)||ereg($value,$sub)||ereg($value,$name)||ereg($value,$email)){
  error("‹‘â‚³‚ê‚Ü‚µ‚½(str)",$dest);};}
  if($_SERVER["REQUEST_METHOD"] != "POST") error("•s³‚È“Še‚ð‚µ‚È‚¢‚ʼnº‚³‚¢(post)",$dest);
  // ƒtƒH[ƒ€“à—e‚ðƒ`ƒFƒbƒN
  if(!$name||ereg("^[ |@|]*$",$name)) $name="";
  if(!$com||ereg("^[ |@|\t]*$",$com)) $com="";
  if(!$sub||ereg("^[ |@|]*$",$sub))   $sub="";

  if(!$resto&&!$textonly&&!is_file($dest)) error("‰æ‘œ‚ª‚ ‚è‚Ü‚¹‚ñ",$dest);
  if(!$com&&!is_file($dest)) error("‰½‚©‘‚¢‚ĉº‚³‚¢",$dest);

  $name=ereg_replace("ŠÇ—","\"ŠÇ—\"",$name);
  $name=ereg_replace("íœ","\"íœ\"",$name);

  if(strlen($com) > 1000) error("–{•¶‚ª’·‚·‚¬‚Ü‚·‚ÁI",$dest);
  if(strlen($name) > 100) error("–{•¶‚ª’·‚·‚¬‚Ü‚·‚ÁI",$dest);
  if(strlen($email) > 100) error("–{•¶‚ª’·‚·‚¬‚Ü‚·‚ÁI",$dest);
  if(strlen($sub) > 100) error("–{•¶‚ª’·‚·‚¬‚Ü‚·‚ÁI",$dest);
  if(strlen($resto) > 10) error("ˆÙí‚Å‚·",$dest);
  if(strlen($url) > 10) error("ˆÙí‚Å‚·",$dest);

  //ƒzƒXƒgŽæ“¾
  $host = gethostbyaddr($_SERVER["REMOTE_ADDR"]);

  foreach($badip as $value){ //‹‘âhost
   if(eregi("$value$",$host)){
    error("‹‘â‚³‚ê‚Ü‚µ‚½(host)",$dest);
  }}
  if(eregi("^mail",$host)
    || eregi("^ns",$host)
    || eregi("^dns",$host)
    || eregi("^ftp",$host)
    || eregi("^prox",$host)
    || eregi("^pc",$host)
    || eregi("^[^\.]\.[^\.]$",$host)){
    $pxck = "on";
  }
  if(eregi("ne\\.jp$",$host)||
    eregi("ad\\.jp$",$host)||
    eregi("bbtec\\.net$",$host)||
    eregi("aol\\.com$",$host)||
    eregi("uu\\.net$",$host)||
    eregi("asahi-net\\.or\\.jp$",$host)||
    eregi("rim\\.or\\.jp$",$host)
    ){$pxck = "off";}
  else{$pxck = "on";}

  if($pxck=="on" && PROXY_CHECK){
    if(proxy_connect('80') == 1){
      error("‚d‚q‚q‚n‚qI@ŒöŠJ‚o‚q‚n‚w‚x‹K§’†II(80)",$dest);
    } elseif(proxy_connect('8080') == 1){
      error("‚d‚q‚q‚n‚qI@ŒöŠJ‚o‚q‚n‚w‚x‹K§’†II(8080)",$dest);
    }
  }

  // No.‚ƃpƒX‚ÆŽžŠÔ‚ÆURLƒtƒH[ƒ}ƒbƒg
  srand((double)microtime()*1000000);
  if($pwd==""){
    if($pwdc==""){
      $pwd=rand();$pwd=substr($pwd,0,8);
    }else{
      $pwd=$pwdc;
    }
  }

  $c_pass = $pwd;
  $pass = ($pwd) ? substr(md5($pwd),2,8) : "*";
  $youbi = array('“ú','ŒŽ','‰Î','…','–Ø','‹à','“y');
  $yd = $youbi[gmdate("w", $time+9*60*60)] ;
  $now = gmdate("y/m/d",$time+9*60*60)."(".(string)$yd.")".gmdate("H:i",$time+9*60*60);
  if(DISP_ID){
    if($email&&DISP_ID==1){
      $now .= " ID:???";
    }else{
      $now.=" ID:".substr(crypt(md5($_SERVER["REMOTE_ADDR"].IDSEED.gmdate("Ymd", $time+9*60*60)),'id'),-8);
    }
  }
  //ƒeƒLƒXƒg®Œ`
  $email= CleanStr($email);  $email=ereg_replace("[\r\n]","",$email);
  $sub  = CleanStr($sub);    $sub  =ereg_replace("[\r\n]","",$sub);
  $url  = CleanStr($url);    $url  =ereg_replace("[\r\n]","",$url);
  $resto= CleanStr($resto);  $resto=ereg_replace("[\r\n]","",$resto);
  $com  = CleanStr($com);
  // ‰üs•¶Žš‚Ì“ˆêB
  $com = str_replace( "\r\n",  "\n", $com);
  $com = str_replace( "\r",  "\n", $com);
  // ˜A‘±‚·‚é‹ós‚ðˆês
  $com = ereg_replace("\n((@| )*\n){3,}","\n",$com);
  if(!BR_CHECK || substr_count($com,"\n")<BR_CHECK){
    $com = nl2br($com);    //‰üs•¶Žš‚Ì‘O‚É<br>‚ð‘ã“ü‚·‚é
  }
  $com = str_replace("\n",  "", $com); //\n‚𕶎š—ñ‚©‚çÁ‚·B

  $name=ereg_replace("Ÿ","ž",$name);
  $name=ereg_replace("[\r\n]","",$name);
  $names=$name;
  $name = CleanStr($name);
  if(ereg("(#|”)(.*)",$names,$regs)){
    $cap = $regs[2];
    $cap=strtr($cap,"&amp;", "&");
    $cap=strtr($cap,",", ",");
    $name=ereg_replace("(#|”)(.*)","",$name);
    $salt=substr($cap."H.",1,2);
    $salt=ereg_replace("[^\.-z]",".",$salt);
    $salt=strtr($salt,":;<=>?@[\\]^_`","ABCDEFGabcdef");
    $name.="</b>Ÿ".substr(crypt($cap,$salt),-10)."<b>";
  }

  if(!$name) $name="–¼–³‚µ";
  if(!$com) $com="–{•¶‚È‚µ";
  if(!$sub) $sub="–³‘è";

  //ƒƒO“ǂݍž‚Ý
  $fp=fopen(LOGFILE,"r+");
  flock($fp, 2);
  rewind($fp);
  $buf=fread($fp,1000000);
  if($buf==''){error("error load log",$dest);}
  $line = explode("\n",$buf);
  $countline=count($line);
  for($i = 0; $i < $countline; $i++){
    if($line[$i]!=""){
      list($artno,)=explode(",", rtrim($line[$i]));  //‹t•ÏŠ·ƒe[ƒuƒ‹ì¬
      $lineindex[$artno]=$i+1;
      $line[$i].="\n";
  }}

  // “ñd“Šeƒ`ƒFƒbƒN
  $imax=count($line)>20 ? 20 : count($line)-1;
  for($i=0;$i<$imax;$i++){
   list($lastno,,$lname,,,$lcom,,$lhost,$lpwd,,,,$ltime,) = explode(",", $line[$i]);
   if(strlen($ltime)>10){$ltime=substr($ltime,0,-3);}
   if($host==$lhost||substr(md5($pwd),2,8)==$lpwd||substr(md5($pwdc),2,8)==$lpwd){$pchk=1;}else{$pchk=0;}
   if(RENZOKU && $pchk && $time - $ltime < RENZOKU)
    error("˜A‘±“Še‚Í‚à‚¤‚µ‚΂炭ŽžŠÔ‚ð’u‚¢‚Ä‚©‚炨Šè‚¢’v‚µ‚Ü‚·",$dest);
   if(RENZOKU && $pchk && $time - $ltime < RENZOKU2 && $upfile_name)
    error("‰æ‘œ˜A‘±“Še‚Í‚à‚¤‚µ‚΂炭ŽžŠÔ‚ð’u‚¢‚Ä‚©‚炨Šè‚¢’v‚µ‚Ü‚·",$dest);
   if(RENZOKU && $pchk && $com == $lcom && !$upfile_name)
    error("˜A‘±“Še‚Í‚à‚¤‚µ‚΂炭ŽžŠÔ‚ð’u‚¢‚Ä‚©‚炨Šè‚¢’v‚µ‚Ü‚·",$dest);
  }

  // ƒƒOs”ƒI[ƒo[
  if(count($line) >= LOG_MAX){
    for($d = count($line)-1; $d >= LOG_MAX-1; $d--){
      list($dno,,,,,,,,,$dext,,,$dtime,) = explode(",", $line[$d]);
      if(is_file($path.$dtime.$dext)) unlink($path.$dtime.$dext);
      if(is_file(THUMB_DIR.$dtime.'s.jpg')) unlink(THUMB_DIR.$dtime.'s.jpg');
      $line[$d] = "";
      treedel($dno);
    }
  }
  // ƒAƒbƒvƒ[ƒhˆ—
  if($dest&&file_exists($dest)){
    $imax=count($line)>200 ? 200 : count($line)-1;
    for($i=0;$i<$imax;$i++){ //‰æ‘œd•¡ƒ`ƒFƒbƒN
     list(,,,,,,,,,$extp,,,$timep,$chkp,) = explode(",", $line[$i]);
     if($chkp==$chk&&file_exists($path.$timep.$extp)){
      error("ƒAƒbƒvƒ[ƒh‚ÉŽ¸”s‚µ‚Ü‚µ‚½<br>“¯‚¶‰æ‘œ‚ª‚ ‚è‚Ü‚·",$dest);
    }}
  }
  list($lastno,) = explode(",", $line[0]);
  $no = $lastno + 1;
  isset($ext)?0:$ext="";
  isset($W)?0:$W="";
  isset($H)?0:$H="";
  isset($chk)?0:$chk="";
  $newline = "$no,$now,$name,$email,$sub,$com,$url,$host,$pass,$ext,$W,$H,$tim,$chk,\n";
  $newline.= implode('', $line);
  ftruncate($fp,0);
  set_file_buffer($fp, 0);
  rewind($fp);
  fputs($fp, $newline);

    //ƒcƒŠ[XV
  $find = false;
  $newline = '';
  $tp=fopen(TREEFILE,"r+");
  set_file_buffer($tp, 0);
  rewind($tp);
  $buf=fread($tp,1000000);
  if($buf==''){error("error tree update",$dest);}
  $line = explode("\n",$buf);
  $countline=count($line);
  for($i = 0; $i < $countline; $i++){
    if($line[$i]!=""){
      $line[$i].="\n";
      $j=explode(",", rtrim($line[$i]));
      if($lineindex[$j[0]]==0){
        $line[$i]='';
  } } }
  if($resto){
    for($i = 0; $i < $countline; $i++){
      $rtno = explode(",", rtrim($line[$i]));
      if($rtno[0]==$resto){
        $find = TRUE;
        $line[$i]=rtrim($line[$i]).','.$no."\n";
        $j=explode(",", rtrim($line[$i]));
        if(count($j)>MAX_RES){$email='sage';}
        if(!stristr($email,'sage')){
          $newline=$line[$i];
          $line[$i]='';
        }
        break;
  } } }
  if(!$find){if(!$resto){$newline="$no\n";}else{error("ƒXƒŒƒbƒh‚ª‚ ‚è‚Ü‚¹‚ñ",$dest);}}
  $newline.=implode('', $line);
  ftruncate($tp,0);
  set_file_buffer($tp, 0);
  rewind($tp);
  fputs($tp, $newline);
  fclose($tp);
  fclose($fp);

    //ƒNƒbƒL[•Û‘¶
  setcookie ("pwdc", $c_pass,time()+7*24*3600);  /* 1TŠÔ‚ÅŠúŒÀØ‚ê */
  if(function_exists("mb_internal_encoding")&&function_exists("mb_convert_encoding")
      &&function_exists("mb_substr")){
    if(ereg("MSIE|Opera",$_SERVER["HTTP_USER_AGENT"])){
      $i=0;$c_name='';
      mb_internal_encoding("SJIS");
      while($j=mb_substr($names,$i,1)){
        $j = mb_convert_encoding($j, "UTF-16", "SJIS");
        $c_name.="%u".bin2hex($j);
        $i++;
      }
      header("Set-Cookie: namec=$c_name; expires=".gmdate("D, d-M-Y H:i:s",time()+7*24*3600)." GMT",false);
    }else{
      $c_name=$names;
      setcookie ("namec", $c_name,time()+7*24*3600);  /* 1TŠÔ‚ÅŠúŒÀØ‚ê */
    }
  }

  if($dest&&file_exists($dest)){
    rename($dest,$path.$tim.$ext);
    if(USE_THUMB){thumb($path,$tim,$ext);}
  }
  updatelog();

  echo "<html><head><META HTTP-EQUIV=\"refresh\" content=\"1;URL=".PHP_SELF2."\"></head>";
  echo "<body>$mes ‰æ–Ê‚ðØ‚è‘Ö‚¦‚Ü‚·</body></html>";
}

//ƒTƒ€ƒlƒCƒ‹ì¬
function thumb($path,$tim,$ext){
  if(!function_exists("ImageCreate")||!function_exists("ImageCreateFromJPEG"))return;
  $fname=$path.$tim.$ext;
  $thumb_dir = THUMB_DIR;     //ƒTƒ€ƒlƒCƒ‹•Û‘¶ƒfƒBƒŒƒNƒgƒŠ
  $width     = MAX_W;            //o—͉摜•
  $height    = MAX_H;            //o—͉摜‚‚³
  // ‰æ‘œ‚Ì•‚ƍ‚‚³‚ƃ^ƒCƒv‚ðŽæ“¾
  $size = GetImageSize($fname);
  switch ($size[2]) {
    case 1 :
      if(function_exists("ImageCreateFromGIF")){
        $im_in = @ImageCreateFromGIF($fname);
        if($im_in){break;}
      }
      if(!is_executable(realpath("./gif2png"))||!function_exists("ImageCreateFromPNG"))return;
      @exec(realpath("./gif2png")." $fname",$a);
      if(!file_exists($path.$tim.'.png'))return;
      $im_in = @ImageCreateFromPNG($path.$tim.'.png');
      unlink($path.$tim.'.png');
      if(!$im_in)return;
      break;
    case 2 : $im_in = @ImageCreateFromJPEG($fname);
      if(!$im_in){return;}
       break;
    case 3 :
      if(!function_exists("ImageCreateFromPNG"))return;
      $im_in = @ImageCreateFromPNG($fname);
      if(!$im_in){return;}
      break;
    default : return;
  }
  // ƒŠƒTƒCƒY
  if ($size[0] > $width || $size[1] >$height) {
    $key_w = $width / $size[0];
    $key_h = $height / $size[1];
    ($key_w < $key_h) ? $keys = $key_w : $keys = $key_h;
    $out_w = ceil($size[0] * $keys) +1;
    $out_h = ceil($size[1] * $keys) +1;
  } else {
    $out_w = $size[0];
    $out_h = $size[1];
  }
  // o—͉摜iƒTƒ€ƒlƒCƒ‹j‚̃Cƒ[ƒW‚ðì¬
  if(function_exists("ImageCreateTrueColor")&&get_gd_ver()=="2"){
    $im_out = ImageCreateTrueColor($out_w, $out_h);
  }else{$im_out = ImageCreate($out_w, $out_h);}
  // Œ³‰æ‘œ‚ðc‰¡‚Æ‚à ƒRƒs[‚µ‚Ü‚·B
#  ImageCopyResampled($im_out, $im_in, 0, 0, 0, 0, $out_w, $out_h, $size[0], $size[1]);
  ImageCopyResized($im_out, $im_in, 0, 0, 0, 0, $out_w, $out_h, $size[0], $size[1]);
  // ƒTƒ€ƒlƒCƒ‹‰æ‘œ‚ð•Û‘¶
  ImageJPEG($im_out, $thumb_dir.$tim.'s.jpg',60);
  chmod($thumb_dir.$tim.'s.jpg',0666);
  // ì¬‚µ‚½ƒCƒ[ƒW‚ð”jŠü
  ImageDestroy($im_in);
  ImageDestroy($im_out);
}
//gd‚̃o[ƒWƒ‡ƒ“‚𒲂ׂé
function get_gd_ver(){
  if(function_exists("gd_info")){
    $gdver=gd_info();
    $phpinfo=$gdver["GD Version"];
  }else{ //php4.3.0–¢–ž—p
    ob_start();
    phpinfo(8);
    $phpinfo=ob_get_contents();
    ob_end_clean();
    $phpinfo=strip_tags($phpinfo);
    $phpinfo=stristr($phpinfo,"gd version");
    $phpinfo=stristr($phpinfo,"version");
  }
  $end=strpos($phpinfo,".");
  $phpinfo=substr($phpinfo,0,$end);
  $length = strlen($phpinfo)-1;
  $phpinfo=substr($phpinfo,$length);
  return $phpinfo;
}
//ƒtƒ@ƒCƒ‹md5ŒvŽZ php4.2.0–¢–ž—p
function md5_of_file($inFile) {
if (file_exists($inFile)){
  if(function_exists('md5_file')){
    return md5_file($inFile);
  }else{
    $fd = fopen($inFile, 'r');
    $fileContents = fread($fd, filesize($inFile));
    fclose ($fd);
    return md5($fileContents);
  }
}else{
  return false;
}}
//ƒcƒŠ[íœ
function treedel($delno){
  $fp=fopen(TREEFILE,"r+");
  set_file_buffer($fp, 0);
  flock($fp, 2);
  rewind($fp);
  $buf=fread($fp,1000000);
  if($buf==''){error("error tree del");}
  $line = explode("\n",$buf);
  $countline=count($line);
  if($countline>2){
    for($i = 0; $i < $countline; $i++){if($line[$i]!=""){$line[$i].="\n";};}
    for($i = 0; $i < $countline; $i++){
      $treeline = explode(",", rtrim($line[$i]));
      $counttreeline=count($treeline);
      for($j = 0; $j < $counttreeline; $j++){
        if($treeline[$j] == $delno){
          $treeline[$j]='';
          if($j==0){$line[$i]='';}
          else{$line[$i]=implode(',', $treeline);
            $line[$i]=ereg_replace(",,",",",$line[$i]);
            $line[$i]=ereg_replace(",$","",$line[$i]);
            $line[$i].="\n";
          }
          break 2;
    } } }
    ftruncate($fp,0);
    set_file_buffer($fp, 0);
    rewind($fp);
    fputs($fp, implode('', $line));
  }
  fclose($fp);
}
/* ƒeƒLƒXƒg®Œ` */
function CleanStr($str){
  global $admin;
  $str = trim($str);//æ“ª‚Æ––”ö‚̋󔒏œ‹Ž
  if (get_magic_quotes_gpc()) {//‚ðíœ
    $str = stripslashes($str);
  }
  if($admin!=ADMIN_PASS){//ŠÇ—ŽÒ‚̓^ƒO‰Â”\
    $str = htmlspecialchars($str);//ƒ^ƒO‚Á‹ÖŽ~
    $str = str_replace("&amp;", "&", $str);//“ÁŽê•¶Žš
  }
  return str_replace(",", ",", $str);//ƒJƒ“ƒ}‚ð•ÏŠ·
}
/* ƒ†[ƒU[íœ */
function usrdel($no,$pwd){
  global $path,$pwdc,$onlyimgdel;
  $host = gethostbyaddr($_SERVER["REMOTE_ADDR"]);
  $delno = array("dummy");
  $delflag = FALSE;
  reset($_POST);
    while ($item = each($_POST)){
     if($item[1]=='delete'){array_push($delno,$item[0]);$delflag=TRUE;}
    }
  if($pwd==""&&$pwdc!="") $pwd=$pwdc;
  $fp=fopen(LOGFILE,"r+");
  set_file_buffer($fp, 0);
  flock($fp, 2);
  rewind($fp);
  $buf=fread($fp,1000000);
  fclose($fp);
  if($buf==''){error("error user del");}
  $line = explode("\n",$buf);
  $countline=count($line);
  for($i = 0; $i < $countline; $i++){if($line[$i]!=""){$line[$i].="\n";};}
  $flag = FALSE;
  $countline=count($line)-1;
  for($i = 0; $i<$countline; $i++){
    list($dno,,,,,,,$dhost,$pass,$dext,,,$dtim,) = explode(",", $line[$i]);
    if(array_search($dno,$delno) && (substr(md5($pwd),2,8) == $pass || $dhost == $host||ADMIN_PASS==$pwd)){
      $flag = TRUE;
      $line[$i] = "";    //ƒpƒXƒ[ƒh‚ªƒ}ƒbƒ`‚µ‚½s‚Í‹ó‚É
      $delfile = $path.$dtim.$dext; //íœƒtƒ@ƒCƒ‹
      if(!$onlyimgdel){
        treedel($dno);
      }
      if(is_file($delfile)) unlink($delfile);//íœ
      if(is_file(THUMB_DIR.$dtim.'s.jpg')) unlink(THUMB_DIR.$dtim.'s.jpg');//íœ
    }
  }
  if(!$flag) error("ŠY“–‹LŽ–‚ªŒ©‚‚©‚ç‚È‚¢‚©ƒpƒXƒ[ƒh‚ªŠÔˆá‚Á‚Ä‚¢‚Ü‚·");
}
/* ƒpƒX”FØ */
function valid($pass){
  if($pass && $pass != ADMIN_PASS) error("ƒpƒXƒ[ƒh‚ªˆá‚¢‚Ü‚·");

  head($dat);
  echo $dat;
  echo "[<a href=\"".PHP_SELF2."\">ŒfŽ¦”‚ɖ߂é</a>]\n";
  echo "[<a href=\"".PHP_SELF."\">ƒƒO‚ðXV‚·‚é</a>]\n";
  echo "<table width='100%'><tr><th bgcolor=#E08000>\n";
  echo "<font color=#FFFFFF>ŠÇ—ƒ‚[ƒh</font>\n";
  echo "</th></tr></table>\n";
  echo "<p><form action=\"".PHP_SELF."\" method=POST>\n";
  // ƒƒOƒCƒ“ƒtƒH[ƒ€
  if(!$pass){
    echo "<center><input type=radio name=admin value=del checked>‹LŽ–íœ ";
    echo "<input type=radio name=admin value=post>ŠÇ—l“Še<p>";
    echo "<input type=hidden name=mode value=admin>\n";
    echo "<input type=password name=pass size=8>";
    echo "<input type=submit value=\" ”FØ \"></form></center>\n";
    die("</body></html>");
  }
}
/* ŠÇ—ŽÒíœ */
function admindel($pass){
  global $path,$onlyimgdel;
  $all=0;$msg="";
  $delno = array("dummy");
  $delflag = FALSE;
  reset($_POST);
  while ($item = each($_POST)){
   if($item[1]=='delete'){array_push($delno,$item[0]);$delflag=TRUE;}
  }
  if($delflag){
  $fp=fopen(LOGFILE,"r+");
  set_file_buffer($fp, 0);
  flock($fp, 2);
  rewind($fp);
  $buf=fread($fp,1000000);
  if($buf==''){error("error admin del");}
  $line = explode("\n",$buf);
  $countline=count($line)-1;
  for($i = 0; $i < $countline; $i++){if($line[$i]!=""){$line[$i].="\n";};}
    $find = FALSE;
    for($i = 0; $i < $countline; $i++){
      list($no,$now,$name,$email,$sub,$com,$url,$host,$pw,$ext,$w,$h,$tim,$chk) = explode(",",$line[$i]);
      if($onlyimgdel=="on"){
        if(array_search($no,$delno)){//‰æ‘œ‚¾‚¯íœ
          $delfile = $path.$tim.$ext; //íœƒtƒ@ƒCƒ‹
          if(is_file($delfile)) unlink($delfile);//íœ
          if(is_file(THUMB_DIR.$tim.'s.jpg')) unlink(THUMB_DIR.$tim.'s.jpg');//íœ
        }
      }else{
        if(array_search($no,$delno)){//íœ‚ÌŽž‚Í‹ó‚É
          $find = TRUE;
          $line[$i] = "";
          $delfile = $path.$tim.$ext; //íœƒtƒ@ƒCƒ‹
          if(is_file($delfile)) unlink($delfile);//íœ
          if(is_file(THUMB_DIR.$tim.'s.jpg')) unlink(THUMB_DIR.$tim.'s.jpg');//íœ
          treedel($no);
        }
      }
    }
    if($find){//ƒƒOXV
      ftruncate($fp,0);
      set_file_buffer($fp, 0);
      rewind($fp);
      fputs($fp, implode('', $line));
    }
    fclose($fp);
  }
  // íœ‰æ–Ê‚ð•\Ž¦
  echo "<input type=hidden name=mode value=admin>\n";
  echo "<input type=hidden name=admin value=del>\n";
  echo "<input type=hidden name=pass value=\"$pass\">\n";
  echo "<center><P>íœ‚µ‚½‚¢‹LŽ–‚̃`ƒFƒbƒNƒ{ƒbƒNƒX‚Ƀ`ƒFƒbƒN‚ð“ü‚êAíœƒ{ƒ^ƒ“‚ð‰Ÿ‚µ‚ĉº‚³‚¢B\n";
  echo "<p><input type=submit value=\"íœ‚·‚é\">";
  echo "<input type=reset value=\"ƒŠƒZƒbƒg\">";
  echo "[<input type=checkbox name=onlyimgdel value=on>‰æ‘œ‚¾‚¯Á‚·]";
  echo "<P><table border=1 cellspacing=0>\n";
  echo "<tr bgcolor=6080f6><th>íœ</th><th>‹LŽ–No</th><th>“Še“ú</th><th>‘è–¼</th>";
  echo "<th>“ŠeŽÒ</th><th>ƒRƒƒ“ƒg</th><th>ƒzƒXƒg–¼</th><th>“Y•t<br>(Bytes)</th><th>md5</th>";
  echo "</tr>\n";
  $line = file(LOGFILE);

  for($j = 0; $j < count($line); $j++){
    $img_flag = FALSE;
    list($no,$now,$name,$email,$sub,$com,$url,
         $host,$pw,$ext,$w,$h,$time,$chk) = explode(",",$line[$j]);
    // ƒtƒH[ƒ}ƒbƒg
    $now=ereg_replace('.{2}/(.*)$','\1',$now);
    $now=ereg_replace('\(.*\)',' ',$now);
    if(strlen($name) > 10) $name = substr($name,0,9).".";
    if(strlen($sub) > 10) $sub = substr($sub,0,9).".";
    if($email) $name="<a href=\"mailto:$email\">$name</a>";
    $com = str_replace("<br />"," ",$com);
    $com = htmlspecialchars($com);
    if(strlen($com) > 20) $com = substr($com,0,18) . ".";
    // ‰æ‘œ‚ª‚ ‚é‚Æ‚«‚̓Šƒ“ƒN
    if($ext && is_file($path.$time.$ext)){
      $img_flag = TRUE;
      $clip = "<a href=\"".IMG_DIR.$time.$ext."\" target=_blank>".$time.$ext."</a><br>";
      $size = filesize($path.$time.$ext);
      $all += $size;    //‡ŒvŒvŽZ
      $chk= substr($chk,0,10);
    }else{
      $clip = "";
      $size = 0;
      $chk= "";
    }
    $bg = ($j % 2) ? "d6d6f6" : "f6f6f6";//”wŒiF

    echo "<tr bgcolor=$bg><th><input type=checkbox name=\"$no\" value=delete></th>";
    echo "<th>$no</th><td><small>$now</small></td><td>$sub</td>";
    echo "<td><b>$name</b></td><td><small>$com</small></td>";
    echo "<td>$host</td><td align=center>$clip($size)</td><td>$chk</td>\n";
    echo "</tr>\n";
  }

  echo "</table><p><input type=submit value=\"íœ‚·‚é$msg\">";
  echo "<input type=reset value=\"ƒŠƒZƒbƒg\"></form>";

  $all = (int)($all / 1024);
  echo "y ‰æ‘œƒf[ƒ^‡Œv : <b>$all</b> KB z";
  die("</center></body></html>");
}
function init(){
  $err="";
  $chkfile=array(LOGFILE,TREEFILE);
  if(!is_writable(realpath("./")))error("ƒJƒŒƒ“ƒgƒfƒBƒŒƒNƒgƒŠ‚ɏ‘‚¯‚Ü‚¹‚ñ<br>");
  foreach($chkfile as $value){
    if(!file_exists(realpath($value))){
      $fp = fopen($value, "w");
      set_file_buffer($fp, 0);
      if($value==LOGFILE)fputs($fp,"1,2002/01/01(ŒŽ) 00:00,–¼–³‚µ,,–³‘è,–{•¶‚È‚µ,,,,,,,,\n");
      if($value==TREEFILE)fputs($fp,"1\n");
      fclose($fp);
      if(file_exists(realpath($value)))@chmod($value,0666);
    }
    if(!is_writable(realpath($value)))$err.=$value."‚ð‘‚¯‚Ü‚¹‚ñ<br>";
    if(!is_readable(realpath($value)))$err.=$value."‚ð“Ç‚ß‚Ü‚¹‚ñ<br>";
  }
  @mkdir(IMG_DIR,0777);@chmod(IMG_DIR,0777);
  if(!is_dir(realpath(IMG_DIR)))$err.=IMG_DIR."‚ª‚ ‚è‚Ü‚¹‚ñ<br>";
  if(!is_writable(realpath(IMG_DIR)))$err.=IMG_DIR."‚ð‘‚¯‚Ü‚¹‚ñ<br>";
  if(!is_readable(realpath(IMG_DIR)))$err.=IMG_DIR."‚ð“Ç‚ß‚Ü‚¹‚ñ<br>";
  if(USE_THUMB){
    @mkdir(THUMB_DIR,0777);@chmod(THUMB_DIR,0777);
    if(!is_dir(realpath(IMG_DIR)))$err.=THUMB_DIR."‚ª‚ ‚è‚Ü‚¹‚ñ<br>";
    if(!is_writable(realpath(THUMB_DIR)))$err.=THUMB_DIR."‚ð‘‚¯‚Ü‚¹‚ñ<br>";
    if(!is_readable(realpath(THUMB_DIR)))$err.=THUMB_DIR."‚ð“Ç‚ß‚Ü‚¹‚ñ<br>";
  }
  if($err)error($err);
}
/*-----------Main-------------*/
init();    //©¡¡‰ŠúÝ’èŒã‚Í•s—v‚Ȃ̂ō폜‰Â¡¡
$iniv=array('mode','name','email','sub','com','pwd','upfile','upfile_name','resto','pass','res','post','no');
foreach($iniv as $iniva){
  if(!isset($$iniva)){$$iniva="";}
}
switch($mode){
  case 'regist':
    regist($name,$email,$sub,$com,'',$pwd,$upfile,$upfile_name,$resto);
    break;
  case 'admin':
    valid($pass);
    if($admin=="del") admindel($pass);
    if($admin=="post"){
      echo "</form>";
      form($post,$res,1);
      echo $post;
      die("</body></html>");
    }
    break;
  case 'usrdel':
    usrdel($no,$pwd);
  default:
    if($res){
      updatelog($res);
    }else{
      updatelog();
      echo "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=".PHP_SELF2."\">";
    }
}
?>

0


You are here » FORUM » FORUM » futaba.php v0.8 lot.051031