function Auth_Word($length = 6) { // 생성에 사용할 문자 목록 (대문자 + 소문자 + 숫자) $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; $result = ''; $maxIndex = strlen($characters) - 1; for ($i = 0; $i < $length; $i++) { // cryptographically secure random_int() 사용! $index = random_int(0, $maxIndex); $result .= $characters[$index]; } return $result; } function ScanPage($chainId){ if ( $chainId == "0" ) { $txUrl = "https://tronscan.org/#/transaction/" ; } else if ( $chainId == "1" ) { $txUrl = "https://etherscan.io/tx/" ; } else if ( $chainId == "2" ) { $txUrl = "https://shasta.tronscan.org/#/transaction/" ; } else if ( $chainId == "3" ) { $txUrl = "https://nile.tronscan.org/#/transaction/" ; } else if ( $chainId == "5" ) { $txUrl = "https://goerli.etherscan.io/tx/" ; } else if ( $chainId == "56" ) { $txUrl = "https://bscscan.com/tx/" ; } else if ( $chainId == "97" ) { $txUrl = "https://testnet.bscscan.com/tx/" ; } else if ( $chainId == "137" ) { $txUrl = "https://polygonscan.com/tx/" ; } else if ( $chainId == "80001" ) { $txUrl = "https://mumbai.polygonscan.com/tx/" ; } else if ( $chainId == "8217" ) { $txUrl = "https://scope.klaytn.com/txs/" ; } else if ( $chainId == "1001" ) { $txUrl = "https://baobab.scope.klaytn.com/txs/" ; } return $txUrl ; } function format_number($number, $float) { $number = (float)$number; $formatted = number_format($number, $float, '.', ''); // 정수와 소수점 분리 if (strpos($formatted, '.') !== false) { list($intPart, $decPart) = explode('.', $formatted); $decPart = rtrim($decPart, '0'); // 소수점 0 제거 if ($decPart === '') { return number_format((int)$intPart); } return number_format((int)$intPart) . '.' . $decPart; } else { return number_format((int)$formatted); } } function format_number_2($number, $float) { // 숫자로 변환 $number = (float)$number; // 소수점 자리까지 포맷 후 0 제거 $formatted = rtrim(rtrim(number_format($number, $float, '.', ''), '0'), '.'); // 정수와 소수점 분리 if (strpos($formatted, '.') !== false) { list($intPart, $decPart) = explode('.', $formatted); // 정수 부분 콤마 제거 (필요 시 그대로 유지) return $intPart . '.' . $decPart; } else { return $formatted; // 정수만 있을 경우 } } function generateVerificationCode() { return str_pad(rand(0, 999999), 6, '0', STR_PAD_LEFT); } function generateTemporaryPassword($length = 8) { if ($length <= 0) { return ""; } $numbers = "0123456789"; $lowercaseLetters = "abcdefghijklmnopqrstuvwxyz"; $uppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $specialCharacters = "!@#$%^&*()-_=+[]{}|;:,.<>?"; $allCharacters = $numbers . $lowercaseLetters . $uppercaseLetters . $specialCharacters; $password = ""; $maxIndex = strlen($allCharacters) - 1; for ($i = 0; $i < $length; $i++) { $randomIndex = rand(0, $maxIndex); $password .= $allCharacters[$randomIndex]; } return $password; } function generateTemporaryCode($length = 8) { if ($length <= 0) { return ""; } $numbers = "0123456789"; $lowercaseLetters = "abcdefghijklmnopqrstuvwxyz"; $allCharacters = $numbers . $lowercaseLetters ; $password = ""; $maxIndex = strlen($allCharacters) - 1; for ($i = 0; $i < $length; $i++) { $randomIndex = rand(0, $maxIndex); $password .= $allCharacters[$randomIndex]; } return $password; } ?>