Guest User

Untitled

a guest
Jun 28th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.09 KB | None | 0 0
  1. <?
  2. session_start();
  3. ?>
  4.  
  5. <!-- Head -->
  6. <?
  7. include ("head.php");
  8. include ("bd.php");
  9. include ("cfg.php");
  10. ?>
  11. <!-- End Head -->
  12.  
  13. <!-- Стили -->
  14. <style type="text/css">
  15. .lonnieinputucp {
  16.     border: 1px solid #fff;
  17.     background: url(none) no-repeat #000000;
  18.     font-family: tahoma, helvetica, sans-serif;
  19.     font-style: normal;
  20.     font-size: 14px;
  21.     color: #ffffff;
  22. }
  23.  
  24. .lonnieinputucp {
  25.     font-family: tahoma, helvetica, sans-serif;
  26.     font-style: bold;
  27.     font-size: 13px;
  28.     color: #fff;
  29. }
  30.  
  31. .lonnieinputucp:hover {
  32.     border: 1px solid #FFFFFF;
  33.     background: url(none) no-repeat #FFFFFF;
  34.     color: #000000;
  35. }
  36. .lonnieinputucp:focus {
  37.     border: 1px solid #FFFFFF;
  38.     background: url(none) no-repeat #FFFFFF;
  39.     color: #000000;
  40. }
  41.  
  42. input.button
  43. {
  44.    font-size:12px;
  45.    font-family:Arial,sans-serif;
  46.    font-weight:bold;
  47.    color:#FFFFFF;
  48.    background-color:#000000;
  49.    border-style:double;
  50.    border-color:#FFFFFF;
  51.    border-width:3px;
  52. }
  53. input.button:hover
  54. {
  55.    font-size:12px;
  56.    font-family:Arial,sans-serif;
  57.    font-weight:bold;
  58.    color:#3a599d;
  59.    background-color:#FFFFFF;
  60.    border-style:double;
  61.    border-color:#CCCCCC;
  62.    border-width:3px;
  63. }
  64. </style>
  65. <!-- Конец стили -->
  66.  
  67. <!-- Контент -->
  68.     <!-- Вывод информации -->
  69.     <div id="content-wrapper" class="container">
  70.         <div class="inside clearfix">
  71.             <div id="content">
  72.                 <article>
  73.                     <div class="post-title">
  74.                         <h2>User Control Panel</h2>
  75.                     </div>
  76.                     <div class="post-content">
  77.                         <?
  78.                         if(isset($_GET['act']))
  79.                         {
  80.                             switch($_GET['act'])
  81.                             {
  82.                                 case 'logout':
  83.                                 {
  84.                                     if(!isset($_GET['logout']))
  85.                                     {
  86.                                         unset($_SESSION['username']);
  87.                                         unset($_SESSION['key']);
  88.                                         echo '<script language="javaScript">
  89.                                         document.location.href ="ucp.php";
  90.                                         </script>';
  91.                                        
  92.                                     }
  93.                                     else { echo '<meta http-equiv="refresh" content="2; URL=index.php?act=' . $_GET['act'] . '">'; }
  94.                                     break;
  95.                                 }
  96.                                 case 'reg':
  97.                                 {
  98.                                     if(!isset($_GET['reg']))
  99.                                     {
  100.                                         include("register.php");
  101.                                     }
  102.                                     else { echo '<meta http-equiv="refresh" content="2; URL=index.php?act=' . $_GET['act'] . '">'; }
  103.                                     break;
  104.                                 }
  105.                                 case 'retrive':
  106.                                 {
  107.                                     if(!isset($_GET['retrive']))
  108.                                     {
  109.                                         include("retrive.php");
  110.                                     }
  111.                                     else { echo '<meta http-equiv="refresh" content="2; URL=index.php?act=' . $_GET['act'] . '">'; }
  112.                                     break;
  113.                                 }
  114.                                 case 'stat':
  115.                                 {
  116.                                     if(!isset($_GET['stat']))
  117.                                     {
  118.                                         include('stat.php');
  119.                                     }
  120.                                     else { echo '<meta http-equiv="refresh" content="2; URL=index.php?act=' . $_GET['act'] . '">'; }
  121.                                     break;
  122.                                 }
  123.                                 case 'changepass':
  124.                                 {
  125.                                     if(!isset($_GET['changepass']))
  126.                                     {
  127.                                         if(isset($_POST['change_userpass']))
  128.                                         {
  129.                                             $oldpassword = $_POST['oldpassword'];
  130.                                             $newpassword = $_POST['newpassword'];
  131.                                             if($oldpassword == '' or $newpassword == '')
  132.                                             {
  133.                                                 echo "<b>Заполните все поля!</b>";
  134.                                             }
  135.                                             $acc = parse_ini_file($path . "/" . $_SESSION['username'] . ".ini");
  136.                                             if($oldpassword == $acc['Password'])
  137.                                             {
  138.                                                 $acc['Password'] = trim(htmlspecialchars(stripslashes($_POST['newpassword'])));
  139.                                                 $_SESSION['key'] = trim(htmlspecialchars(stripslashes($_POST['newpassword'])));
  140.                                                 foreach($acc as $key => $value) $savekey[] = "$key = $value\r";
  141.                                                 file_put_contents($path . "/" . $_SESSION['username'] . ".ini", implode("\n", $savekey));
  142.                                                 echo "<h2>Пароль успешно изменён!</h2>";
  143.                                             }
  144.                                             else
  145.                                             {
  146.                                                 echo "<b>Неверный пароль.</b>";
  147.                                             }
  148.                                         }
  149.                                         echo "<form method='post' action=''>";
  150.                                             echo "Старый пароль:<br><input class='lonnieinputucp' name='oldpassword'></textarea><br>";
  151.                                             echo "Новый пароль:<br><input class='lonnieinputucp' name='newpassword'></textarea><br>";
  152.                                             echo "<br><input type='submit' class='button' name='change_userpass' value='Сменить пароль'>";
  153.                                         echo "</form>";
  154.                                     }
  155.                                     else { echo '<meta http-equiv="refresh" content="2; URL=index.php?act=' . $_GET['act'] . '">'; }
  156.                                     break;
  157.                                 }
  158.                             }
  159.                         }
  160.                         else
  161.                         {
  162.                             if(isset($_POST['ucp_login']))
  163.                             {
  164.                                 if($_POST['name'] == '' or $_POST['password'] == '')
  165.                                 {
  166.                                     exit("<b>Заполните все поля! <br></b>");
  167.                                 }
  168.                                 else
  169.                                 {
  170.                                 $user = $_POST["name"];
  171.                                 $pass = $_POST["password"];
  172.                                 $escuser = mysql_real_escape_string($user);
  173.                                 $escpass = mysql_real_escape_string($pass);
  174.                                 }
  175.                                 $query = "SELECT * FROM players WHERE Name = '$escuser'";
  176.                                 $result = mysql_query($query);
  177.                                 $username_exist = mysql_num_rows($result);
  178.                                 if($username_exist == 0)
  179.                                 {
  180.                                     unset($_SESSION['username']);
  181.                                     unset($_SESSION['key']);
  182.                                 }
  183.                                 $row = mysql_fetch_row($result);
  184.                                 if($row[2] === $escpass)
  185.                                 {
  186.                                     $_SESSION['username'] = $user;
  187.                                     $_SESSION['key'] = $pass;
  188.                                 }
  189.                                 else
  190.                                 {
  191.                                     unset($_SESSION['username']);
  192.                                     unset($_SESSION['key']);
  193.                                     exit("Error: Неверный пароль!.");
  194.                                 }
  195.                             }                      
  196.                             if($_SESSION['username'] and $_SESSION['key'])
  197.                             {
  198.                                 echo "Здравствуйте, <b>".$_SESSION['username']."</b>! Мы рады приветствовать Вас в нашей UCP!<br><br>";
  199.                                 echo "В данном контенте Вы можете <a href='ucp.php?act=stat'>посмотреть статистику</a> Вашего персонажа, а, также, <a href='ucp.php?act=changepass'>сменить пароль</a> от Вашего аккаунта.<br><br>";
  200.                                 echo "С уважением, администрация <b>Criminal Russia RolePlay</b>!";
  201.                             }
  202.                             else
  203.                             {
  204.                                 ?>
  205.                                     <form method="post" action="">
  206.                                         Имя персонажа:<br><input name="name"><br>
  207.                                         Пароль:<br><input name="password" type=password><br><br>
  208.                                         <input name="ucp_login" type="submit" value="Войти">
  209.                                     </form>
  210.                                     <form method="post" action="ucp.php?act=retrive">
  211.                                         <input name="retrive" type="submit" value="Востановить пароль">
  212.                                     </form>
  213.                                     <form method="post" action="ucp.php?act=reg">
  214.                                         <input name="reg" type="submit" value="Зарегистрироваться">
  215.                                     </form>
  216.                                 <?
  217.                             }
  218.                         }
  219.                         ?>
  220.                     </div>
  221.                 </article>
  222.             </div>
  223.     <!-- End вывод информации -->
  224.  
  225.     <!-- Второе меню -->
  226.             <?
  227.             include("ucpmenu.php");
  228.             ?>
  229.     <!-- End второе меню -->
  230.         </div>
  231.     </div>
  232. <!-- Контент -->
  233.  
  234. <!-- Footer -->
  235. <?
  236. include ("footer.php");
  237. ?>
  238. <!-- End footer -->
Add Comment
Please, Sign In to add comment