Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

Using ssi to allow only admins access some php file?

Aloittaja MarkoKg, tammikuu 28, 2014, 01:48:41 IP

« edellinen - seuraava »

MarkoKg

Hello there,

I have a php file on my server and I would like only logged in admins from forum to be able to access that file. Can I somehow do it using ssi or something?

Thanks! :)

Arantor

Load SSI.php, then after that line add:
isAllowedTo('admin_forum');

Do that before anything else on the page.
Holder of controversial views, all of which my own.


kat

Q: Could you do that using file permissions? If it was readable only by the owner, would that work?

This assumes, of course, that there's one admin and they're the site owner.

Arantor

Holder of controversial views, all of which my own.



Deprecated

Cumber's suggestion looks like the perfect and super simple suggestion. I'm not aware of any SSI use other than by admins, might even be worth making that change to SSI permanent.

For my education, if non-admins ever use SSI could you give me an example?

Arantor

Apart from, say, the entire purpose for which the file was designed. SSI = Simple Site Integration. (The 'original' meaning of Server Side Includes primarily relates to SHTML and not PHP)

Like, for example, providing a login form to external sites. Or pulling board news on to a front page outside the forum. Or indeed any kind of integration without using a portal.
Holder of controversial views, all of which my own.


Deprecated

Thank you for the info. My chief use of SSI has been in its application to mod packages. I've never been a portal kind of person.

MarkoKg


Advertisement: