Click to See Complete Forum and Search --> : Another ? about my cPanel login script/form


L2 Studios
07-04-2005, 09:54 PM
OK here is the form

<form action="cplogin.php" method="post" target="blank">
<table align="center" cellspacing="0" cellpadding="1" height="98%" border="0">
<tr>
<td width="72" height="18"><span class="login_text"><font color="#1D3D66">Username:</font></span></td>
<td width="120"><input type="text" name="user" class="input" value="" style="width:120;height:18" /></td>
</tr>
<tr>
<td height="18"><span class="login_text"><font color="#1D3D66">Password:</font></span></td>
<td><input type="password" class="input" name="pass" value="" style="width:120;height:18" /></td>
</tr>
<tr>
<td height="18"><span class="login_text"><font color="#1D3D66">Domain:</font></span></td>
<td><input type="text" class="input" name="domain" value="" style="width:120;height:18" /></td>
</tr>
<tr>
<td height="18"><span class="login_text"><font color="#1D3D66">Options:</font></span></td>
<td><select name="port" class="input" style="width:120;height:18">
<option selected value="">&nbsp;</option>
<option value="2082">cPanel</option>
<option value="2095">Webmail</option>
</select></td>
</tr>
<tr>
<td height="24" colspan="2">
<input type="submit" name="login" value="Login" class="input" style="width:195;height:22" onMouseOut="blur(this);" /></td>
</tr>
</table>
</form>


Here is the cPlogin.php file

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Logging In ...</title>
<?php

# domain or ip (no http://)
$domain = $_POST['domain'];

if(!$_POST['login']) exit;

$user = $_POST['user'];
$pass = $_POST['pass'];
$port = $_POST['port'];

$port == '2083' || $port == '2096' ? $pre = 'https://' : $pre = 'http://';
$port == '2095' || $port == '2096' && !eregi('@', $user) ? $user = $user.'@'.$domain : $user = $user;

?>
<meta http-equiv="Content-Language" content="en" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<body onLoad="setTimeout('document.forms[0].submit();',10)">
<form action="<?php echo $pre.$domain.':'.$port.'/login/'; ?>" method="post">
<input type="hidden" name="user" value="<?php echo $user; ?>" />
<input type="hidden" name="pass" value="<?php echo $pass; ?>" />
</form>
</body>
</html>



Now, also built on the backend of my site I am going to be using phpCOIN (www.phpcoin.com) to help with the set up of accounts and billing. Naturally, phpCOIN has its own login system for client billing information... so to access that the user must enter a Username and Password....
Can someone here please help me to add this login information to this form and script, so that in the options drop down of the form, the user can just select "Billing"

From phpCOINs forums, I did ask this same question, and here is the response I received.

To login to phpCOIN, your form needs to get "username" and "password" then POST to /coin_includes/session_user.php (for clients)


Of course this is foreign to me... I do not know PHP.

So, is my request possible?

Thank you in advance....

Zach L.

SpectreReturns
07-04-2005, 10:25 PM
What exactly are you trying to accomplish? Using your own form instead of a provided one for login?

L2 Studios
07-04-2005, 10:49 PM
OK.. I am already currently using the above form..

It has a dropdown to allow the user to login to their cPanel or Webmail...

However, I have now (or am going) to start using phpCOIN to set up user accounts in my WHM, and to generate invoices, billing, etc. etc. So, naturally, phpCOIN requires clients (users) to register a username and password to place an order for web hosting and what not. So, naturally, they have a seperate login area to access their information the phpCOIN program storesin the db. Instead of having 2 login areas off of my main page, the one i posted above, and the one for their order/billing access..... I would like to add the order/billing in the form I posted above.

And, when asked on the phpCOIN forms, I got the above response of what needs to POST to the appropriate directory.....

thanks

Sheldon
07-05-2005, 12:32 AM
try

<form action="cplogin.php" method="post" target="blank">
<table align="center" cellspacing="0" cellpadding="1" height="98%" border="0">
<tr>
<td width="72" height="18"><span class="login_text"><font color="#1D3D66">Username:</font></span></td>
<td width="120"><input type="text" name="user" class="input" value="" style="width:120;height:18" /></td>
</tr>
<tr>
<td height="18"><span class="login_text"><font color="#1D3D66">Password:</font></span></td>
<td><input type="password" class="input" name="pass" value="" style="width:120;height:18" /></td>
</tr>
<tr>
<td height="18"><span class="login_text"><font color="#1D3D66">Domain:</font></span></td>
<td><input type="text" class="input" name="domain" value="" style="width:120;height:18" /></td>
</tr>
<tr>
<td height="18"><span class="login_text"><font color="#1D3D66">Options:</font></span></td>
<td><select name="port" class="input" style="width:120;height:18">
<option selected value="">&nbsp;</option>
<option value="2082">cPanel</option>
<option value="2095">Webmail</option>
<option value="/coin_includes/session_user.php">Billing</option>
</select></td>
</tr>
<tr>
<td height="24" colspan="2">
<input type="submit" name="login" value="Login" class="input" style="width:195;height:22" onMouseOut="blur(this);" /></td>
</tr>
</table>
</form>

and for cplogin



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Logging In ...</title>
<?php

# domain or ip (no http://)
$domain = $_POST['domain'];

if(!$_POST['login']) exit;

$user = $_POST['user'];
$pass = $_POST['pass'];
$port = $_POST['port'];

$port == '2083' || $port == '2096' ? $pre = 'https://' : $pre = 'http://';$port == '/coin_includes/session_user.php' ? $pre = 'http://';
$port == '2095' || $port == '2096' && !eregi('@', $user) ? $user = $user.'@'.$domain : $user = $user;

?>
<meta http-equiv="Content-Language" content="en" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<body onLoad="setTimeout('document.forms[0].submit();',10)">
<form action="<?php echo $pre.$domain.':'.$port.'/login/'; ?>" method="post">
<input type="hidden" name="user" value="<?php echo $user; ?>" />
<input type="hidden" name="pass" value="<?php echo $pass; ?>" />
</form>
</body>
</html>


Sheldon

L2 Studios
07-05-2005, 10:05 PM
Nope....

I get a

Parse error: parse error, unexpected ';' in /home/lazzeris/public_html/cplogin.php on line 16

Here is the phpfile with your suggested change.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Logging In ...</title>
<?php

# domain or ip (no http://)
$domain = 'MYDOMAIN.com';

if(!$_POST['login']) exit;

$user = $_POST['user'];
$pass = $_POST['pass'];
$port = $_POST['port'];

$port == '2083' || $port == '2096' ? $pre = 'https://' : $pre = 'http://';
$port == '/coin_includes/session_user.php' ? $pre = 'http://';
$port == '2095' || $port == '2096' && !eregi('@', $user) ? $user = $user.'@'.$domain : $user = $user;

?>
<meta http-equiv="Content-Language" content="en" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<body onLoad="setTimeout('document.forms[0].submit();',10)">
<form action="<?php echo $pre.$domain.':'.$port.'/login/'; ?>" method="post">
<input type="hidden" name="user" value="<?php echo $user; ?>" />
<input type="hidden" name="pass" value="<?php echo $pass; ?>" />
</form>
</body>
</html>


:confused:


zach

BeachSide
07-06-2005, 12:14 AM
y'all correct me if I'm wrong but don't you have to have the colon in the ternary operator?

Anyway this doesn't make sense to me...

$port == '2083' || $port == '2096' ? $pre = 'https://' : $pre = 'http://';

It should always evaluate to https:// no?

It is effectivly saying

if($port == '2083' || $port == '2096') {
$pre = 'https://';
} else {
$pre = 'http://';
}

Since there is no other choice (before he altered it) it should always evaluate to https://


Also I think shouldn't have that line Sheldon added where it is. It should be in the first line like this...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Logging In ...</title>
<?php

# domain or ip (no http://)
$domain = 'MYDOMAIN.com';

if(!$_POST['login']) exit;

$user = $_POST['user'];
$pass = $_POST['pass'];
$port = $_POST['port'];

$port == '2083' || $port == '2096' || $port == '/coin_includes/session_user.php' ? $pre = 'https://' : $pre = 'http://';
$port == '2095' || $port == '2096' && !eregi('@', $user) ? $user = $user.'@'.$domain : $user = $user;

?>
<meta http-equiv="Content-Language" content="en" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<body onLoad="setTimeout('document.forms[0].submit();',10)">
<form action="<?php echo $pre.$domain.':'.$port.'/login/'; ?>" method="post">
<input type="hidden" name="user" value="<?php echo $user; ?>" />
<input type="hidden" name="pass" value="<?php echo $pass; ?>" />
</form>
</body>
</html>

L2 Studios
07-06-2005, 10:17 PM
OK, that did not work neither, however it got a little farther,

This time I get an error box that states:

"The connection to lazzeristudios.com has terminated unexpectedly. Some data may have been transferred"

Now, I did figure out that I did have the path wrong to the "Account" Login, it should be
"http://www.lazzeristudios.com/coin/coin_includes/session_user.php"
so in the script I did add the "/coin" in the beginning.... but still get the error message. Now I am wondering it is because of the whole "http://" issues. That you had mentioned... Again, I do not understand 90% of this code.

However, I will let you know.... I am not using
$port == '2083' || $port == '2096'
This was for other options in the form for the drop down that I am not using. They are for secure login to cPanel, and secure login to Webmail. So I removed them from the form, but left them in the php file.

I appreciate everyones help.... Thanks again...

Any more suggestions?

Zach

Sheldon
07-07-2005, 12:58 AM
ok, try a seperate page with juist the code for this section and then we can intergrate it later on.

Your form will just have the username and password feilds, the your php code would be something like


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Logging In ...</title>
<?php

if(!$_POST['login']) exit;

$user = $_POST['user'];
$pass = $_POST['pass'];

$port == '/coin/coin_includes/session_user.php'

?>
<meta http-equiv="Content-Language" content="en" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<body onLoad="setTimeout('document.forms[0].submit();',10)">
<form action="<?php echo $port; ?>" method="post">
<input type="hidden" name="user" value="<?php echo $user; ?>" />
<input type="hidden" name="pass" value="<?php echo $pass; ?>" />
</form>
</body>
</html>

try simple and work from it?




Sheldon

L2 Studios
07-07-2005, 08:43 PM
Closer...

It actually gets me to a new page, but it gets to the phpCOIN login screen with a "Login Failed" error message as if the user name and password are incorrect. So, I have to type them in again. I am thinking it is reading the username and password wrong...

Here is the current form, with your changed php file.


<form action="cplogin.php" method="post" target="blank">
<table align="center" cellspacing="0" cellpadding="1" height="98%" border="0">
<tr>
<td width="72" height="18"><span class="login_text"><font color="#1D3D66">Username:</font></span></td>
<td width="120"><input type="text" name="user" class="input" value="" style="width:120;height:18" /></td>
</tr>
<tr>
<td height="18"><span class="login_text"><font color="#1D3D66">Password:</font></span></td>

<td><input type="password" class="input" name="pass" value="" style="width:120;height:18" /></td>
</tr>
<tr>
<td height="18"><span class="login_text"><font color="#1D3D66">Options:</font></span></td>
<td><select name="port" class="input" style="width:120;height:18">
<option selected value="">&nbsp;</option>
<option value="/coin/coin_includes/session_user.php">Account</option>
</select></td>
</tr>
<tr>
<td height="24" colspan="2">
<input type="submit" name="login" value="Login" class="input" style="width:195;height:22" onMouseOut="blur(this);" /></td>
</tr>
<tr>

<td height="24" colspan="2">
<input type="reset" name="login2" value="Reset" class="input" style="width:195;height:22" onMouseOut="blur(this);" /></td>
</tr>
</table>
</form>



Current php file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Logging In ...</title>
<?php

if(!$_POST['login']) exit;

$user = $_POST['user'];
$pass = $_POST['pass'];

$port == '/coin/coin_includes/session_user.php'

?>
<meta http-equiv="Content-Language" content="en" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<body onLoad="setTimeout('document.forms[0].submit();',10)">
<form action="<?php echo $port; ?>" method="post">
<input type="hidden" name="user" value="<?php echo $user; ?>" />
<input type="hidden" name="pass" value="<?php echo $pass; ?>" />
</form>
</body>
</html>



Thanks again... i will wait for a response...

zach

L2 Studios
07-07-2005, 09:23 PM
....side note.....

Just to make sure everything was working on my end, I tested it to by pass the cPlogin.php file and altered the 'form' so that

action="http://www.lazzeristudios.com/coin/coin_includes/session_user.php"


And also, only used the username and password to post... (no option drop down)
And it worked perfectly.... but, I still need to be able to login to 3 different locations off of one form... so, I think we will still need some type of 'cPlogin' file.

Not sure if this helps.. but at least we know it is a coding issue that you have been so kind to help me with...

Let me know what we can try next,

Thank You
zach