with multiple da servers, how to have one cp login ?

lkbryant

Verified User
Joined
Aug 16, 2005
Messages
283
Hi

I have multiple DA servers and I need a way I can just give out one url to the control panel. And if he logs in from there, it should log him into whichever DA server the account is located?

I would like to have cp.myhostingcompany.com be the single point of entry for all my users that are spread across multiple DA servers using the "Multi Server Setup".

Is something like this already there for DA? perhaps i must be overlooking something?
 
Wouldn't it just be easier to create sub-domains for each of your customers and point that sub-domain to the IP address associated with correct hosting server??

Example: cp.yourcustomersdomain.com

So that means each customer can login to the correct hosting server and they use their own domain name to do it!
 
Ofcourse I can do it that way but the thing is I want in my website to show a link to 'login to your cpanel' and take you to the main central control panel login page so they can always remember where to go to login.

This is because there are many customers who just try testing first with their dedicated ip and for them they will not memorize their ip address so they always have hard time knowing where to go to login to the control panel.
 
I have a database of customers with their respective servers listed for their record. I have one login page that posts to a script that then searches the database to find which server they are on and then automatically logs them into their server.

You have to have a database or at least a list of usernames and servers.

Take the username they input match it up with their server.

Redirect to a DA login form on the main server with the username and password they entered already filled out and the post action filled out with the server url.

Use a javascript to automatically submit the form when the page loads.

I hope I made sense. I think it was easier for me to do it for myself than to tell you how to do it.
 
You really don't need that list; you can have the user enter his domain name, username, and password...

And then use domain name as the machine on which to login; DirectAdmin can even be set to redirect to https at the specific servername if you use a link to http at the domain name. That way you can have a secure login, a secure Certificate, and not get a name-mismatch warning.

Jeff
 
you can have the user enter his domain name

That is true too. I already maintain a list for accounting purposes.

And then use domain name as the machine on which to login

How do you get it to post to the domain name that they entered? JavaScript? Or am I not following you?
 
I didn't say you don't need a script; I said you don't need a table.

JavaScript would work.

Jeff
 
Just wanted to verify that I was thinking the same thing you were.
 
You really don't need that list; you can have the user enter his domain name, username, and password...

This came about from another thread....it works on a single server....and it would be nice if someone hacked it up to allow the user select the control panel or webmail.


Cut Here------------------------------------------------------------------
<?php

// Setup
$securelogin = false;
$loginport = "2222";
$logouturl = "http://www.example.com/usefulinfo.php";
$loginfail = "http://www.example.com/failedlogin.php";

// Process login
if (isset($_POST["username"])) {
$username = $_POST["username"];
$password = $_POST["password"];
$domain = $_POST["domain"];

if ( $securelogin ) {
$protocol = "https:";
} else {
$protocol = "http:";
}
$url = $protocol."//".$domain.":".$loginport."/CMD_LOGIN";
$referer = "/";

// This form is used to send the login information to DirectAdmin
?>

<form id='processlogin' name='processlogin' method='post' action='<?php echo $url; ?>'>
<input type='hidden' name='username' value="<?php echo $username; ?>">
<input type='hidden' name='password' value="<?php echo $password; ?>">
<input type='hidden' name='referer' value="<?php echo $referer; ?>">
<input name="FAIL_URL" type="hidden" value="<?php echo $loginfail; ?>">
<input name="LOGOUT_URL" type="hidden" value="<?php echo $logouturl; ?>">
</form>

<script type='text/javascript' language='javascript'>
window.document.getElementById('processlogin').submit();
</script>
<?php
}


// Login form that is displayed on your page.

?>

<table>
<form action="" method="POST" name="loginform">
<tr><td align=right>Username:</td><td><input type=text name=username></td></tr>
<tr><td align=right>Password:</td><td><input type=password name=password></td></tr>
<tr><td align=right>Domain name:</td><td><input type=text name=domain></td></tr>
<tr><td align=right colspan=2><input type=submit value='Login'></td></tr>
</form>
</table>

Cut here -------------------------------------------------------------
 
Here you go. This is without any special formatting. Wanted to keep it simple so people could read it. Took me about 20 minutes and I barely know any JavaScript. I have never written any from scratch.

This also assumes that the user has a domain that is actually hosted on the DirectAdmin server he wants to login to. If he doesn't (domain expired, new user who has not added a domain yet) then it won't work.


Code:
<html>
<head>        

<script type="text/javascript">                    
function submitForm() {
        this.action = "http://" + this.theSite.value + ":2222/CMD_LOGIN";
}

window.onload = function() {
        document.form.onsubmit = submitForm;
}
</script>
</head>        

<body bgcolor="#ffffff">        
<form id="form" action="" method="post" name="form">                
Website URL: <input type="text" name="theSite"><br>                                                     
Username: <input type="text" name="username"><br>                                     
Password: <input type="password" name="password"><br>                                     
<input type="submit" name="submit" value="Login">                           
<input type=hidden name=referer value="/">
</form>                
</body>        
</html>
 
Last edited:
Back
Top