Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('PUN_ROOT', './');
- require PUN_ROOT.'include/common.php';
- $validUsers = array(
- 'kopkop' => 'kopkop',
- );
- $userName = trim(arrayGet($_GET, 'user', ''));
- $passWord = trim(arrayGet($_GET, 'pass', ''));
- $auth = trim(arrayGet($_GET, 'user', ''));
- $result = $db->query('SELECT username FROM '.$db->prefix. 'pk_players WHERE user="'.$username.'"') or error('Unable to fetch player info', __FILE__, __LINE__, $db->error());
- if(0 == strlen($userName)){
- authError('Username not set');
- redirect('char.php?user='.$id
- }else if(0 == strlen($passWord)){
- authError('Password not set');
- redirect('char.php?user='.$id
- }
- foreach($validUsers as $uName => $pWord){
- $uName = md5($uName);
- $pWord = md5($pWord);
- if($uName === $userName && $pWord === $passWord){
- die('success');
- }
- }
- authError('Invalid username/password');
- //Functions:
- function authError($errMsg){
- echo('Authorization failed'."\n<br/>".$errMsg);
- exit;
- }
- function arrayGet(&$arr, $key, $defaultVal){
- if(array_key_exists($key, $arr)){
- return $arr[$key];
- }
- return $defaultVal;
- }
- ?>
Add Comment
Please, Sign In to add comment