开发者

How to prevent code from running on certain pages?

I'm programming in PHP and having some issues with having both a login bar (which appears in the left column) and a signup form both work on the same page (this is due to form tokens; a problem for another day). I therefore wish to pr开发者_开发技巧event the login bar from showing up on the signup page, and so all I need is a conditional that prevents a specific file from being included if I'm on that page.

What is the best way of going about this?

Thanks,

Paragon


Try this quick and dirty code:

<?php
$strScriptName = $_SERVER["SCRIPT_NAME"];
$arrParts = explode('/', $strScriptName);
$strFileName = $arrParts[count($arrParts) - 1];

if ($strFileName != 'signup.php') {

    // Code for your login bar here

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜