Location: PHPKode > projects > EverQuest Roster/Gallery > html/includes/read_char.php
<?
        /**********************************************************************************
        *                                                                                 *
        *                                read_char.php                                    *
        *                             -------------------                                 *
        *                                                                                 *
        * Program           : EverQuest Roster/Gallery v1.7b1                             *
        * Copyright         : (C) 2001 - 2002 BladeTek Internet Services &                *
        *                                                     The EQRG Developement Team  *
        * Website           : http://eqcode.roleplayersinteraction.com                    *
        * Support Website   : http://www.sourceforge.net/projects/eqrostergallery         *
        * Email             : hide@address.com                                        *
        *                                                                                 *
        * For license information, please read the documents directory which              *
        * came with this edition                                                          *
        *                                                                                 *
        **********************************************************************************/

        function read_char_list1(&$chars, $sort1, $sort2, $sort3) {
                $query  = "select id, name, surname, class, level, status, has_epic";
                $query .= "  from chars";
                $query .= " where valid = 1";
                $query .= " order by $sort1 " . ($sort1 == "name" ? "asc" : ($sort1 == "status" ? "desc" : ($sort1 == "level" ? "desc" : "asc")));
                $query .= " , $sort2 " . ($sort2 == "name" ? "asc" : ($sort2 == "status" ? "desc" : ($sort2 == "level" ? "desc" : "asc")));
                $query .= " , $sort3 " . ($sort3 == "name" ? "asc" : ($sort3 == "status" ? "desc" : ($sort3 == "level" ? "desc" : "asc")));

                $chars["count"] = query_db($query, $chars, true);
        }

        function read_char_list2(&$chars, $sort1, $sort2, $sort3) {
                $query  = "select id, name, surname, class, level, status, has_epic";
                $query .= "  from chars";
                $query .= " where valid = 1 & primary_char = 1";
                $query .= " order by $sort1 " . ($sort1 == "name" ? "asc" : ($sort1 == "status" ? "desc" : ($sort1 == "level" ? "desc" : "asc")));
                $query .= " , $sort2 " . ($sort2 == "name" ? "asc" : ($sort2 == "status" ? "desc" : ($sort2 == "level" ? "desc" : "asc")));
                $query .= " , $sort3 " . ($sort3 == "name" ? "asc" : ($sort3 == "status" ? "desc" : ($sort3 == "level" ? "desc" : "asc")));

                $chars["count"] = query_db($query, $chars, true);
        }

        function read_char_list3(&$chars, $sort1, $sort2, $sort3) {
                $query  = "select id, name, surname, class, level, status, has_epic";
                $query .= "  from chars";
                $query .= " where valid = 1 & primary_char = 0";
                $query .= " order by $sort1 " . ($sort1 == "name" ? "asc" : ($sort1 == "status" ? "desc" : ($sort1 == "level" ? "desc" : "asc")));
                $query .= " , $sort2 " . ($sort2 == "name" ? "asc" : ($sort2 == "status" ? "desc" : ($sort2 == "level" ? "desc" : "asc")));
                $query .= " , $sort3 " . ($sort3 == "name" ? "asc" : ($sort3 == "status" ? "desc" : ($sort3 == "level" ? "desc" : "asc")));

                $chars["count"] = query_db($query, $chars, true);
        }

        function read_char($id, &$char, &$char_info) {
                if (!$id) {
                        $err = ERR_ID_BLANK;
                } elseif (eregi("[^[:digit:]]", $id)) {
                        $err = ERR_ID_INVALID;
                } else {
                        $query  = "select *";
                        $query .= "  from chars";
                        $query .= " where id = $id";

                        query_db($query, $char);

                        if (!$char["id"]) {
                                $err = ERR_ID_NOT_EXIST;
                        } else {
                                $query  = "select cs.*, e.*";
                                $query .= "  from char_stats as cs";
                                $query .= "  left join equipment as e on e.id = cs.id";
                                $query .= " where cs.id = $id";

                                query_db($query, $char_info);
                        }
                }

                return $err;
        }

        function read_user_chars($id, &$chars, &$user) {
                if (!$id) {
                        $err = ERR_ID_BLANK;
                } elseif (eregi("[^[:digit:]]", $id)) {
                        $err = ERR_ID_INVALID;
                } else {
                        $query  = "select *";
                        $query .= "  from users";
                        $query .= " where id = $id";

                        query_db($query, $user);

                        if (!$user["id"]) {
                                $err = ERR_ID_NOT_EXIST;
                        } else {
                                $query  = "select id, name, surname";
                                $query .= "  from chars";
                                $query .= " where owner = $id";

                                $chars["count"] = query_db($query, $chars, true);
                        }
                }

                return $err;
        }
?>
Return current item: EverQuest Roster/Gallery