0) { if (in_array(date("w"), $agit_dates)) { //checks if it is a WoE day $agit_index = array_search(date("w"), $agit_dates); //index of day -> corresponds to time index $agit_starttime = $agit_starts[$agit_index]; if (!$agit_starttime) { $agit_starttime = $agit_starts[count($agit_starts)-1]; } $agit_endtime = $agit_ends[$agit_index]; if (!$agit_endtime) { $agit_endtime = $agit_ends[count($agit_ends)-1]; } if (($time_string > $agit_starttime) && ($time_string < $agit_endtime)) { redir("index.php", $lang['onlineguildwar']); } } } //Who's Online if (!$GET_map) { if ($CONFIG_server_type == 0) { $query = sprintf(SHOW_ONLINE, "", ONLINE_WITH_GM, ""); $query2 = sprintf(SHOW_ONLINE, "", ONLINE_WITHOUT_GM, ""); } else { if ($STORED_level > 2) { $query = sprintf(SHOW_ONLINE, SHOW_POSITION, ONLINE_WITH_GM, ""); $query2 = sprintf(SHOW_ONLINE, SHOW_POSITION, ONLINE_WITHOUT_GM, ""); } else { $query = sprintf(SHOW_ONLINE, "", ONLINE_WITH_GM, ""); $query2 = sprintf(SHOW_ONLINE, "", ONLINE_WITHOUT_GM, ""); } } EchoHead(80); echo " {$lang['onlineusers']} "; display_online($query, $query2); } else { EchoHead(80); echo " "; printf($lang['onlineusersmap'], $GET_map); echo " "; if (strlen($GET_map) > 15) { redir("index.php", $lang['onlineinvalid']); add_user_entry("Possible SQL injection attempt in whosonline.php"); } if ($STORED_level > 2) { $query = sprintf(SHOW_ONLINE, SHOW_POSITION, ONLINE_WITH_GM, sprintf(CONDITION_MAP, $GET_map)); $query2 = sprintf(SHOW_ONLINE, SHOW_POSITION, ONLINE_WITHOUT_GM, sprintf(CONDITION_MAP, $GET_map)); } else { $query = sprintf(SHOW_ONLINE, "", ONLINE_WITH_GM, sprintf(CONDITION_MAP, $GET_map)); $query2 = sprintf(SHOW_ONLINE, "", ONLINE_WITHOUT_GM, sprintf(CONDITION_MAP, $GET_map)); } display_online($query, $query2); } require 'footer.inc'; function display_online($input_query, $input_query2) { global $CONFIG_server_type, $STORED_level, $lang; $result[0] = execute_query($input_query, "whosonline.php"); $result[1] = execute_query($input_query2, "whosonline.php"); if ($result[0]->RowCount() == 0 && $result[1]->RowCount() == 0) { echo " None \n "; } else { if ($CONFIG_server_type == 0) { echo " AID Account Name Email Gender IP "; } else { echo " {$lang['onlinename']} {$lang['onlineclass']} {$lang['onlinebase']} {$lang['onlinejob']} "; if ($STORED_level > 2) { echo " {$lang['onlinex']} {$lang['onliney']} "; } echo " {$lang['onlinemap']} "; } for ($i = 0; $i < 2; $i++) { while ($line = $result[$i]->FetchRow()) { echo " "; foreach ($line as $display_index => $col_value) { if ($CONFIG_server_type == 0) { if ($display_index == 3) { $col_value = $col_value == 1? "Male" : "Female"; } elseif ($display_index == 4) { $col_value = convert_ip($col_value); } } else { if ($display_index == 0) { continue; } if (($display_index == 1) && ($STORED_level > 2) ) { $col_value = "{$line[1]}"; } elseif ($display_index == 2) { $col_value = determine_class($line[2]); } elseif ($display_index == 5 && $STORED_level <= 2) { $map_name = substr($line[5], 0, strlen($line[5]) - 4); $col_value = "{$line[5]}"; } elseif ($display_index == 7 && $STORED_level > 2) { $map_name = substr($line[7], 0, strlen($line[7]) - 4); $col_value = "{$line[7]}"; } } if ($i == 0) { echo " $col_value "; } else { echo "$col_value"; } } echo " "; } } } echo ""; } function convert_ip($input_long) { $hex = dechex($input_long); $length = strlen($hex); $add = 8 - $length; $full = ""; for ($i = 0; $i < $add; $i++) { $full .= "0"; } $full .= $hex; for ($i = 0; $i < 4; $i++) { $set[$i] = substr($full, $i * 2, 2); } return hexdec($set[3]) . "." . hexdec($set[2]) . "." . hexdec($set[1]) . "." . hexdec($set[0]); } ?>