Changeset 19 for minimanager/edit.php
- Timestamp:
- Aug 13, 2007, 9:05:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/edit.php
r5 r19 19 19 $lang_id_tab, $gm_level_arr; 20 20 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)) { 27 27 require_once("scripts/id_tab.php"); 28 28 … … 79 79 </tr>"; 80 80 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'"); 82 82 $output .= "<tr> 83 83 <td>{$lang_edit['tot_chars']}</td> 84 <td>".$ mysql->result($result, 0)."</td>84 <td>".$sql->result($result, 0)."</td> 85 85 </tr>"; 86 86 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"); 90 89 91 90 $output .= "<tr> 92 91 <td>{$lang_edit['characters']}</td> 93 <td> $chars_on_realm</td>92 <td>".$sql->num_rows($result)."</td> 94 93 </tr>"; 95 94 96 while ($char = $ mysql->fetch_array($result)){95 while ($char = $sql->fetch_array($result)){ 97 96 $output .= "<tr> 98 97 <td> '---></td> … … 171 170 } else error($lang_global['err_no_records_found']); 172 171 173 $ mysql->close();172 $sql->close(); 174 173 } 175 174 … … 184 183 redirect("edit.php?error=1"); 185 184 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'])); 192 191 193 192 //make sure the mail is valid mail format … … 195 194 if ((!is_email($new_mail))||(strlen($new_mail) > 224)) redirect("edit.php?error=2"); 196 195 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(); 201 200 redirect("edit.php?error=3"); 202 201 } else { 203 $ mysql->close();202 $sql->close(); 204 203 redirect("edit.php?error=4"); 205 204 }
Note:
See TracChangeset
for help on using the changeset viewer.