Update FindPlayerUIDByName.php

This commit is contained in:
vbawol 2015-04-05 09:08:28 -05:00
parent 8d257d05a9
commit f2f289d723

View File

@ -14,14 +14,15 @@ $redis = new Redis();
$redis->pconnect(127.0.0.1, 6379, 2.5, "Server1"); $redis->pconnect(127.0.0.1, 6379, 2.5, "Server1");
$redis->auth("yourlongasspasswordhere"); $redis->auth("yourlongasspasswordhere");
// get all players names in database
$playerNames = $redis->keys('PlayerData:*'); $playerNames = $redis->keys('PlayerData:*');
// print all UID's matching player name // print all UID's matching player name
foreach ($playerNames as $key => $value) { foreach ($playerNames as $key => $value) {
$data = $redis->get($value); $data = $redis->get($value);
if (stripos($data, $search) !== false) { if (stripos($data, $search) !== false) {
$key = explode(":", $value); $UID_raw = explode(":", $value);
echo "<p>" . $key[1] . "</p>" ; echo "<p>" . $UID_raw[1] . "</p>" ;
break; // comment out this line if you want all matches and not just the first. break; // comment out this line if you want all matches and not just the first.
} }
} }