2ch trip php
というわけで2chtripを実装したのですが(引用)
/*20210625 猫・2chtrip http://www.mits-jp.com/2ch/ */
function tripuse($key) {
#$tripkey = '#istrip';? //パスワードとする文字列(# 付き)
$key = mb_convert_encoding($key, "SJIS", "UTF-8"); // to, from
# $key = '#'.substr($key, strpos($key, '#'));# トリップ
# $trip は0thelloに使用
$trip = '';
if (preg_match("/([^\#]*)\#(.+)/", $key, $match)) {
if (strlen($match[2]) >= 12){
# 新仕様変換
$mark = substr($match[2], 0, 1);
if ($mark == '#' || $mark == '$'){
if (preg_match('|^#(:xdigit:{16})([./0-9A-Za-z]{0,2})$|',$match[2],$str)){
$trip = substr(crypt(pack('H*', $str[1]), "$str[2].."), -10);
} else {
# 将来の拡張用
$trip = '???';
}
} else {
// $trip = substr(base64_encode(pack('H*', sha1($match[2]))), 0, 12);
$trip = substr(base64_encode(sha1($match[2],TRUE)),0,12);
$trip = str_replace('+','.',$trip);
}
} else {
$salt = substr($match[2]."H.", 1, 2);
$salt = preg_replace("/[^\.-z]/", ".", $salt);
$salt = strtr($salt,":;<=>?@[\\]^_`","ABCDEFGabcdef");
$trip = substr(crypt($match[2], $salt),-10);
}
# $match[1] = str_replace("◆", "◇", $match[1]);
# $_POST['FROM'] = $match[1]."</b> ◆".$trip."<b>";
$trip ="◆".$trip;
} else {
$trip = str_replace("◆", "◇", $key);
}
return $trip;
}
関数として予約。
くずはすくりぷとPHP ver0.0.8alpha (2005/04/01)(source) ヶ + @Links (UTF-8化) (source) + 擬古猫、に実装。
# トリップ機能(簡易騙り防止機能)
else if (strpos($message['USER'], '#') !== FALSE) {
$message['USER'] = substr($message['USER'], 0, strpos($message['USER'], '#')) . ' <span class="mut">◆'
. substr(preg_replace("/\W/", '', crypt(substr($message['USER'], strpos($message['USER'], '#')), '00')), -7) .$this->tripuse($message['USER']). '</span>';
}
else if (strpos($message['USER'], '◆') !== FALSE) {
$message['USER'] .= '(騙り)';
}
独自トリップの後に2chtripが付きます。ほかの検索では結果が得られなかった。これは稼働するようです。
れかこぴ
ナンバー5434ということで更新が止まっている。
http://zantei.php.xdomain.jp/index.php?m=f&s=1185&c=8h
過去の部分を探してみたら作品ナンバーに抜けがある。