$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 != 128 && RecommendedEntry_getEntryData( $eid_prev )) {
RecommendedEntry_updateIndexFile( 128, $eid_prev, 0 /*incoming_from*/ );
RecommendedEntry_updateIndexFile( $eid_prev, 128, 1 /*outgoing_to*/ );
}
} else {
RecommendedEntry_updateIndexFile( 128, 128, 0 /*incoming_from*/ );
}
}
RecommendedEntry_incoming();
function RecommendedEntry_outgoing() {
setcookie( 'mtrcmnd_eid', 128, 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( '128', -1 ). '/128.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( 128 == $_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;
}
}
?>
画像リンクが多いページを - 寝不足にて候(仮)
表示してから、URL入力欄に下のコードを入力。
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI= document.images; DIL=DI.length; function A(){for(i=0; i<DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5 ); void(0)
狙ったリンクがクリックできず、もどかしい。
ココとかでやってみるが吉。
javascript:document.body.style.filter="flipH()";eval();
手元に鏡があるなら、こっちでも良い。
トラックバックURL: http://blog.kenji00.com/MT/mt-tb.cgi/127
コメントする