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){
global $config;
$name = stripslashes ( $name );
$t = explode('#', $name);
$nameo = $t[0];
if ( isset ( $t[1] ) || isset ( $t[2] ) ) {
$trip = ( ( strlen ( $t[1] ) > 0 ) ? $t[1] : $t[2] );
if ( ( function_exists ( 'mb_convert_encoding' ) ) ) {
# mb_substitute_character('none');
$recoded_cap = mb_convert_encoding ( $trip, 'Shift_JIS', 'UTF-8' );
// multi-byte encoding is necessary to produce standard tripcode output, but only use it if available
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 );
$salt = substr ( $trip.'H.', 1, 2 );

Loading…
Cancel
Save