function chgpassword($oldpswd, $newpswd, $newpswd2) { global $db, $tablepre, $name, $log; if (!$oldpswd || !$newpswd || !$newpswd2) { $log .= '放弃了修改密码。<br />'; $mode = 'command'; return; } elseif ($newpswd !== $newpswd2) { $log .= '<span class="red">两次输入的新密码不一致。</span><br />'; $mode = 'command'; return; } $oldpswd = md5($oldpswd); $newpswd = md5($newpswd); $result = $db->query("SELECT * FROM {$gtablepre}users WHERE username='******'"); $userinfo = $db->fetch_array($result); if ($oldpswd == $userinfo['password']) { $db->query("UPDATE {$gtablepre}users SET `password` ='{$newpswd}' WHERE username='******'"); $log .= '<span class="yellow">密码已修改!</span><br />'; //include_once GAME_ROOT.'./include/global.func.php'; gsetcookie('pass', $newpswd); $mode = 'command'; return; } else { $log .= '<span class="red">原密码输入错误!</span><br />'; $mode = 'command'; return; } }
$gamedata['innerHTML']['info'] = ''; if ($opass && $npass && $rnpass) { $pass_right = true; $pass_check = pass_check($npass, $rnpass); if ($pass_check != 'pass_ok') { $gamedata['innerHTML']['info'] .= $_ERROR[$pass_check] . '<br />'; $pass_right = false; } $opass = md5($opass); $npass = md5($npass); if ($opass != $udata['password']) { $gamedata['innerHTML']['info'] .= $_ERROR['wrong_pw'] . '<br />'; $pass_right = false; } if ($pass_right) { gsetcookie('pass', $npass); $passqry = "`password` ='{$npass}',"; $gamedata['innerHTML']['info'] .= $_INFO['pass_success'] . '<br />'; } else { $passqry = ''; $gamedata['innerHTML']['info'] .= $_INFO['pass_failure'] . '<br />'; } } else { $passqry = ''; $gamedata['innerHTML']['info'] .= $_INFO['pass_failure'] . '<br />'; } $carr = explode('_', $udata['cardlist']); $cflag = 0; foreach ($carr as $val) { if ($val == $card) { $cflag = true;
<?php define('CURSCRIPT', 'game'); require './include/common.inc.php'; if (!$cuser || !$cpass) { gexit($_ERROR['no_login'], __FILE__, __LINE__); } if ($mode == 'quit') { gsetcookie('user', ''); gsetcookie('pass', ''); header("Location: index.php"); exit; } $result = $db->query("SELECT * FROM {$tablepre}players WHERE name = '{$cuser}' AND type = 0"); if (!$db->num_rows($result)) { header("Location: valid.php"); exit; } $pdata = $db->fetch_array($result); if ($pdata['pass'] != $cpass) { $tr = $db->query("SELECT `password` FROM {$gtablepre}users WHERE username='******'"); $tp = $db->fetch_array($tr); $password = $tp['password']; if ($password == $cpass) { $db->query("UPDATE {$tablepre}players SET pass='******' WHERE name='{$cuser}'"); } else { gexit($_ERROR['wrong_pw'], __FILE__, __LINE__); } } if ($gamestate == 0) { header("Location: end.php");
// } // if(strpos($onlineip,$value)!==false){ // gexit($_ERROR['banned_ip'],__file__,__line__); // } // } $password = md5($password); $groupid = 1; $credits = 0; $gender = 0; $result = $db->query("SELECT * FROM {$gtablepre}users WHERE username = '******'"); if (!$db->num_rows($result)) { gexit($_ERROR['user_not_exists'], __FILE__, __LINE__); //$groupid = 1; //$db->query("INSERT INTO {$gtablepre}users (username,`password`,groupid,ip,credits,gender) VALUES ('$username', '$password', '$groupid', '$onlineip', '$credits', '$gender')"); } else { $userdata = $db->fetch_array($result); if ($userdata['groupid'] <= 0) { gexit($_ERROR['user_ban'], __FILE__, __LINE__); } elseif ($userdata['password'] != $password) { gexit($_ERROR['wrong_pw'], __FILE__, __LINE__); } } $db->query("UPDATE {$gtablepre}users SET ip='{$onlineip}' WHERE username = '******'"); gsetcookie('user', $username); gsetcookie('pass', $password); //} Header("Location: index.php"); exit; ?>