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

        function read_events(&$event, $sort1, $sort2, $sort3) {
                $query  = "select e.id, e.name, e.zone, e.date, z.zid, z.zname";
                $query .= "  from events as e";
                $query .= "  left join zones as z on z.zid = e.zone";
                $query .= " order by $sort1 " . ($sort1 == "e.name" ? "asc" : ($sort1 == "z.zname" ? "asc" : ($sort1 == "e.date" ? "asc" : "asc")));
                $query .= " , $sort2 " . ($sort2 == "e.name" ? "asc" : ($sort2 == "z.zname" ? "asc" : ($sort2 == "e.date" ? "asc" : "asc")));
                $query .= " , $sort3 " . ($sort3 == "e.name" ? "asc" : ($sort3 == "z.zname" ? "asc" : ($sort3 == "e.date" ? "asc" : "asc")));

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

        function read_event($id, &$event) {
                if (!$id) {
                        $err = ERR_ID_BLANK;
                } elseif (eregi("[^[:digit:]]", $id)) {
                        $err = ERR_ID_INVALID;
                } else {
                       $query  = "select e.*, z.*";
                       $query .= "  from events as e";
                       $query .= "  left join zones as z on z.zid = e.zone";
                       $query .= " where e.id = $id";

                        query_db($query, $event);

                }

                return $err;
        }

        function read_pchars($id, &$pchars, &$temp) {
                global $SESSION;
                if (!$id) {
                        $err = ERR_ID_BLANK;
                } elseif (eregi("[^[:digit:]]", $id)) {
                        $err = ERR_ID_INVALID;
                } else {

                       $query  = "select owner";
                       $query .= "  from eventreg";
                       $query .= " where eid = $id";

                       query_db($query, $temp);

                       $query  = "select id, name, surname, owner, level";
                       $query .= "  from chars";
                       $query .= " where owner = " . $SESSION["uid"] . "";
                       $query .= " order by level DESC";

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

                }

                return $err;
        }

        function read_eventreg($id, &$eventreg, &$temp) {
                global $SESSION;
                if (!$id) {
                        $err = ERR_ID_BLANK;
                } elseif (eregi("[^[:digit:]]", $id)) {
                        $err = ERR_ID_INVALID;
                } else {
                        if ($SESSION["uid"]) {
                        $userid = $SESSION["uid"];
                        $query  = "select owner";
                        $query .= "  from eventreg";
                        $query .= " where eid = $id and owner = $userid";

                        query_db($query, $temp);
                        }
                       $query  = "select e.*, c.*";
                       $query .= "  from eventreg as e";
                       $query .= "  left join chars as c on c.id = e.userchar";
                       $query .= " where e.eid = $id";

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

                }

                return $err;
        }

        function read_guests($id, &$guests) {
                if (!$id) {
                        $err = ERR_ID_BLANK;
                } elseif (eregi("[^[:digit:]]", $id)) {
                        $err = ERR_ID_INVALID;
                } else {
                       $query  = "select *";
                       $query .= "  from eventguest";
                       $query .= " where eid = $id";

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

                }

                return $err;
        }

?>
Return current item: EverQuest Roster/Gallery