Results 1 to 10 of 25
Thread: Cpanel login from website form
- 05-10-2003, 12:55 PM #1phi Guest
How do I login directly to cpanel from a website? using a form instead of the username/password popup prompt.
- 05-10-2003, 01:57 PM #2matt2kjones Guest
thats a tough question
but u could probably find out by asking the cpanel team these two questions
what page the form data is sent to
and the names of the username and password variables
find out that, and i can happily make u a form if you are unsure on how to do so
- 05-10-2003, 05:59 PM #3kk Guest
Here you go, the only thing you need to change is yourserver.com:
<script
language="javascript">
<!-- This version: Hostroute.com -->
<!-- Based on FTP log in by: Reinout Verkerk -->
<!-- Web Site: http://www.hostroute.com/script_htaccess.html -->
<!-- Begin
function Login(form) {
var username = form.username.value;
var password = form.password.value;
var server = form.server.value;
if (username && password && server) {
var htsite = "http://" + username + ":" + password + "@" + server;
window.location = htsite;
}
else {
alert("Please enter your username and password.");
}
}
// End -->
</script></p>
<form name="login">
<input type="hidden" name="server"
value="yourserver.com/cpanel"><table
border="0" cellspacing="1"
width="250" bordercolor="#000080">
<tr>
<td><font size="2"
face="Verdana">Username:</font></td>
<td><font size="2"
face="Verdana"><input
type="text" size="10"
name="username"> </font></td>
</tr>
<tr>
<td><font size="2"
face="Verdana">Password:</font></td>
<td><font size="2"
face="Verdana"><input
type="password" size="10"
name="password"> </font></td>
</tr>
<tr>
<td align="center"
colspan="2"><font size="2"
face="Verdana"><input
type="button" name="button"
value="Login!"
onclick="Login(this.form)"> </font></td>
</tr>
</table>
</form>
- 05-12-2003, 10:47 PM #4northwind Guest
This is pretty useful to know. =)
- 05-13-2003, 11:11 AM #5phi Guest
thanks for the replies. What if I need to specify more than one server as some accounts are on one and some on another? Also, can an image be used instead of the submit button and yet work with the onClick? I tried something similar but the image would not work as a submission tool.
- 05-13-2003, 12:48 PM #6kk Guest
Changing the submit button should be simple enough, just check a html site. Not sure about the multiple serevr login though, you'll need to write a php script that interacts with your client management system for that to work.
- 05-13-2003, 12:49 PM #7kk Guest
Changing the submit button should be simple enough, just check a html site. Not sure about the multiple serevr login though, you'll need to write a php script that interacts with your client management system for that to work.
- 05-13-2003, 09:49 PM #8phi Guest
I'm using this tag:
<input name="submit" type="image" id="submit" src="images/a_25.jpg" alt="Login" border="0">
and this hacked code I found on WHT for multiple servers:
But the submission doesn't seem to work with the image submit :huh:===== cpanellogin.html ==========
<html>
<head>
<title>cPanel Login</title>
</head>
<body>
<form method="post" action="cpanel.php">
Domain Name: www.<input type="text" name="yourdomain" size='20'><br>
Username: <input type="text" name="user" size='10'><br>
Password: <input type="password" name="pass" size='10'><br>
<input type="submit" name="submit" value="Login!">
</form>
</body>
</html>
==================================
===== cpanel.php ============
<?
if ($_POST["submit"]) {
if ((!$_POST["user"]) || (!$_POST["pass"])) {
echo("Please complete all fields.");
}
else {
header("Location: http://".$_POST["user"].":".$_POST["pass"]."@$yourdomain:2082");
}
}
?>
==========================
- 05-14-2003, 09:56 AM #9
Addict
- Join Date
- Feb 2003
- Location
- Virginia
- Posts
- 426
Multiple servers wouldn't be hard. The only thing you would need to do is create a dropdown menu with all your server names listed in it. When the user goes to login, they enter their username, password, and select which server they are on. Therefore the server variable gets set by the dropdown menu.
Or you can do it your way (since it's probably easier for them to remember their own domain. But it's all up to you how you want to do it.
Also, you should force the secure server.Brian Pauley
:: Harbor Networks ::
http://www.harbornetworks.net
:: SoundSource - Your Online Pro Audio Online Web Resource. ::
http://www.soundsource.info
- 05-14-2003, 12:13 PM #10phi Guest
The multiple server works. Now the only thing is that it doesn't function with the image as a submit tool instead of a normal button.



LinkBack URL
About LinkBacks




Reply With Quote






Bookmarks