mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
Create FindPlayerUIDByName.php
This commit is contained in:
parent
7830c13e84
commit
91d5dbb5c9
25
Tools/PHP/FindPlayerUIDByName.php
Normal file
25
Tools/PHP/FindPlayerUIDByName.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/*
|
||||
Example PHP code - Case-insensitive search for player Name returns UID's.
|
||||
Requires: PHP5 and https://github.com/phpredis/phpredis installed
|
||||
EpochMod.com by [VB]AWOL
|
||||
*/
|
||||
|
||||
$search = 'Bob Jones';
|
||||
|
||||
$redis = new Redis();
|
||||
$redis->pconnect(122.99.21.122, 6379, 2.5, "Server1");
|
||||
$redis->auth("yourlongasspasswordhere");
|
||||
|
||||
$playerNames = $redis->keys('PlayerData:*');
|
||||
|
||||
// print all UID's matching player name
|
||||
foreach ($playerNames as $key => $value) {
|
||||
$data = $redis->get($value);
|
||||
if (stripos($data, $search) !== false) {
|
||||
$key = explode(":", $value);
|
||||
echo "<p>" . $key[1] . "</p>" ;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user