开发者

PHP Include Error w/ CSS

开发者 https://www.devze.com 2022-12-14 21:49 出处:网络
I have having difficulties on this one page login.php.开发者_Python百科Because of the nature of the session, it does not allow a $page to be called.I included the header the same way I did on all othe

I have having difficulties on this one page login.php. 开发者_Python百科Because of the nature of the session, it does not allow a $page to be called. I included the header the same way I did on all other pages. The code highlighted between the ===== is my header included with $page defined for the < ul > so I can call a different class each page. But it's not working on the login page due to the sessionstart. I can get it to work fine on other pages.

If you have any ideas let me know.

<?php
session_start();


if ($_POST['username']) {



if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){

function headertop($page) {

    include('header.php');

}

headertop('login');


echo "<br /><br />SECURITY CODE ERROR... "; 




include('footer.php');

exit();
}


First thing first, stop validating POST without an isset() function, so it should look something like if (isset($_POST['key']) : etc.

Next, i suppose You're defining that function in each file ?

You screwed up the definition of it by defining the include to include('header.php'); and not the $page. Then why are U sending the $page parameter at all ? You call it then from header.php ? That's some lame code.

Anyway, what you need to do is a switch or many if-else-if-s in your code, based on the $_SERVER['QUERY_STRING'] or $_SERVER['REQUEST_URI'].

switch ( $_SERVER['PHP_SELF'] ) {
default:
case '/index.php':  
    $tab = 'homenav';               
    break;

case '/surf.php':   
    $tab = 'surfnav';               
    break;

case '/register.php':   
    $tab = 'registernav';                   
    break;

}

0

精彩评论

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