View Full Version : external login and check for login status
jechilt
09-28-2004, 01:16 PM
not sure where to start but want to be able to provide a link inside our billing software to allow user to LOG IN to the DA panel. have not been able to find any examples of that. also, from the same billing software, we want to have a link to allow the user to change an email account password.
how hard is it to have a check to see if they are already logged into DA. if so, just pass to the change password link. if not, prompt for password before proceeding to password change page (api script i have seen in the forum).
any help would be super!
thanks!
fusionictnl
09-29-2004, 05:11 AM
You can use the API script or check $_SERVER['USER']
;)
jechilt
09-29-2004, 05:26 AM
any chance of getting an example? :o
fusionictnl
09-29-2004, 05:28 AM
if (!isset($_SERVER["USER"]) { kick to login }
else { do password change or something }
jechilt
09-30-2004, 02:11 AM
is there a better way to do an external login to the control panel than this?
The variables are being pulled from the billing system...
<? if (!isset($_SERVER["USER"]) {
echo
"<form action=http://www.$domain:2222/CMD_LOGIN method=post name=login>
<input type=hidden name=LOGOUT_URL value=$base>
<input name=username type=hidden value=$username>
<input name=password type=hidden value=$pass>
<a href=\"javascript:void(document.login.submit())\">http://www.$domain/config</a>" }
fusionictnl
09-30-2004, 02:29 AM
What do you mean ? Isn't it working on you site ?
jechilt
09-30-2004, 02:44 AM
unfortunately, I am a bit over my head on this...
What I am hoping for is to provide a link to the DA Control Panel. when the user clicks on the link, it will check to see if they are already authenticated. If so, it will pass them directly to the DA control panel. If not, then it will load the form page to login.
Also, when the user clicks to login, it forces a new window. How to get this to open in the same window?
My guess is I need something like this-
<<blah>> psuedo code cause not sure what to put
menu link:
[CODE]
<? if (!isset($_SERVER["USER"]) {
echo
"<form action=http://www.$domain:2222/CMD_LOGIN method=post name=login>
<input type=hidden name=LOGOUT_URL value=$base>
<input name=username type=hidden value=$username>
<input name=password type=hidden value=$pass>
<a href=\"java script:void(document.login.submit())\">http://www.$domain/config</a>" }
else
{ <<echo - open the control panel>>; }
?>
fusionictnl
09-30-2004, 03:00 AM
Originally posted by jechilt
<? if (!isset($_SERVER["USER"]) {
echo
"<form action=http://www.$domain:2222/CMD_LOGIN method=post name=login>
<input type=hidden name=LOGOUT_URL value=$base>
<input name=username type=hidden value=$username>
<input name=password type=hidden value=$pass>
<a href=\"java script:void(document.login.submit())\">http://www.$domain/config</a>"
die()
}
Header ("Location: http://domain:2222/") ;
?>
When you use the above file as checking page, and put a DIE in it. Put a Header (Location: ...) to fully redirect him to the CP.
It should work in the following way:
User get's to this page and if he isn't logged in get the login form else he is redirected to the CP.
This is what you want ? you could even just use only:
<?
Header ("Location: http://domain:2222/") ;
?>
As DA will check if he's logged in and present him with the default login page, but if you want to use you're own, you can use the first code of yours ;)
jechilt
09-30-2004, 04:02 AM
whew..... :)
I think the Locate is going to work great! Thanks...
got another question, probably just as simple...
I have multiple domains and IP addresses. I want to be able to have a generic change email password box on the main email page.
do you think this would work (i know the text is missing, I am looking for the form input being correct):
"<form action=http://www.mydomain:2222/CMD_CHANGE_EMAIL_PASSWORD method=post>
<input type=hidden name=redirect value=$base>
<input type=text name=email size=32>
<input type=password name=oldpassword size=32>
<input type=password name=password1 size=32>
<input type=password name=password2 size=32>
<input type=submit value="Change Password">
my thinking is the <<mydomain>> needs to be the user actual domain? if so, can we parse the email address and pass the domain url to a value for mydomain?
fusionictnl
09-30-2004, 04:14 AM
For this you can better use the DA API class and the DA API documentation.
I don't really know how this works. You can offcourse just look in the DA API documentation (http://www.directadmin.com/api.html)wich variables need to be posted to the CMD_PASSWORD_CHANGE :) without using the class :P
From the API docs:
http://www.directadmin.com/api.html#email
http://domain:2222/CMD_CHANGE_EMAIL_PASSWORD?email=..&oldpassword=..&password1=..&password2=..&redirect=http://...sucessfull.html
:)
Good luck ;)
jechilt
09-30-2004, 04:27 AM
thanks for the info. i will post again upon my success!!!
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.