Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: tareko on September 21, 2021, 12:46:31 PM

Title: getting admin url
Post by: tareko on September 21, 2021, 12:46:31 PM
i am trying my hand at coding and i need some help. i want to grab the url of admin panel anytime someone clicks it and perform an action. will this code be right?

if (isset($_GET['sa']['admin'])
bla bla my action
Title: Re: getting admin url
Post by: Diego Andrés on September 21, 2021, 01:01:52 PM
Would be more like
if (isset($_GET['action']) && $_GET['action'] == 'admin')I think using $_REQUEST would be a valid choice too since it's within smf

But yes you're almost in the right path.
Although if you want it "to do something" when they click on it that's a different story, would probably use onclick maybe and you don't need to do any of that?
Title: Re: getting admin url
Post by: Kindred on September 21, 2021, 01:02:26 PM
no....  sa is the special action (in the url sa=...)

admin is the normal action (in the url action=...)


what exactly are you trying to accomplish?
Title: Re: getting admin url
Post by: tareko on September 21, 2021, 01:23:48 PM
thanx both. what i want to do is log all attempts made to load the acp but it looks like i am way over my head with this.
Title: Re: getting admin url
Post by: Kindred on September 21, 2021, 01:40:39 PM
Oh, well, that's easy.

Add a write to the log at the start of the admin template  -- probably about where the menu is called.

you don't even need any conditionals, since the admin menu will only be loaded if the user has already passed all the security checks.

or, are you trying to log even failed attempts?
(you are aware that failed attempts to get into the admin are logged in the error log, right?)
Title: Re: getting admin url
Post by: Arantor on September 21, 2021, 02:09:11 PM
Menu is called at the start of every call to action=admin, and more often if you have one of those mods that drags the admin menu to every page.

Better question, what are you hoping to achieve? If you have people trying to get in, this is logged; if you have admins you don't trust, they shouldn't be admins in the first place.
Title: Re: getting admin url
Post by: tareko on September 25, 2021, 11:30:55 AM
Quote from: Kindred on September 21, 2021, 01:40:39 PMOh, well, that's easy.

Add a write to the log at the start of the admin template  -- probably about where the menu is called.

you don't even need any conditionals, since the admin menu will only be loaded if the user has already passed all the security checks.

or, are you trying to log even failed attempts?
(you are aware that failed attempts to get into the admin are logged in the error log, right?)

i was not aware that failed attempts to acp were logged. thanx man.

Quote from: Arantor on September 21, 2021, 02:09:11 PMMenu is called at the start of every call to action=admin, and more often if you have one of those mods that drags the admin menu to every page.

Better question, what are you hoping to achieve? If you have people trying to get in, this is logged; if you have admins you don't trust, they shouldn't be admins in the first place.

it is not my other admins that i dont trust arantor but i wanted to see who has logged in my admin panel and who was trying to but failed.
Title: Re: getting admin url
Post by: Arantor on September 25, 2021, 11:40:18 AM
Why? What do you possibly think you will get from this? I suspect you think you're going to get a list of names, that you're probably going to ban, and if you don't get a list of names you're going to accuse any log of being wrong, because you're looking for a scapegoat for something.
Title: Re: getting admin url
Post by: Aleksi "Lex" Kilpinen on September 25, 2021, 11:40:58 AM
Well, the Admin link is visible and accessible only for those who are actually allowed access to the admin panel - so separately following clicks to that link wouldn't really do anything meaningful for you.
Title: Re: getting admin url
Post by: tareko on September 28, 2021, 04:33:28 PM
Quote from: Arantor on September 25, 2021, 11:40:18 AMWhy? What do you possibly think you will get from this? I suspect you think you're going to get a list of names, that you're probably going to ban, and if you don't get a list of names you're going to accuse any log of being wrong, because you're looking for a scapegoat for something.

dude what i want to get from this is none of your business. keep your thoughts and assumptions to yourself.

it is useless asking for help here as all you get are smart ass remarks and accusations.
Title: Re: getting admin url
Post by: Steve on September 28, 2021, 04:46:12 PM
What you're given is advice. Take it or leave it. Do not disparage those that are trying to help you.

Locking.