Creating a Connection Form for Multiple Sites

advertisements

Our web-designer just finished up our site, and it has an HTML Form with Text Inputs for Username/Password, and a Drop-Down box so they can choose where they are logging in. Since HTML doesn't have anything that will work with this I don't believe, what would be the best way to do it?

I am assuming Javascript, but I have never used it before, and really have no idea what to even search for to apply it in this case.

Current Form Code:

<form>
    <input class="binput" name="username" style="margin-left: 40px;" value="Username">
    <input class="binput" name="password" value="Password">
        <select class="binput" style="margin-left: 40px; width: 130px;">
            <option>Billing Panel</option>
            <option>Voice Panel</option>
            <option>Game Panel</option>
        </select>

    <input type="submit" class="blogin" value="Log In">
</form>

Panel 1 Login Integration Example:

<form method="post" action="http://www.yourdomain.com/whmcs/dologin.php">
Email Address: <input type="text" name="username" size="50">
Password: <input type="password" name="password" size="20">
<input type="submit" value="Login">
</form>

Panel 2 Login Integration Example:

<form method="POST" action="http://demo.tcadmin.com/templates/default/login.aspx">
  <table border="0" id="table1"><br />
    <tr><td>User:</td><td><input type="text" name="USERID" size="20"></td></tr>
    <tr><td>Password:</td><td><input type="password" name="PASSWORD" size="20"></td></tr>
  </table>
  <input type="submit" value="Submit" name="B1"><input type="reset" value="Reset">
</form>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  >
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>Title </title>
</head>
<body>
<form method="POST" action="" name="frmLogin" id="frmLogin" onSubmit="return   sbmt();">
    <input class="binput" name="username" style="margin-left: 40px;" value="Username" id="usr">
    <input class="binput" name="password" value="Password" type="password" id="pwd">
        <select class="binput" style="margin-left: 40px; width: 130px;" onchange="changeAction(this);" name="loginSite" id="loginSite">
            <option value="0" Selected >Select One</option>
        <option value="1">Billing Panel</option>
            <option value="2">Voice Panel</option>
            <option value="3">Yahoo! Mail</option>
        </select>

    <input type="submit" class="blogin" value="Log In">
</form>
<script language="">
//Every element in LoginInfo is array of informations about one site!
var LoginInfo= new Array(
                new Array("usr","pwd",""),
                new Array("usr","pwd","http://www.yourdomain.com/whmcs/dologin.php"),
                new Array("username","password","http://demo.tcadmin.com/templates/default/login.aspx"),
                new Array("usrname","pass","https://login.yahoo.com/config/login_verify2?&.src=ym"));

function changeAction(s){

    var loginSite = s.value;
    document.getElementById('usr').name=LoginInfo[loginSite][0];
    document.getElementById('pwd').name=LoginInfo[loginSite][1];
    document.getElementById('frmLogin').action=LoginInfo[loginSite][2];

}

function sbmt(){

    var user = document.getElementById('usr');
    if(!user.value || user.value=="Username"){
        return false;
    }
    var pwd = document.getElementById('pwd');
    if(!pwd.value || pwd.value=="Password"){
        return false;
    }

    var site =document.getElementById('loginSite');
    if(  site.value=="0"){
        return false;
    }
        return true;
}
</script>
</body>
</html>

I edited the code!
I hope this one solve your problem:)