$value ) if( $value['eid'] == $eid ) return $value; return null; } function RecommendedEntry_updateIndexFile( $eid_updated, $eid, $direction ) { $filename = '/var/www/VirtualDomain/kenji00.com/blog/recommend_data'; is_dir( $filename ) || mkdir( $filename ); $filename .= '/'. substr( $eid_updated, -1 ); is_dir( $filename ) || mkdir( $filename ); $filename .= sprintf( '/%d.txt', $eid_updated); file_exists( $filename ) || touch( $filename ); $fp = @fopen( $filename, 'r+' ); if( $fp ) { if( flock( $fp, LOCK_EX | LOCK_NB )) { $ret = ''; $not_found = 1; while( !feof( $fp ) && ( $buf = fgets( $fp ))) { list( $_eid, $_n0, $_n1 ) = split( "[\t\r\n]", $buf ); if( $eid == $_eid ) { $not_found = 0; $direction ? $_n1++ : $_n0++; } $ret .= sprintf( "%d\t%d\t%d\n", $_eid, $_n0, $_n1 ); } if( $not_found ) $ret .= sprintf( "%d\t%d\t%d\n", $eid, 1 - $direction, $direction); rewind( $fp ); fwrite( $fp, $ret, strlen( $ret )); } fclose( $fp ); } } function RecommendedEntry_incoming() { $eid_prev = $_COOKIE['mtrcmnd_eid']; if( isset( $eid_prev )) { if( $eid_prev != 236 && RecommendedEntry_getEntryData( $eid_prev )) { RecommendedEntry_updateIndexFile( 236, $eid_prev, 0 /*incoming_from*/ ); RecommendedEntry_updateIndexFile( $eid_prev, 236, 1 /*outgoing_to*/ ); } } else { RecommendedEntry_updateIndexFile( 236, 236, 0 /*incoming_from*/ ); } } RecommendedEntry_incoming(); function RecommendedEntry_outgoing() { setcookie( 'mtrcmnd_eid', 236, time() + 2592000, '/' ); } RecommendedEntry_outgoing(); function RecommendedEntry_initialize( $mode = 0 ) { global $RecommendedEntry_table; $RecommendedEntry_table = array(); $filename = '/var/www/VirtualDomain/kenji00.com/blog/recommend_data/'. substr( '236', -1 ). '/236.txt'; $fp = @fopen( $filename, 'r' ); if( $fp ) { if( flock( $fp, LOCK_SH | LOCK_NB )) { while( !feof( $fp ) && ( $buf = fgets( $fp ))) { list( $_eid, $_n0, $_n1 ) = split( "[\t\r\n]", $buf ); if( 236 == $_eid ) continue; else if( $mode == 1 ) $RecommendedEntry_table{$_eid} = $_n0; else if( $mode == 2 ) $RecommendedEntry_table{$_eid} = $_n1; else $RecommendedEntry_table{$_eid} = $_n0 + $_n1; } arsort( $RecommendedEntry_table, SORT_NUMERIC ); } fclose( $fp ); } } function RecommendedEntry_GetEntry( $_index ) { global $RecommendedEntry_table; foreach( $RecommendedEntry_table as $eid => $count ) { if( --$_index ) continue; $entry = RecommendedEntry_getEntryData( $eid ); if( $entry ) $entry['count'] = $count; return $entry; } } ?> 連休ですが、特に予定もないので - 寝不足にて候(仮)
Sep
20
2009

連休ですが、特に予定もないので

レンタルビデオ屋に走ろうかと。

このエントリを読んだ人はこんなんも読んでいます

トラックバック(0)

トラックバックURL: http://blog.kenji00.com/MT/mt-tb.cgi/235

コメント(2)

興味深い内容、掘って良いもの、とブログ展開します。一言で言えば、それを続けてください!

這是一個很好的職位。這篇文章提供真正高質量的信息。我一定要看看它。這裡提供非常有用的技巧。太謝謝你了。保持良好的工程

コメントする

過去のエントリ(一覧)

最近のコメント

  • hebergement audiotel voyance: 這是一個很好的職位。這篇文章提供真正高質量的信息。我一定要看看它。這裡提供非常有用的技巧。太謝謝你了。保持良好的工程 続きを読む
  • Horoscope: 興味深い内容、掘って良いもの、とブログ展開します。一言で言えば、それを続けてください! 続きを読む
Powered by Movable Type 4.261
Creative Commons License
このブログはクリエイティブ・コモンズでライセンスされています。