Changeset 581 for trunk/pages/chpass.php


Ignore:
Timestamp:
Apr 30, 2009, 1:28:25 PM (15 years ago)
Author:
george
Message:
  • Opraveno: Chybová některých chybových hlášení.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pages/chpass.php

    r489 r581  
    11<?php
    2 $html -> PrgStart();
    32
    4  if ($player -> Check())
     3$info = '';
     4$html->PrgStart();
     5if($player->Check())
     6{
     7  if(array_key_exists('zmenit', $_POST) and ($_POST['zmenit'] == 1))
    58  {
    6 $zmenit = $_POST['zmenit'];
    7 if($zmenit==1){
    8     include("inc/db.php");
    99    $account = $_POST['acc1'];
    1010    $heslo1 = $_POST['heslo1'];
    11         $heslo2 = $_POST['heslo2'];
    12         $heslo3 = $_POST['heslo3'];
     11        $heslo2 = $_POST['heslo2'];
     12          $heslo3 = $_POST['heslo3'];
    1313   
    14 if(empty($account) OR empty($heslo1) OR empty($heslo2) OR empty($heslo3)):
    15 $info = "<font color=red><strong>Nevyplnil jste všechna políčka!</strong></font>";
    16 else:
    17     mysql_connect($db_server, $db_user, $db_pass);
    18         mysql_select_db($db_realmd);
    19         $acc_check = mysql_num_rows(mysql_query("select id from account where username='$account' and sha_pass_hash=SHA1(CONCAT(UPPER('$account'),':',UPPER('$heslo1')))"));
    20         if($acc_check!=0):
    21         if($heslo2==$heslo3):
    22         $pass_update = mysql_query("update account set sha_pass_hash=SHA1(CONCAT(UPPER('$account'),':',UPPER('$heslo2'))) where username='$account'");
    23         if($pass_update):
    24         $info = "<font color=green><strong>Heslo bylo vpořádku změněno!</strong></font>";
    25         else:
    26     $info = "<font color=red><strong>Heslo se nepodařilo změnit!</strong></font>";
    27         endif;
    28         else:
    29         $info = "<font color=red><b>Hesla se neshodují!</b></font>";
    30         endif;
    31         else:
    32         $info = "<font color=red><b>Zadali jste neexistujici account nebo špatné heslo!</b></font>";
    33         endif;
    34 endif;
    35 }
     14    if(empty($account) OR empty($heslo1) OR empty($heslo2) OR empty($heslo3)) $info = '<font color=red><strong>Nevyplnil jste všechna políčka!</strong></font>';
     15    else   
     16    {
     17      $db->select_db($Config['Mangos']['DatabaseRealmd']);
     18      $DbResult = $db->query('SELECT id FROM account WHERE username="'.$account.'" and sha_pass_hash=SHA1(CONCAT(UPPER("'.$account.'"),":",UPPER("'.$heslo1.'")))');
     19            if($DbResult->num_rows > 0)
     20      {
     21              if($heslo2 == $heslo3)
     22        {
     23                $pass_update = $db->query('update account set sha_pass_hash=SHA1(CONCAT(UPPER("'.$account.'"), ":", UPPER("'.$heslo2.'"))) where username="'.$account.'"');
     24                if($pass_update) $info = '<font color="green"><strong>Heslo bylo vpořádku změněno!</strong></font>';
     25                else $info = '<font color="red"><strong>Heslo se nepodařilo změnit!</strong></font>';
     26              } else $info = '<font color="red"><b>Hesla se neshodují!</b></font>';     
     27            } else $info = '<font color="red"><b>Zadali jste neexistujici účet nebo špatné heslo!</b></font>';     
     28    }
     29  }
    3630
     31  echo('&nbsp;<a href="?page=acc">&lt;- Zpět do správy účtu</a><br />
    3732
    38 echo "&nbsp;<a href=\"?page=acc\">&lt;- Zpět do správy účtu</a><br />
     33<b>'.$info.'</b>
     34<form method="post" action="?page=chpass">
     35<center><h3>Změna typu účtu</h3></center>
    3936
    40 <b>$info</b>
    41 <form method=post action=\"?page=chpass\">
    42 <center><h3>Změna typu accountu</h3></center>
    43 
    44 <table align=\"center\">
    45   <input type=\"hidden\" name=\"acc1\" value='".$_SESSION["UserName"]."'>
     37<table align="center">
     38  <input type="hidden" name="acc1" value="'.$_SESSION['UserName'].'" />
    4639  <tr>
    4740    <td>
    48       Momentální Heslo : </td>
     41      Momentální Heslo: </td>
    4942    <td>
    50      <input type=\"password\" name=\"heslo1\"></td>
     43     <input type="password" name="heslo1" /></td>
    5144  </tr>
    5245   <tr>
     
    5447      Nové Heslo : </td>
    5548    <td>
    56      <input type=\"password\" name=\"heslo2\"></td>
     49     <input type="password" name="heslo2" /></td>
    5750  </tr>
    5851   <tr>
     
    6053      Nové Heslo podruhé : </td>
    6154    <td>
    62      <input type=\"password\" name=\"heslo3\"></td>
     55     <input type="password" name="heslo3" /></td>
    6356  </tr>
    6457  <tr>
    65     <td colspan=\"2\" align=\"right\">
    66         <input type=hidden name=zmenit value='1'>
    67       <input type=\"submit\" value=\"Změnit\" name=\"change\"></td>
     58    <td colspan="2" align="right">
     59        <input type="hidden" name="zmenit" value="1" />
     60      <input type="submit" value="Změnit" name="change"></td>
    6861  </tr>
    6962</table>
    70 </form>
    71 ";
     63</form>');
    7264}
    73 else
    74 {
     65else $player->LoginForm();
     66$html->PrgStop();
    7567
    76 $player -> LoginForm();
    77 
    78 }
    79 
    80 $html -> PrgStop();
    8168?>
Note: See TracChangeset for help on using the changeset viewer.