Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php function randomString($length, $type = '') { // Select which type of character..
Decoded Output download
<?php
function randomString($length, $type = '') {
// Select which type of characters you want in your random string
switch($type) {
case 'num':
// Use only numbers
$salt = '1234567890';
break;
case 'lower':
// Use only lowercase letters
$salt = 'abcdefghijklmnopqrstuvwxyz';
break;
case 'upper':
// Use only uppercase letters
$salt = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
default:
// Use uppercase, lowercase, numbers, and symbols
$salt = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
break;
}
$rand = '';
$i = 0;
while ($i < $length) { // Loop until you have met the length
$num = rand() % strlen($salt);
$tmp = substr($salt, $num, 1);
$rand = $rand . $tmp;
$i++;
}
return $rand; // Return the random string
}
?>
Did this file decode correctly?
Original Code
<?php
function randomString($length, $type = '') {
// Select which type of characters you want in your random string
switch($type) {
case 'num':
// Use only numbers
$salt = '1234567890';
break;
case 'lower':
// Use only lowercase letters
$salt = 'abcdefghijklmnopqrstuvwxyz';
break;
case 'upper':
// Use only uppercase letters
$salt = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
default:
// Use uppercase, lowercase, numbers, and symbols
$salt = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
break;
}
$rand = '';
$i = 0;
while ($i < $length) { // Loop until you have met the length
$num = rand() % strlen($salt);
$tmp = substr($salt, $num, 1);
$rand = $rand . $tmp;
$i++;
}
return $rand; // Return the random string
}
?>
Function Calls
| None |
Stats
| MD5 | 717020b42b9b4f115a7d31e8b5e4251e |
| Eval Count | 0 |
| Decode Time | 92 ms |