Jump to content

Home Page Multiple Logins


bedot

Recommended Posts

Currently on my "home" page i have a login for the client area, I would like to have a drop down box which you can select webmail, cpanel, admin and client area. Then have 1 login for them all...

 

I have started cloding a solution but getting stuck with changing the variable using the drop down box anyone care to look over it

 

<?php
echo "<select size='1' name='login' onchange='{set variable here}'>";
echo "<option value='cpanel'>cpanel</option>";
echo "<option value='webmail'>webmail</option>";
echo "<option value='clientarea'>clientarea</option>";
echo "<option value='adminarea'>adminarea</option>";
echo "</select>";

$login_type="{set variable}";

if ($login_type=="cpanel")
{
echo "<form method='post' action='http://www.bedot.net:2082/login/' method='post' target='_self'>";
echo "Username: <input type='text' name='user'>
";
echo "Password: <input type='password' name='pass'>
";
echo "<input type='submit' value='Login'>"; 
echo "</form>"; 
}
elseif ($login_type=="webmail")
{
echo "<form method='post' action='http://www.bedot.net:2095/login/' method='post' target='_self'>";
echo "Username: <input type='text' name='user'>
";
echo "Password: <input type='password' name='pass'>
";
echo "<input type='submit' value='Login'>"; 
echo "</form>"; 
}
elseif ($login_type=="clientarea")
{
echo "<form method='post' action='http://www.bedot.net/dologin.php?goto=clientarea'>";
echo "Username: <input type='text' name='Username'>
";
echo "Password: <input type='password' name='Password'>
";
echo "<input type='submit' value='Login'>"; 
echo "</form>"; 
}
elseif ($login_type=="adminarea")
{
echo "<form method='post' action='http://www.bedot.net/admin/dologin.php?'>";
echo "Username: <input type='text' name='Username'>
";
echo "Password: <input type='password' name='Password'>
";
echo "<input type='submit' value='Login'>"; 
echo "</form>"; 
}
?>

Link to comment
Share on other sites

Here, try this...

 


<script language="javascript">

function button_login_click() {

var objModuleForm = document.forms.module_login;

if (objModuleForm.login_select_destionation.options[objModuleForm.login_select_destionation.selectedIndex].value == "whmcs") {
    objModuleForm.action = "https://www.yourdomain.com/YOURWHMCS/dologin.php?goto=clientarea";
	objModuleForm.submit();
} else if (objModuleForm.login_select_destionation.options[objModuleForm.login_select_destionation.selectedIndex].value == "webmail") {
    objModuleForm.action = "http://www.yourdomain.com:2095/login/";
	objModuleForm.submit();
} else if (objModuleForm.login_select_destionation.options[objModuleForm.login_select_destionation.selectedIndex].value == "cpanel") {
    objModuleForm.action = "http://www.yourdomain.com:2092/login/";
	objModuleForm.submit();
} else {
    alert("Please choose a destination to log into.")
	objModuleForm.login_select_destionation.focus();
}
}
</script>
<form method="post" action="https://www.yourdomain.com/YOURWHMCS/dologin.php?goto=clientarea" name="module_login">
<select class="pulldown" id="login_select_destionation">
	<option value="whmcs" selected>WHMCS</option>
               <option value="cpanel">cPanel</option>
	<option value="webmail">Web Mail</option>
</select>


Username: <input name="username" type="text" class="forms" style="width: 100px;">

Password: <input name="password" type="password" class="forms" style="width: 100px;">

[url="javascript: button_login_click();"]Login[/url]

</form>

 

Dont forget to change yourdomain.com to whatever your domain is and to change YOURWHMCS to whatever your WHMCS directory is.

 

This changes the forms destination before submitting it if the user makes a selection from the drop down. You should be able to easily add any other options you need and change it to match your look and feel. Hope that helps!

Link to comment
Share on other sites

This is nice. I was thinking of doing something like that for my main page. Thank you for posting this. I'll try that. :)

 

Question: I have 5 different servers (so far... :D ). How do I change cPanel and webmail to the right server for each client? I was thinking of something like: cPanel Server 1, cPanel Server 2 and so on. But the dropdown will eventually get too long as I add more servers. What's the best way to do it?

 

I'm no programmer, so please bare with me. :oops:

 

Tks in advance. :)

Link to comment
Share on other sites

This is nice. I was thinking of doing something like that for my main page. Thank you for posting this. I'll try that. :)

 

Question: I have 5 different servers (so far... :D ). How do I change cPanel and webmail to the right server for each client? I was thinking of something like: cPanel Server 1, cPanel Server 2 and so on. But the dropdown will eventually get too long as I add more servers. What's the best way to do it?

 

I'm no programmer, so please bare with me. :oops:

 

Tks in advance. :)

 

The best way is to not have that form if you have multiple servers. =P

 

Id recommend just having the user login to whmcs, then setup your theme to be a little more friendly for logging into cpanel directly from it. This will also make things a lot easier on clients that have multiple accounts on multiple servers.

Link to comment
Share on other sites

You could write some PHP code to do what you want to accomplish. Have that login form post to an intermitant page which will then connect to the WHMCS database and see what server the user is on from the username, then build a form and automatically submit it to log them in to the proper server.

 

This is something that I had thought about doing, but we came to the conclusion that some of our customers have well over one hosting account, and they really have expressed that they like only having to remember their email addresses in order to access all of their accounts. My solution was to have a Quick Launch link on every single page after one of our customers logs into WHMCS. THe quick launch is just a drop down menu of all their hosting accounts and when they click the go button, it takes them to the control panel for the respected account. This is not complete yet however and required modifications to WHMCS, templates, and new smarty plugins to accomplish.

 

Another option that would make the above concern void is to have that login form go to an intermitant page when cPanel is selected, but have them use their email address and password they use for WHMCS, process the WHMCS login in your own code, then if only one hosting account is present, automatically spit the customer into the cPanel, or, if they have multiple accounts, display a list of available accounts and offer a one click login from there.

 

I am just trying to give some advice on directions you could consider. I will try and write up some code since you are not a programmer if I can find the time. But the above suggestions are a little more complex and may involve some modifications to WHMCS or the addition of Smarty Plugins and template changes to accomodate the functionality.

Link to comment
Share on other sites

  • 1 month later...

I'm sorry, imaginit, I just came across your reply today, somehow I didn't get an email alert for it.

Thank you for your offer anyway, it was very nice of you. :)

 

I just found a little and simple code that does exactly what I need, not difficult at all. It works like that:

 

The form:

 

<form action="cpanel.php" method="post">
Username: <input type="text" name="user">

Password: <input type="password" name="pass">

<select name="host">
   <option value="00.0.000.000">Server 1</option>
   <option value="00.0.000.000">Server 2</option>
   <option value="00.0.000.000">Server 3</option>
   <option value="00.0.000.000">Server 4</option>
 </select>
<input type="submit" name="submit" value="Login!">
</form>

 

 

The script (save it as cpanel.php):

 

<?php
// cPanel Login
if ($_POST["submit"]) {
if ((!$_POST["user"]) || (!$_POST["pass"])) {
echo("Please complete all fields.");
}
else {
   header("Location: http://".$_POST["user"].":".$_POST["pass"]."@".$_POST["host"].":2082");}
}  
?>

 

 

And it can be done for other services as well, just need to save the script with the name of the service (webmail.php, whm.php and so on) and change the script name in the form. Then change the port number in the script:

 

Standard WHM - 2086

Secure WHM - 2087

Standard Webmail - 2095

Secure Webmail - 2096

 

That's it! Works like a charm! For my needs, at least... Hope it can help someone.

 

 

EDIT: It works beautifully on Firefox but it DOES NOT work at all in IE6! :(

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated