• Welcome to Simple Machines Community Forum. Please login or sign up.
January 26, 2022, 05:40:21 PM

News:

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


getting admin url

Started by tareko, September 21, 2021, 12:46:31 PM

Previous topic - Next topic

tareko

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

Diego Andrés

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?

SMF Tricks - Free & Premium Responsive Themes for SMF.

Kindred

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?
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

tareko

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.

Kindred

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?)
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

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.
No good deed goes unpunished
All helpful urges should be circumvented

tareko

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.

Arantor

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.
No good deed goes unpunished
All helpful urges should be circumvented

Aleksi "Lex" Kilpinen

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.
A Finnish Project Manager (Support Specialist)
 Happily running multiple SMF 2.x installations.
  Fooling around with i7-10700 @ 2,90GHz-4.80GHz / 16Gb / RTX-2070 Super / 3840x2160 / Win 10 x64


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

tareko

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.

Steve

What you're given is advice. Take it or leave it. Do not disparage those that are trying to help you.

Locking.
Please do not PM me for support.

Advertisement: