Changeset 374 for minimanager/user.php
- Timestamp:
- Sep 11, 2008, 9:10:27 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/user.php
r307 r374 10 10 11 11 require_once("header.php"); 12 valid_login( 1);12 valid_login($action_permission['read']); 13 13 require_once("scripts/id_tab.php"); 14 14 … … 17 17 //######################################################################################################################## 18 18 function browse_users() { 19 global $lang_global, $lang_user, $output, $realm_db, $itemperpage, $user_lvl, $user_name, $gm_level_arr ;19 global $lang_global, $lang_user, $output, $realm_db, $itemperpage, $user_lvl, $user_name, $gm_level_arr, $action_permission; 20 20 21 21 $sql = new SQL; … … 41 41 <center><table class=\"top_hidden\"> 42 42 <tr><td>"; 43 if($user_lvl >= $action_permission['update']) 44 { 43 45 makebutton($lang_user['add_acc'], "user.php?action=add_new", 124); 44 46 makebutton($lang_user['cleanup'], "cleanup.php", 122); 45 47 makebutton($lang_user['backup'], "backup.php", 122); 48 } 46 49 makebutton($lang_global['back'], "javascript:window.history.back()", 122); 47 50 $output .= " </td><td align=\"right\" width=\"25%\" rowspan=\"2\">"; … … 81 84 <input type=\"hidden\" name=\"backup_op\" value=\"0\"/> 82 85 <table class=\"lined\"> 83 <tr> 84 <th width=\"1%\"><input name=\"allbox\" type=\"checkbox\" value=\"Check All\" onclick=\"CheckAll(document.form1);\" /></th> 85 <th width=\"5%\"><a href=\"user.php?order_by=id&start=$start&dir=$dir\">".($order_by=='id' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_user['id']}</a></th> 86 <tr>"; 87 if($user_lvl >= $action_permission['update']) $output.= "<th width=\"1%\"><input name=\"allbox\" type=\"checkbox\" value=\"Check All\" onclick=\"CheckAll(document.form1);\" /></th>"; 88 else $output .= "<th width=\"1%\"></th>"; 89 $output .="<th width=\"5%\"><a href=\"user.php?order_by=id&start=$start&dir=$dir\">".($order_by=='id' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_user['id']}</a></th> 86 90 <th width=\"23%\"><a href=\"user.php?order_by=username&start=$start&dir=$dir\">".($order_by=='username' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_user['username']}</a></th> 87 91 <th width=\"5%\"><a href=\"user.php?order_by=gmlevel&start=$start&dir=$dir\">".($order_by=='gmlevel' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_user['gm_level']}</a></th> … … 99 103 if (($user_lvl >= $data[2])||($user_name == $data[1])){ 100 104 $output .= "<tr>"; 101 if ($user_lvl > $data[2]) $output .= "<td><input type=\"checkbox\" name=\"check[]\" value=\"$data[0]\" onclick=\"CheckCheckAll(document.form1);\" /></td>";102 105 if ($user_lvl >= $action_permission['update']) $output .= "<td><input type=\"checkbox\" name=\"check[]\" value=\"$data[0]\" onclick=\"CheckCheckAll(document.form1);\" /></td>"; 106 else $output .= "<td></td>"; 103 107 $output .= "<td>$data[0]</td> 104 108 <td><a href=\"user.php?action=edit_user&error=11&id=$data[0]\">$data[1]</a></td> 105 <td>".$gm_level_arr[$data[2]][2]."</td> 106 <td><a href=\"mailto:$data[3]\">".substr($data[3],0,15)."</a></td> 107 <td class=\"small\">$data[4]</td>"; 108 if (($user_lvl > $data[2])||($user_name == $data[1])) $output .= "<td>$data[5]</td>"; 109 <td>".$gm_level_arr[$data[2]][2]."</td>"; 110 if ($user_lvl >= $action_permission['update']) $output .= " 111 <td><a href=\"mailto:$data[3]\">".substr($data[3],0,15)."</a></td>"; 112 else $output .= "<td>***@***</td>"; 113 $output .="<td class=\"small\">$data[4]</td>"; 114 if (($user_lvl >= $action_permission['update'])||($user_name == $data[1])) $output .= "<td>$data[5]</td>"; 109 115 else $output .= "<td>******</td>"; 110 116 $output .= "<td>".(($data[6]) ? $data[6] : "-")."</td> … … 121 127 <tr> 122 128 <td colspan=\"8\" align=\"left\" class=\"hidden\">"; 129 if($user_lvl >= $action_permission['update']) { 123 130 makebutton($lang_user['del_selected_users'], "javascript:do_submit('form1',0)",220); 124 makebutton($lang_user['backup_selected_users'], "javascript:do_submit('form1',1)",220); 131 makebutton($lang_user['backup_selected_users'], "javascript:do_submit('form1',1)",220); } 125 132 $output .= "</td> 126 133 <td colspan=\"4\" align=\"right\" class=\"hidden\">{$lang_user['tot_acc']} : $all_record</td> … … 136 143 //####################################################################################################### 137 144 function search() { 138 global $lang_global, $lang_user, $output, $realm_db, $user_lvl, $user_name, $sql_search_limit, $gm_level_arr ;139 145 global $lang_global, $lang_user, $output, $realm_db, $user_lvl, $user_name, $sql_search_limit, $gm_level_arr, $action_permission; 146 valid_login($action_permission['read']); 140 147 if(!isset($_GET['search_value']) || !isset($_GET['search_by'])) redirect("user.php?error=2"); 141 148 … … 145 152 $search_value = $sql->quote_smart($_GET['search_value']); 146 153 $search_by = $sql->quote_smart($_GET['search_by']); 154 $search_menu = array('username', 'id', 'gmlevel', 'greater_gmlevel', 'email', 'joindate', 'last_ip', 'failed_logins', 'last_login', 'online', 'banned', 'locked', 'tbc'); 155 if (!array_key_exists($search_by, $search_menu)) $search_by = 'username'; 147 156 148 157 $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) : "id"; … … 230 239 231 240 if (($user_lvl >= $data[2])||($user_name == $data[1])){ 232 $output .= "<tr>";233 if ($user_lvl > $data[2]) $output .= "<td><input type=\"checkbox\" name=\"check[]\" value=\"$data[0]\" onclick=\"CheckCheckAll(document.form1);\" /></td>";234 241 $output .= "<tr>"; 242 if ($user_lvl >= $action_permission['update']) $output .= "<td><input type=\"checkbox\" name=\"check[]\" value=\"$data[0]\" onclick=\"CheckCheckAll(document.form1);\" /></td>"; 243 else $output .= "<td></td>"; 235 244 $output .= "<td>$data[0]</td> 236 245 <td><a href=\"user.php?action=edit_user&error=11&id=$data[0]\">$data[1]</a></td> 237 <td>".$gm_level_arr[$data[2]][2]."</td> 238 <td><a href=\"mailto:$data[3]\">".substr($data[3],0,15)."</a></td> 239 <td class=\"small\">$data[4]</td>"; 240 if (($user_lvl > $data[2])||($user_name == $data[1])) $output .= "<td>$data[5]</td>"; 246 <td>".$gm_level_arr[$data[2]][2]."</td>"; 247 if ($user_lvl >= $action_permission['update']) $output .= " 248 <td><a href=\"mailto:$data[3]\">".substr($data[3],0,15)."</a></td>"; 249 else $output .= "<td>***@***</td>"; 250 $output .="<td class=\"small\">$data[4]</td>"; 251 if (($user_lvl >= $action_permission['update'])||($user_name == $data[1])) $output .= "<td>$data[5]</td>"; 241 252 else $output .= "<td>******</td>"; 242 253 $output .= "<td>".(($data[6]) ? $data[6] : "-")."</td> … … 245 256 <td>".(($data[9]) ? "<img src=\"img/up.gif\" alt=\"\" />" : "-")."</td> 246 257 </tr>"; 247 } else{258 } else { 248 259 $output .= "<tr><td>*</td><td>***</td><td>You</td><td>Have</td><td>No</td> 249 260 <td class=\"small\">Permission</td><td>to</td><td>View</td><td>this</td><td>Data</td><td>*</td></tr>"; … … 253 264 <tr> 254 265 <td colspan=\"8\" align=\"left\" class=\"hidden\">"; 266 if($user_lvl >= $action_permission['update']) { 255 267 makebutton($lang_user['del_selected_users'], "javascript:do_submit('form1',0)",220); 256 makebutton($lang_user['backup_selected_users'], "javascript:do_submit('form1',1)",220); 268 makebutton($lang_user['backup_selected_users'], "javascript:do_submit('form1',1)",220); } 257 269 $output .= "</td> 258 270 <td colspan=\"4\" align=\"right\" class=\"hidden\">{$lang_user['tot_found']} : $total_found : {$lang_global['limit']} $sql_search_limit</td> … … 269 281 //####################################################################################################### 270 282 function del_user() { 271 global $lang_global, $lang_user, $output, $realm_db; 283 global $lang_global, $lang_user, $output, $realm_db, $action_permission; 284 valid_login($action_permission['delete']); 272 285 if(isset($_GET['check'])) $check = $_GET['check']; 273 286 else redirect("user.php?error=1"); … … 313 326 function dodel_user() { 314 327 global $lang_global, $lang_user, $output, $realm_db, $characters_db, $realm_id, $user_lvl, 315 $tab_del_user_characters, $tab_del_user_realmd ;316 328 $tab_del_user_characters, $tab_del_user_realmd, $action_permission; 329 valid_login($action_permission['delete']); 317 330 $sql = new SQL; 318 331 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); … … 354 367 //##################################################################################################### 355 368 function backup_user() { 356 global $lang_global, $lang_user, $output, $realm_db, $characters_db, $realm_id, $user_lvl,$backup_dir ;357 369 global $lang_global, $lang_user, $output, $realm_db, $characters_db, $realm_id, $user_lvl,$backup_dir,$action_permission; 370 valid_login($action_permission['insert']); 358 371 $sql = new SQL; 359 372 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); … … 483 496 //####################################################################################################### 484 497 function add_new() { 485 global $lang_global, $lang_user, $output; 498 global $lang_global, $lang_user, $output, $action_permission; 499 valid_login($action_permission['insert']); 486 500 $output .= "<center> 487 501 <script type=\"text/javascript\" src=\"js/sha1.js\"></script> … … 545 559 //######################################################################################################### 546 560 function doadd_new() { 547 global $lang_global, $realm_db; 561 global $lang_global, $realm_db, $action_permission; 562 valid_login($action_permission['insert']); 548 563 549 564 if ( empty($_GET['new_user']) || empty($_GET['pass']) ) … … 595 610 //########################################################################################################### 596 611 function edit_user() { 597 global $lang_global, $lang_user, $output, $realm_db, $characters_db, $realm_id, $user_lvl, $user_name, $gm_level_arr; 612 global $lang_global, $lang_user, $output, $realm_db, $characters_db, $realm_id, $user_lvl, $user_name, $gm_level_arr, $action_permission; 613 valid_login($action_permission['view']); 598 614 599 615 if (empty($_GET['id'])) redirect("user.php?error=10"); … … 640 656 </tr> 641 657 <tr> 642 <td>{$lang_user['username']}</td> 643 <td><input type=\"text\" name=\"username\" size=\"43\" maxlength=\"15\" value=\"$data[1]\" /></td> 644 </tr> 645 <tr> 646 <td>{$lang_user['password']}</td> 647 <td><input type=\"text\" name=\"new_pass\" size=\"43\" maxlength=\"40\" value=\"******\" /></td> 648 </tr> 649 <tr> 650 <td>{$lang_user['email']}</td> 651 <td><input type=\"text\" name=\"mail\" size=\"43\" maxlength=\"225\"value=\"$data[3]\" /></td> 652 </tr> 653 <tr> 654 <td>{$lang_user['gm_level_long']}</td> 658 <td>{$lang_user['username']}</td>"; 659 if($user_lvl >= $action_permission['update']) { $output .=" 660 <td><input type=\"text\" name=\"username\" size=\"43\" maxlength=\"15\" value=\"$data[1]\" /></td>"; } 661 else $output.="<td>$data[1]</td>"; 662 $output .= " 663 </tr> 664 <tr> 665 <td>{$lang_user['password']}</td>"; 666 if($user_lvl >= $action_permission['update']) { $output .=" 667 <td><input type=\"text\" name=\"new_pass\" size=\"43\" maxlength=\"40\" value=\"******\" /></td>"; } 668 else $output.="<td>********</td>"; 669 $output .= " 670 </tr> 671 <tr> 672 <td>{$lang_user['email']}</td>"; 673 if($user_lvl >= $action_permission['update']) { $output .=" 674 <td><input type=\"text\" name=\"mail\" size=\"43\" maxlength=\"225\"value=\"$data[3]\" /></td>"; } 675 else $output.="<td>$data[3]</td>"; 676 $output .= " 677 </tr> 678 <tr> 679 <td>{$lang_user['gm_level_long']}</td>"; 680 if($user_lvl >= $action_permission['update']) { $output .=" 655 681 <td><select name=\"gmlevel\">"; 656 682 foreach ($gm_level_arr as $level){ … … 662 688 } 663 689 $output .= "</select> 664 </td> 690 </td>"; } 691 else 692 693 foreach ($gm_level_arr as $level){ 694 if ($data[2] == $level[0]) 695 $output .= "<td>{$level[0]}</td>"; 696 } 697 698 //$output .= "<td></td>"; 699 $output .=" 665 700 </tr> 666 701 <tr> … … 674 709 if ($sql->num_rows($que)){ 675 710 $banned = $sql->fetch_row($que); 676 $ban_info = " - from:".date('d-m-Y G:i', $banned[0])." till:".date('d-m-Y G:i', $banned[1])."<br />by $banned[2]";711 $ban_info = " From:".date('d-m-Y G:i', $banned[0])." till:".date('d-m-Y G:i', $banned[1])."<br />by $banned[2]"; 677 712 $ban_checked = " checked=\"checked\""; 678 713 } else { … … 680 715 $ban_info = ""; 681 716 } 682 $output .= "<td><input type=\"checkbox\" name=\"banned\" value=\"1\" $ban_checked/>$ban_info</td> 683 </tr> 684 <tr> 685 <td>{$lang_user['last_ip']}</td> 686 <td>$data[5]<a href=\"banned.php?action=do_add_entry&entry=$data[5]&bantime=3600&ban_type=ip_banned\"> <- {$lang_user['ban_this_ip']}</a></td> 687 </tr> 688 <td>{$lang_user['client_type']}</td> 717 if($user_lvl >= $action_permission['update']) { 718 $output .= "<td><input type=\"checkbox\" name=\"banned\" value=\"1\" $ban_checked/>$ban_info</td>"; } 719 else 720 $output .= "<td>$ban_info</td>"; 721 $output .=" 722 </tr> 723 <tr> 724 <td>{$lang_user['last_ip']}</td>"; 725 if($user_lvl >= $action_permission['update']) { $output .=" 726 <td>$data[5]<a href=\"banned.php?action=do_add_entry&entry=$data[5]&bantime=3600&ban_type=ip_banned\"> <- {$lang_user['ban_this_ip']}</a></td>"; } 727 else $output .= "<td>***.***.***.***</td>"; 728 $output .= " 729 </tr> 730 <td>{$lang_user['client_type']}</td>"; 731 if($user_lvl >= $action_permission['update']) { $output .=" 689 732 <td><select name=\"tbc\">"; 690 $output .= "<option value=\"0\">{$lang_user['classic']}</option>733 $output .= "<option value=\"0\">{$lang_user['classic']}</option> 691 734 <option value=\"1\" "; 692 735 if ($data[10]) $output .= "selected=\"selected\" "; 693 736 $output .= ">{$lang_user['expansion']}</option> 694 737 </select> 695 </td> 696 <tr> 697 <td>{$lang_user['failed_logins_long']}</td> 698 <td><input type=\"text\" name=\"failed\" size=\"43\" maxlength=\"3\" value=\"$data[6]\" /></td> 699 </tr> 738 </td>"; } 739 else $output .= "<td>{$lang_user['expansion']}</td>"; 740 $output .=" 741 <tr> 742 <td>{$lang_user['failed_logins_long']}</td>"; 743 if($user_lvl >= $action_permission['update']) { $output .=" 744 <td><input type=\"text\" name=\"failed\" size=\"43\" maxlength=\"3\" value=\"$data[6]\" /></td>";} 745 else $output .= "<td>$data[6]</td>"; 746 $output .="</tr> 700 747 <tr> 701 748 <td>{$lang_user['locked']}</td>"; 702 749 $lock_checked = ($data[7]) ? " checked=\"checked\"" : ""; 703 $output .= "<td><input type=\"checkbox\" name=\"locked\" value=\"1\" $lock_checked/></td> 750 if($user_lvl >= $action_permission['update']) 751 $output .= "<td><input type=\"checkbox\" name=\"locked\" value=\"1\" $lock_checked/></td>"; 752 else 753 $output .="<td></td>"; 754 $output.=" 704 755 </tr> 705 756 <tr> … … 740 791 } 741 792 793 794 if($user_lvl >= $action_permission['update']) 795 { 742 796 $output .= "<tr><td>"; 743 797 makebutton($lang_user['update_data'], "javascript:do_submit_data()",140); 798 makebutton($lang_user['del_acc'], "user.php?action=del_user&check%5B%5D=$id",150); 799 } 800 else 801 $output .= "<tr><td>"; 744 802 $output .= "</td><td>"; 745 makebutton($lang_user['del_acc'], "user.php?action=del_user&check%5B%5D=$id",150);746 803 makebutton($lang_global['back'], "javascript:window.history.back()",150); 747 804 $output .= "</td></tr>
Note:
See TracChangeset
for help on using the changeset viewer.