Call separate header.txt admin

Helpdesk for my helpdesk software

Moderator: mkoch227

steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Re: Call separate header.txt admin

Post by steve »

This may be a silly question, are you sure you are logging into an ADMIN account?
-Steve
D12Eminem989
Posts: 12
Joined: Fri Aug 10, 2012 12:28 pm

Re: Call separate header.txt admin

Post by D12Eminem989 »

Yes, it's the only account there is. :lol:
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Call separate header.txt admin

Post by Klemen »

Care to share your help desk URL so we can check situation live?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Re: Call separate header.txt admin

Post by steve »

I tired this and it did not work for me either.

Code: Select all

if (strpos(__FILE__, 'admin') !== false)
{
   include(HESK_PATH . 'header_admin.txt');
}
else
{
   include(HESK_PATH . 'header.txt');
}
So I used this instead and it worked.

Code: Select all

    if ($_SESSION['isadmin'])
    {
       include(HESK_PATH . 'header_admin.txt');
    }
    else
    {
       include(HESK_PATH . 'header.txt');
    }
-Steve
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Call separate header.txt admin

Post by Klemen »

I wouldn't recommend using $_SESSION as it is still set even if you browse customer pages.

Try this. If this doesn't work I must say I'm out of ideas lol:

Code: Select all

if (strpos($_SERVER['SCRIPT_FILENAME'], 'admin') !== false)
{
    include(HESK_PATH . 'header_admin.txt');
}
else
{
    include(HESK_PATH . 'header.txt');
}
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
D12Eminem989
Posts: 12
Joined: Fri Aug 10, 2012 12:28 pm

Re: Call separate header.txt admin

Post by D12Eminem989 »

Thanks for the help guys and Klemen, that last code you posted worked. Thanks a ton, it's much appreciated. :)

Is it possible for you to edit the footer.inc.php for me and include the above but a footer_admin.txt, then attach it here? I am not licensed so I can't edit it myself.

Thank you!
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Call separate header.txt admin

Post by Klemen »

Actually, I have an even better idea that doesn't require editing any files and will be compatible with updates!

Use original header.inc.php and files and paste THIS into header.txt:

Code: Select all

<?php
if (strpos($_SERVER['SCRIPT_FILENAME'], 'admin') !== false)
{
    include(HESK_PATH . 'header_admin.txt');
}
else
{
    include(HESK_PATH . 'header_customer.txt');
}
?>
User original footer.inc.php and paste THIS into footer.txt:

Code: Select all

<?php
if (strpos($_SERVER['SCRIPT_FILENAME'], 'admin') !== false)
{
    include(HESK_PATH . 'footer_admin.txt');
}
else
{
    include(HESK_PATH . 'footer_customer.txt');
}
?>
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
D12Eminem989
Posts: 12
Joined: Fri Aug 10, 2012 12:28 pm

Re: Call separate header.txt admin

Post by D12Eminem989 »

Thank you Klemen, that worked perfectly - much appreciated!
Post Reply