diff --git a/html/includes/graphs/graph.inc.php b/html/includes/graphs/graph.inc.php
index 7e609b6ed9..c0a6906e85 100644
--- a/html/includes/graphs/graph.inc.php
+++ b/html/includes/graphs/graph.inc.php
@@ -38,34 +38,11 @@ $graphfile = $config['temp_dir'] . "/" . strgen() . ".png";
$type = $graphtype['type'];
$subtype = $graphtype['subtype'];
-if (is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php"))
-{
+$auth = is_client_authorized($_SERVER['REMOTE_ADDR']);
+include($config['install_dir'] . "/html/includes/graphs/$type/auth.inc.php");
- if (isset($config['allow_unauth_graphs']) && $config['allow_unauth_graphs'])
- {
- $auth = "1"; // hardcode auth for all with config function
- }
-
- if (isset($config['allow_unauth_graphs_cidr']) && count($config['allow_unauth_graphs_cidr']) > 0)
- {
- foreach ($config['allow_unauth_graphs_cidr'] as $range)
- {
- if (Net_IPv4::ipInNetwork($_SERVER['REMOTE_ADDR'], $range))
- {
- $auth = "1";
- if ($debug) { echo("matched $range"); }
- break;
- }
- }
- }
-
- include($config['install_dir'] . "/html/includes/graphs/$type/auth.inc.php");
-
- if (isset($auth) && $auth)
- {
+if ($auth && is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php")) {
include($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php");
- }
-
}
else
{