login page into my website

Hey,

If you want to make things easier, you can change the alias for the DirectAdmin redirect to something like cpanel. For example, www.mydomain.com/cpanel/. If you want to do that, you can change it in the server's main httpd.conf file. Just another little tip you might find useful. :)

Just a question to ask why you would want to use "cpanel" for DirectAdmin... I mean, using the name of another control panel to redirect to DirectAdmin...

David
 
Guess it's just me....but if I hosted zerobeat.net with avidnetwork, why wouldn't I simply log on to my own control panel at zerobeat.net, since I know my own user name and password?
Because if you're using a secure login (we, and lots of others, do) you don't want your clients to get name mismatch errors, especially with IE7 and above, or Firefox3 or above, which have much sterner warnings than we're used to, so you really want them to go to your hostname and buy a Cert for your hostname.

At least that's what we want ;).

Jeff
 
You can also tell your customers to use www.mydomain.com/config/ and it will automatically redirect to www.mydomain.com:2222/. Then, your customers never have to worry about whether they remember the port number. This is how I set it up on my welcome e-mail templates.
Jeremy, see my previous post in this thread. using /config will also cause a name mismatch error in the Certificate as the domain name is rewritten to the IP#.

Jeff
 
It seems like everybody is talking about it but nobody actually has any script to do this correctly. I propose that I post the code I just wrote and give it to the community in exchange for people fixing possible bugs or add-ons and posting it here in this thread so other people may benefit.

I know I am like other programmers so my code will probably not be bug-free and this particular piece of code is untested so if some brave soul would take the first crack at it and post the findings... who knows maybe we'll have a descent login script for everyone to use.

Code:
<?php

// Setup
$securelogin = true;
$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>

Hope this helps someone on their way :)

Regards,
 
Last edited:
It seems like everybody is talking about it but nobody actually has any script to do this correctly. I propose that I post the code I just wrote and give it to the community in exchange for people fixing possible bugs or add-ons and posting it here in this thread so other people may benefit.

Thanks

I installed in the mydomain.com/public_html/login.php

Logged into it and entered a real user, name, password, domain

Username smedley
Password warped
domain mytest.com

The script returned
The requested URL /http//mytest.com:2222/CMD_LOGIN was not found on this server.

I changed secure from true to false, since when it was set to true I got an error.

Hope this helps.
 
I missed the : after http

Yes the script works with this correction:

if ( $securelogin ) {
$protocol = "https:";
} else {
$protocol = "http:";
}

This script would be very handy to log in to all the places where one has accounts that are not on a DA server....you'd simply have to rewrite it in such a way that of the port value was null, then one would not be logging in on a port....

I must have well over 50 accounts in various places that don;t make use of a port call.

But at my advanced age, it's easier to bookmark them and let the browser remember the values.
 
Yes the script works with this correction:

if ( $securelogin ) {
$protocol = "https:";
} else {
$protocol = "http:";
}

That is what happens when you write code at 1:25 am :)

This script would be very handy to log in to all the places where one has accounts that are not on a DA server....you'd simply have to rewrite it in such a way that of the port value was null, then one would not be logging in on a port....

Why not just enter 80 or 443 in the port number (the default for HTTP and HTTPS respectively)

I must have well over 50 accounts in various places that don;t make use of a port call.

But at my advanced age, it's easier to bookmark them and let the browser remember the values.

We're all 1 day older that we were yesterday :) I don't remember account details anymore, too many and require frequent password changes....

Regards,
 
funny I had to take the : out

Ie

if ( $securelogin ) {
$protocol = "https";
} else {
$protocol = "http";
}

for it to work or you get http:://name.com:2222

Works well with IE but will not work with firefox all this in false for secure.
 
Back
Top