Linking login box from one web page to another

  • jharvey1029
  • Novice
  • Novice
  • jharvey1029
  • Posts: 31
  • Loc: New Castle, PA

Post 3+ Months Ago

Hey Guys,

I know this can be done but I'm unsure of the correct code. Basically I have a home page that has a username and password login box at the top of the page and want to link it to a CRM which is in a different directory that I also control.

To be clear, I want to enter my username and password on my home page and this then logs me into and redirects my browser to the CRM. The CRM uses mySQL and authenticates using this.

Does that make sense? The following is the login box code from my home page (and my attempt) followed by the login box code from the CRM login.php page

Code: [ Select ]
<form method="post" action="CustomerAuthenticate.php" id="login-form">
                <fieldset>
                    <span class="text">
                        <input type="text" value="Username" onFocus="if(this.value=='Username'){this.value=''}" onBlur="if(this.value==''){this.value='Username'}">
                    </span>
                    <span class="text">
                        <input type="password" value="Password" onFocus="if(this.value=='Password'){this.value=''}" onBlur="if(this.value==''){this.value='Password'}">
                    </span>
                    <a href='javascript:;' class="login" onclick="return validateLoginDetails();"><span><span>Login</span></span></a>
  1. <form method="post" action="CustomerAuthenticate.php" id="login-form">
  2.                 <fieldset>
  3.                     <span class="text">
  4.                         <input type="text" value="Username" onFocus="if(this.value=='Username'){this.value=''}" onBlur="if(this.value==''){this.value='Username'}">
  5.                     </span>
  6.                     <span class="text">
  7.                         <input type="password" value="Password" onFocus="if(this.value=='Password'){this.value=''}" onBlur="if(this.value==''){this.value='Password'}">
  8.                     </span>
  9.                     <a href='javascript:;' class="login" onclick="return validateLoginDetails();"><span><span>Login</span></span></a>


Code: [ Select ]
<table cellspacing="0" cellpadding="0" class="outerTab">
      <tr>
        <td width="15%"><br><br><br></td>
        <td width="70%">&nbsp;</td>
        <td width="15%">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>
            <table class="innerTab" cellspacing="0" cellpadding="0">
              <tr>
                <th align="left"><img src="images/loginVtigerCRM.gif" width="169" height="49"></th>
                <th>&nbsp;</th>
                <th align="right">&nbsp;</th>
              </tr>
              <tr class="tableTop"><td colspan="3"></td></tr>
              <tr>
                <td colspan="3" class="tableMidone">
                    <table class="loginTab" cellspacing="0" cellpadding="0" align="center">
                      <tr>
                        <td width="6" height="5"><img src="images/loginSITopLeft.gif"></td>
                        <td bgcolor="#FFFFFF"></td>
                        <td width="6" height="5"><img src="images/loginSITopRight.gif"></td>
                      </tr>
                      <tr bgcolor="#FFFFFF">
                        <td height="150">&nbsp;</td>
                        <td valign="top">
                            <table width="100%" border="0" cellspacing="0" cellpadding="3">
                            <form name="login" action="CustomerAuthenticate.php" method="post">
                              <tr>
                                <?php
                                  //Display the login error message
                                  if($_REQUEST['login_error'] != '')
                                    echo getTranslatedString(base64_decode($_REQUEST['login_error']));
                                ?>
                              </tr>
                              <tr>
                          <td colspan="2" class="detailedViewHeader"><b><?php echo getTranslatedString('customerportal');echo " ".$version; ?></b></td>
                              </tr>
                              <tr>
                                <td class="dvtCellLabel" align="right" width="50%"><?php echo getTranslatedString('LBL_EMAILID');?></td>
                                <td class="dvtCellInfo"><input type="text" id="username" name="username" class="detailedViewTextBox"></td>
                              </tr>
                              <tr>
                                <td class="dvtCellLabel" align="right"><?php echo getTranslatedString('LBL_PASSWORD');?></td>
                                <td class="dvtCellInfo"><input type="password" id="pw" name="pw" class="detailedViewTextBox"></td>
                              </tr>
                              <tr>
                                <td class="dvtCellLabel" align="right"><?php echo getTranslatedString('LBL_LANGUAGE');?></td>
                                <td class="dvtCellInfo">
                                    <select name='login_language' style="width:70%" >
                                        <?PHP echo getPortalLanguages(); ?>    
                                    </select>
                                </td>
                              </tr>
                              <tr>
                                <td>&nbsp;</td>
                                <td align="right"><a href='javascript:;' onclick='window.open("supportpage.php?param=forgot_password","ForgotPassword","width=400,height=250");'><?php echo getTranslatedString('LBL_FORGOT_LOGIN');?></a></td>
                              </tr>
                              <tr>
                                <td colspan="2" align="center"><input type="image" src="images/loginBtnSignin.gif" onclick="return validateLoginDetails();"></td>
                              </tr>
                              <tr>
                                <td class="dvtCellInfo" colspan="2"></td>
                              </tr>
                              <tr>
                              <td class="dvtCellInfo" colspan="2" ><font color="gray" size="1"><?php echo getTranslatedString('LBL_LOGIN_NOTE');?></font></td>
                              </tr>
                            </table>
                        </td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="6" height="6"><img src="images/loginSIBottomLeft.gif"></td>
                        <td bgcolor="#FFFFFF"></td>
                        <td width="6" height="6"><img src="images/loginSIBottomRight.gif"></td>
                      </tr>
                    </table>
                    </form>
                </td>
              </tr>
             <tr>
              <td colspan="3" class="tableBtm">&nbsp;</td>
           </tr>
            </table>
  1. <table cellspacing="0" cellpadding="0" class="outerTab">
  2.       <tr>
  3.         <td width="15%"><br><br><br></td>
  4.         <td width="70%">&nbsp;</td>
  5.         <td width="15%">&nbsp;</td>
  6.       </tr>
  7.       <tr>
  8.         <td>&nbsp;</td>
  9.         <td>
  10.             <table class="innerTab" cellspacing="0" cellpadding="0">
  11.               <tr>
  12.                 <th align="left"><img src="images/loginVtigerCRM.gif" width="169" height="49"></th>
  13.                 <th>&nbsp;</th>
  14.                 <th align="right">&nbsp;</th>
  15.               </tr>
  16.               <tr class="tableTop"><td colspan="3"></td></tr>
  17.               <tr>
  18.                 <td colspan="3" class="tableMidone">
  19.                     <table class="loginTab" cellspacing="0" cellpadding="0" align="center">
  20.                       <tr>
  21.                         <td width="6" height="5"><img src="images/loginSITopLeft.gif"></td>
  22.                         <td bgcolor="#FFFFFF"></td>
  23.                         <td width="6" height="5"><img src="images/loginSITopRight.gif"></td>
  24.                       </tr>
  25.                       <tr bgcolor="#FFFFFF">
  26.                         <td height="150">&nbsp;</td>
  27.                         <td valign="top">
  28.                             <table width="100%" border="0" cellspacing="0" cellpadding="3">
  29.                             <form name="login" action="CustomerAuthenticate.php" method="post">
  30.                               <tr>
  31.                                 <?php
  32.                                   //Display the login error message
  33.                                   if($_REQUEST['login_error'] != '')
  34.                                     echo getTranslatedString(base64_decode($_REQUEST['login_error']));
  35.                                 ?>
  36.                               </tr>
  37.                               <tr>
  38.                           <td colspan="2" class="detailedViewHeader"><b><?php echo getTranslatedString('customerportal');echo " ".$version; ?></b></td>
  39.                               </tr>
  40.                               <tr>
  41.                                 <td class="dvtCellLabel" align="right" width="50%"><?php echo getTranslatedString('LBL_EMAILID');?></td>
  42.                                 <td class="dvtCellInfo"><input type="text" id="username" name="username" class="detailedViewTextBox"></td>
  43.                               </tr>
  44.                               <tr>
  45.                                 <td class="dvtCellLabel" align="right"><?php echo getTranslatedString('LBL_PASSWORD');?></td>
  46.                                 <td class="dvtCellInfo"><input type="password" id="pw" name="pw" class="detailedViewTextBox"></td>
  47.                               </tr>
  48.                               <tr>
  49.                                 <td class="dvtCellLabel" align="right"><?php echo getTranslatedString('LBL_LANGUAGE');?></td>
  50.                                 <td class="dvtCellInfo">
  51.                                     <select name='login_language' style="width:70%" >
  52.                                         <?PHP echo getPortalLanguages(); ?>    
  53.                                     </select>
  54.                                 </td>
  55.                               </tr>
  56.                               <tr>
  57.                                 <td>&nbsp;</td>
  58.                                 <td align="right"><a href='javascript:;' onclick='window.open("supportpage.php?param=forgot_password","ForgotPassword","width=400,height=250");'><?php echo getTranslatedString('LBL_FORGOT_LOGIN');?></a></td>
  59.                               </tr>
  60.                               <tr>
  61.                                 <td colspan="2" align="center"><input type="image" src="images/loginBtnSignin.gif" onclick="return validateLoginDetails();"></td>
  62.                               </tr>
  63.                               <tr>
  64.                                 <td class="dvtCellInfo" colspan="2"></td>
  65.                               </tr>
  66.                               <tr>
  67.                               <td class="dvtCellInfo" colspan="2" ><font color="gray" size="1"><?php echo getTranslatedString('LBL_LOGIN_NOTE');?></font></td>
  68.                               </tr>
  69.                             </table>
  70.                         </td>
  71.                         <td>&nbsp;</td>
  72.                       </tr>
  73.                       <tr>
  74.                         <td width="6" height="6"><img src="images/loginSIBottomLeft.gif"></td>
  75.                         <td bgcolor="#FFFFFF"></td>
  76.                         <td width="6" height="6"><img src="images/loginSIBottomRight.gif"></td>
  77.                       </tr>
  78.                     </table>
  79.                     </form>
  80.                 </td>
  81.               </tr>
  82.              <tr>
  83.               <td colspan="3" class="tableBtm">&nbsp;</td>
  84.            </tr>
  85.             </table>


I'd appreciate any help on this.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9086
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

What sort of problem are you having, is it resulting in a 404 error? The only thing that stands out to me is that you said the CRM is in a different directory, yet with your code you have the action in the same directory:

HTML Code: [ Select ]
<form method="post" action="CustomerAuthenticate.php" id="login-form">


Make sure you include the directory for the location of the CustomerAuthenticate.php file in that action there so it points to the right area.
  • jharvey1029
  • Novice
  • Novice
  • jharvey1029
  • Posts: 31
  • Loc: New Castle, PA

Post 3+ Months Ago

I saw what you said and changed it to point to the directory where the file was however what is happening is the same as last time...when you click on the button nothing happens at all.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9086
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

I see you are using JavaScript on the form submit button, so you likely have some sort of JavaScript errors preventing it from happening. I would recommend opening your error console in the browser and see if you get any sort of errors when you hit the submit button. Then you can go from there depending on what errors you are getting.
  • jharvey1029
  • Novice
  • Novice
  • jharvey1029
  • Posts: 31
  • Loc: New Castle, PA

Post 3+ Months Ago

the error that came back from the error console was: validateLoginDetails not defined. Only I thought that by setting the action="CustomerAuthenticate.php" would start the process as thats how the process works in the crm if user was starting from the login.php page on the crm?

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 70 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.