Restricting access to SubDomain

I’m using a php script where users can log in & out to access their profile and script features.
I’ve added a subdomain and would like to know how I could restrict access to the subdomain, so that only logged-in users can access it. Any guidance/suggestions are appreciated.

So you already have some script that can test whether a user is logged in or not.
Include the test throughout the subdomain, to deny user who are not logged in.

thanks for your reply. However, I didn’t write the script, so I’m not clear on “the test”, any clarification is appreciated

I haven’t even seen it, so I’m further in the dark.

1 Like

The better guide would be to do some research on how that script functions by viewing any documentations where the original script came from. That should solve some bits of it. If you’re still unsure, it doesn’t hurt to print out the entire $_SESSION variable to see what’s actually being stored. Once you do that and you figured out how user sessions are stored, then you can easily just use that index value and do a search using your text editor or IDE to look for that specific session name. After that, the rest should be easy. But most importantly, I would recommend viewing any documentations the author of that script has first. That’ll help a lot.

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.