WEll basically title says it all i need something that i can put on my menu bar but because it is global i want it so if the url has /admincp in it it include_once("menubar.php"); COuld someone help please thanks
try this: if (eregi("admincp",$_SERVER[REQUEST_URI])) include_once("menubar.php"); else { .....///ur code } PHP:
First, eregi() is a deprecated function and should not be used... ever again. Second, if I added the word "admincp" to the query string like this: example.com/index.php?admincp ... it would still include the file.
<?php if (preg_match('~^/admincp$~', $_SERVER['REQUEST_URI'])) { include_once("menubar.php"); } ?> PHP: That would be placed within /admincp/index.php
if (strpos($_SERVER['REQUEST_URL'], '/admincp') === 0) include 'menubar.php'; PHP: Although, to be honest, I'd do it differently. I'd define a constant within the admin area, and then check for that instead. if (defined('IN_ADMINCP')) include 'menubar.php'; PHP: