PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function error_handler($severity, $message, $filename, $line) { if ($severity > 0) { throw new ErrorException($message, 0, $severity, $filename, $line); } } function make_tripcode($pass) { if ($pass === NULL || $pass === "") { return ""; } $pass = htmlspecialchars($pass); $num_chars = iconv_strlen($pass, "UTF-8"); $conv = ""; for ($i = 0; $i < $num_chars; $i++) { try { $conv .= iconv("UTF-8", "CP932", iconv_substr($pass, $i, 1, "UTF-8")); } catch (Exception $ex) { $conv .= "?"; } } $salt = strtr(preg_replace("/[^\.-z]/", ".", substr($conv . "H.", 1, 2)), ":;<=>?@[\\]^_`", "ABCDEFGabcdef"); $trip = substr(crypt($conv, $salt), -10); return "!" . $trip; } set_error_handler("error_handler"); // Example: Test the make_tripcode function with a password $password = "さようならWorld"; $tripcode = make_tripcode($password); echo "Original Password: $password<br>"; echo "Generated Tripcodes: $tripcode"; ?>
Show:  
Copy Clear