Browse Source

fixed tripcode algorithm

pull/40/head
Savetheinternet 13 years ago
parent
commit
c3db67c17b
  1. 7
      inc/functions.php

7
inc/functions.php

@ -1426,14 +1426,15 @@
function generate_tripcode($name, $length = 10){ function generate_tripcode($name, $length = 10){
global $config; global $config;
$name = stripslashes ( $name );
$t = explode('#', $name); $t = explode('#', $name);
$nameo = $t[0]; $nameo = $t[0];
if ( isset ( $t[1] ) || isset ( $t[2] ) ) { if ( isset ( $t[1] ) || isset ( $t[2] ) ) {
$trip = ( ( strlen ( $t[1] ) > 0 ) ? $t[1] : $t[2] ); $trip = ( ( strlen ( $t[1] ) > 0 ) ? $t[1] : $t[2] );
if ( ( function_exists ( 'mb_convert_encoding' ) ) ) { if ( ( function_exists ( 'mb_convert_encoding' ) ) ) {
# mb_substitute_character('none'); // multi-byte encoding is necessary to produce standard tripcode output, but only use it if available
$recoded_cap = mb_convert_encoding ( $trip, 'Shift_JIS', 'UTF-8' ); mb_substitute_character('none');
// $trip is now properly encoded
$trip = mb_convert_encoding ( $trip, 'Shift_JIS', 'UTF-8' );
} }
$trip = ( ( ! empty ( $recoded_cap ) ) ? $recoded_cap : $trip ); $trip = ( ( ! empty ( $recoded_cap ) ) ? $recoded_cap : $trip );
$salt = substr ( $trip.'H.', 1, 2 ); $salt = substr ( $trip.'H.', 1, 2 );

Loading…
Cancel
Save