Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- session_start();
- ?>
- <!-- Head -->
- <?
- include ("head.php");
- include ("bd.php");
- include ("cfg.php");
- ?>
- <!-- End Head -->
- <!-- Стили -->
- <style type="text/css">
- .lonnieinputucp {
- border: 1px solid #fff;
- background: url(none) no-repeat #000000;
- font-family: tahoma, helvetica, sans-serif;
- font-style: normal;
- font-size: 14px;
- color: #ffffff;
- }
- .lonnieinputucp {
- font-family: tahoma, helvetica, sans-serif;
- font-style: bold;
- font-size: 13px;
- color: #fff;
- }
- .lonnieinputucp:hover {
- border: 1px solid #FFFFFF;
- background: url(none) no-repeat #FFFFFF;
- color: #000000;
- }
- .lonnieinputucp:focus {
- border: 1px solid #FFFFFF;
- background: url(none) no-repeat #FFFFFF;
- color: #000000;
- }
- input.button
- {
- font-size:12px;
- font-family:Arial,sans-serif;
- font-weight:bold;
- color:#FFFFFF;
- background-color:#000000;
- border-style:double;
- border-color:#FFFFFF;
- border-width:3px;
- }
- input.button:hover
- {
- font-size:12px;
- font-family:Arial,sans-serif;
- font-weight:bold;
- color:#3a599d;
- background-color:#FFFFFF;
- border-style:double;
- border-color:#CCCCCC;
- border-width:3px;
- }
- </style>
- <!-- Конец стили -->
- <!-- Контент -->
- <!-- Вывод информации -->
- <div id="content-wrapper" class="container">
- <div class="inside clearfix">
- <div id="content">
- <article>
- <div class="post-title">
- <h2>User Control Panel</h2>
- </div>
- <div class="post-content">
- <?
- if(isset($_GET['act']))
- {
- switch($_GET['act'])
- {
- case 'logout':
- {
- if(!isset($_GET['logout']))
- {
- unset($_SESSION['username']);
- unset($_SESSION['key']);
- echo '<script language="javaScript">
- document.location.href ="ucp.php";
- </script>';
- }
- else { echo '<meta http-equiv="refresh" content="2; URL=index.php?act=' . $_GET['act'] . '">'; }
- break;
- }
- case 'reg':
- {
- if(!isset($_GET['reg']))
- {
- include("register.php");
- }
- else { echo '<meta http-equiv="refresh" content="2; URL=index.php?act=' . $_GET['act'] . '">'; }
- break;
- }
- case 'retrive':
- {
- if(!isset($_GET['retrive']))
- {
- include("retrive.php");
- }
- else { echo '<meta http-equiv="refresh" content="2; URL=index.php?act=' . $_GET['act'] . '">'; }
- break;
- }
- case 'stat':
- {
- if(!isset($_GET['stat']))
- {
- include('stat.php');
- }
- else { echo '<meta http-equiv="refresh" content="2; URL=index.php?act=' . $_GET['act'] . '">'; }
- break;
- }
- case 'changepass':
- {
- if(!isset($_GET['changepass']))
- {
- if(isset($_POST['change_userpass']))
- {
- $oldpassword = $_POST['oldpassword'];
- $newpassword = $_POST['newpassword'];
- if($oldpassword == '' or $newpassword == '')
- {
- echo "<b>Заполните все поля!</b>";
- }
- $acc = parse_ini_file($path . "/" . $_SESSION['username'] . ".ini");
- if($oldpassword == $acc['Password'])
- {
- $acc['Password'] = trim(htmlspecialchars(stripslashes($_POST['newpassword'])));
- $_SESSION['key'] = trim(htmlspecialchars(stripslashes($_POST['newpassword'])));
- foreach($acc as $key => $value) $savekey[] = "$key = $value\r";
- file_put_contents($path . "/" . $_SESSION['username'] . ".ini", implode("\n", $savekey));
- echo "<h2>Пароль успешно изменён!</h2>";
- }
- else
- {
- echo "<b>Неверный пароль.</b>";
- }
- }
- echo "<form method='post' action=''>";
- echo "Старый пароль:<br><input class='lonnieinputucp' name='oldpassword'></textarea><br>";
- echo "Новый пароль:<br><input class='lonnieinputucp' name='newpassword'></textarea><br>";
- echo "<br><input type='submit' class='button' name='change_userpass' value='Сменить пароль'>";
- echo "</form>";
- }
- else { echo '<meta http-equiv="refresh" content="2; URL=index.php?act=' . $_GET['act'] . '">'; }
- break;
- }
- }
- }
- else
- {
- if(isset($_POST['ucp_login']))
- {
- if($_POST['name'] == '' or $_POST['password'] == '')
- {
- exit("<b>Заполните все поля! <br></b>");
- }
- else
- {
- $user = $_POST["name"];
- $pass = $_POST["password"];
- $escuser = mysql_real_escape_string($user);
- $escpass = mysql_real_escape_string($pass);
- }
- $query = "SELECT * FROM players WHERE Name = '$escuser'";
- $result = mysql_query($query);
- $username_exist = mysql_num_rows($result);
- if($username_exist == 0)
- {
- unset($_SESSION['username']);
- unset($_SESSION['key']);
- }
- $row = mysql_fetch_row($result);
- if($row[2] === $escpass)
- {
- $_SESSION['username'] = $user;
- $_SESSION['key'] = $pass;
- }
- else
- {
- unset($_SESSION['username']);
- unset($_SESSION['key']);
- exit("Error: Неверный пароль!.");
- }
- }
- if($_SESSION['username'] and $_SESSION['key'])
- {
- echo "Здравствуйте, <b>".$_SESSION['username']."</b>! Мы рады приветствовать Вас в нашей UCP!<br><br>";
- echo "В данном контенте Вы можете <a href='ucp.php?act=stat'>посмотреть статистику</a> Вашего персонажа, а, также, <a href='ucp.php?act=changepass'>сменить пароль</a> от Вашего аккаунта.<br><br>";
- echo "С уважением, администрация <b>Criminal Russia RolePlay</b>!";
- }
- else
- {
- ?>
- <form method="post" action="">
- Имя персонажа:<br><input name="name"><br>
- Пароль:<br><input name="password" type=password><br><br>
- <input name="ucp_login" type="submit" value="Войти">
- </form>
- <form method="post" action="ucp.php?act=retrive">
- <input name="retrive" type="submit" value="Востановить пароль">
- </form>
- <form method="post" action="ucp.php?act=reg">
- <input name="reg" type="submit" value="Зарегистрироваться">
- </form>
- <?
- }
- }
- ?>
- </div>
- </article>
- </div>
- <!-- End вывод информации -->
- <!-- Второе меню -->
- <?
- include("ucpmenu.php");
- ?>
- <!-- End второе меню -->
- </div>
- </div>
- <!-- Контент -->
- <!-- Footer -->
- <?
- include ("footer.php");
- ?>
- <!-- End footer -->
Add Comment
Please, Sign In to add comment