Changeset 19 for minimanager/edit.php


Ignore:
Timestamp:
Aug 13, 2007, 9:05:34 PM (17 years ago)
Author:
george
Message:

Aktualizace MaNGOS Minimanageru na verzi 0.1.4a.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • minimanager/edit.php

    r5 r19  
    1919                $lang_id_tab, $gm_level_arr;
    2020
    21  $mysql = new MySQL;
    22  $mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    23 
    24  $result = $mysql->query("SELECT email,gmlevel,joindate,tbc FROM account WHERE username ='$user_name'");
    25 
    26  if ($acc = $mysql->fetch_row($result)) {
     21 $sql = new SQL;
     22 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     23
     24 $result = $sql->query("SELECT email,gmlevel,joindate,tbc FROM account WHERE username ='$user_name'");
     25
     26 if ($acc = $sql->fetch_row($result)) {
    2727  require_once("scripts/id_tab.php");
    2828 
     
    7979      </tr>";
    8080
    81         $result = $mysql->query("SELECT SUM(numchars) FROM realmcharacters WHERE acctid = '$user_id'");
     81        $result = $sql->query("SELECT SUM(numchars) FROM realmcharacters WHERE acctid = '$user_id'");
    8282        $output .= "<tr>
    8383        <td>{$lang_edit['tot_chars']}</td>
    84         <td>".$mysql->result($result, 0)."</td>
     84        <td>".$sql->result($result, 0)."</td>
    8585      </tr>";
    8686         
    87         $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    88         $result = $mysql->query("SELECT guid,name,race,class,SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) FROM `character` WHERE account = $user_id");
    89         $chars_on_realm = $mysql->num_rows($result);
     87        $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     88        $result = $sql->query("SELECT guid,name,race,class,SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) FROM `character` WHERE account = $user_id");
    9089
    9190        $output .= "<tr>
    9291        <td>{$lang_edit['characters']}</td>
    93         <td>$chars_on_realm</td>
     92        <td>".$sql->num_rows($result)."</td>
    9493      </tr>";
    9594
    96         while ($char = $mysql->fetch_array($result)){
     95        while ($char = $sql->fetch_array($result)){
    9796                $output .= "<tr>
    9897                <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'---></td>
     
    171170 } else error($lang_global['err_no_records_found']);
    172171 
    173  $mysql->close();
     172 $sql->close();
    174173}
    175174
     
    184183        redirect("edit.php?error=1");
    185184
    186  $mysql = new MySQL;
    187  $mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    188 
    189  $new_pass = ($mysql->quote_smart($_POST['pass']) != sha1(strtoupper($user_name).":******")) ? "I='".$mysql->quote_smart($_POST['pass'])."', " : "";
    190  $new_mail = $mysql->quote_smart(trim($_POST['mail']));
    191  $new_tbc = $mysql->quote_smart(trim($_POST['tbc']));
     185 $sql = new SQL;
     186 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     187
     188 $new_pass = ($sql->quote_smart($_POST['pass']) != sha1(strtoupper($user_name).":******")) ? "I='".$sql->quote_smart($_POST['pass'])."', " : "";
     189 $new_mail = $sql->quote_smart(trim($_POST['mail']));
     190 $new_tbc = $sql->quote_smart(trim($_POST['tbc']));
    192191 
    193192 //make sure the mail is valid mail format
     
    195194 if ((!is_email($new_mail))||(strlen($new_mail)  > 224)) redirect("edit.php?error=2");
    196195
    197  $mysql->query("UPDATE account SET email='$new_mail', $new_pass tbc='$new_tbc' WHERE username = '$user_name'");
    198 
    199  if ($mysql->affected_rows()) {
    200         $mysql->close();
     196 $sql->query("UPDATE account SET email='$new_mail', $new_pass tbc='$new_tbc' WHERE username = '$user_name'");
     197
     198 if ($sql->affected_rows()) {
     199        $sql->close();
    201200        redirect("edit.php?error=3");
    202201    } else {
    203                 $mysql->close();
     202                $sql->close();
    204203                redirect("edit.php?error=4");
    205204        }
Note: See TracChangeset for help on using the changeset viewer.