Multi-Login Script - Help
I’m trying to create a ‘Multi Login System’ that connects to two different websites which as two different input field variables using a 'Dropdown Box' and once it's onChange it changes the name="" field to the respectable fields as mentioned below.
- Website 1
- Username Input Field: username
- Password Input Field: password
- Submit Input Field: login
- Website 2
- Username Input Field: username
- Password Input Field: user_password
- Submit Input Field: user_login
I know this can be accomplished using, php, javascript or jQuery, but not sure how to go about it.
After searching, I found an old code of a 'Multi Login' that the creators of one of the control panels wrote me - At the time, I had 3 'panel#' control panels of the same source as I had 3 different dedicated servers.
Now, I've merged all 3 servers into of the same source into one and the other login source would be to the billing system.
Using an onChange event on the input fields I think would suffice, but it would have to have some kind of 3-dimensional array or something to provide on all the details.
- <?php
- if (!isset($_GET['panel'])) {
- $_GET['panel'] = 'panel1';
- }
- ?>
- <script>
- function selectPanel()
- {
- var panel_index = document.forms['loginSelect'].panel;
- location.href='./login.php?panel='+ panel_index.options[panel_index.selectedIndex].value
- }
- </script>
- <form name="loginSelect" method="POST" action="http://<?=$_GET['panel']?>.domain.com/index.php?page=login">
- <input type="text" name="username">
- <input type="password" name="user_password">
- <select name="panel" onchange="selectPanel()">
- <option value="panel1">panel1.domain.com</option>
- <option value="panel2"<?php if ($_GET['panel']=='panel2'){echo ' selected';}?>>panel2.domain.com</option>
- <option value="panel3"<?php if ($_GET['panel']=='panel3'){echo ' selected';}?>>panel3.domain.com</option>
- </select>
- <input type="submit" name="login_submit" value="login">
- </form>
I'm thinking a jQuery would probably work for the solution I want. (If nobody knows how, I'm just going to end up looking into hiring a freelancer.)
Regards,
Cory