2014-03-03 40 views
0

我有一个在线预订脚本,我需要从登录页面到主页的登录区域,例如在一个框中切换客户端登录和代理登录。 css已准备就绪,但我只需要从登录页面(第一个代码)将必须使用的代码放在主页中以允许用户登录,如第三张图片。我如何从登录页面创建登录代码到索引?

the image http://alrayah-hotels.com/login.jpg

登录页面的代码是:

<?php 
    session_start(); 
    if(isset($_SESSION['password_2012']) && isset($_SESSION['agent'])){ 
    if($_SESSION['agent']) { 
     header("location:agent_managebooking.php"); 
    } else { 
     header("location:managebooking.php"); 
    } 
    } 

    if(isset($_POST['getpass'])) { 
    include("includes/db.conn.php"); 
    include("includes/conf.class.php"); 
    $emailid= mysql_real_escape_string($_POST['email_addr']); 
    $user_or_agant = $_POST['user_or_agant']; 
    $bsiCore->getPassword($emailid,$user_or_agant); 
    } 

    if(isset($_POST['accountSelect'])) { 
    include("includes/db.conn.php"); 
    include("includes/conf.class.php"); 
    $email = mysql_real_escape_string($_POST['login_email']); 
    $pass = md5(mysql_real_escape_string($_POST['login_password'])); 

    if($_POST['accountSelect'] == 2) { 
     $login = $bsiCore->loginAgent($email, $pass); 
    } else { 
     $login = $bsiCore->login($email, $pass); 
    } 


    if($login == true) { 
     if($_SESSION['agent'] == 1) { 
     header("location:agent_managebooking.php"); 
     } else { 
     header("location:managebooking.php"); 
     } 
    } else { 
     header("location:my_account.php?account=".base64_encode($_POST['accountSelect'])."&err=1"); 
    } 
    } 

    include("includes/db.conn.php"); 
    include("includes/conf.class.php"); 
    include("includes/language.php"); 


    if(isset($_SESSION['default_lang'])){ 
    $htmlCombo=$bsiCore->getbsilanguage($_SESSION['default_lang']); 
    } else { 
    $htmlCombo=$bsiCore->getbsilanguage(); 
    } 

    global $bsiCore; 

?> 

<html lang="en-us" xml:lang="en-us" xmlns="http://www.w3.org/1999/xhtml"> 
    <head profile="http://a9.com/-/spec/opensearch/1.1/"> 
    <title><?=$bsiCore->config['conf_portal_name']?></title> 

    <!-- Meta tags --> 
    <meta http-equiv="content-language" content="en-us" /> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <meta http-equiv="Content-Script-Type" content="text/javascript" /> 
    <meta http-equiv="Content-Style-Type" content="text/css" /> 
    <meta http-equiv="window-target" content="_top" /> 

    <!-- skip frames --> 
    <meta name="robots" content="index,follow" /> 
    <meta name="keywords" content="booking, hotel, hotels, reservations" /> 
    <meta name="description" content="Online Booking" /> 

    <!-- Favicons --> 
    <link href="img/favicon.png" rel="shortcut icon" type="image/png" /> 
    <link href="img/favicon.png" rel="icon" type="image/png" /> 

    <!-- Main Stylesheets --> 
    <link href="css/style.css" media="screen" rel="stylesheet" type="text/css" /> 
    <link href="css/extensions.css" media="screen" rel="stylesheet" type="text/css" /> 
    <link href="css/print.css" media="print" rel="stylesheet" type="text/css" /> 

    <!-- for printing --> 
    <!-- Alternate stylesheets/themes --> 
    <link href="css/orange.css" media="screen" rel="alternate stylesheet" type="text/css" title="orange" /> 
    <link href="css/pink.css" media="screen" rel="alternate stylesheet" type="text/css" title="pink" /> 
    <link href="css/red.css" media="screen" rel="alternate stylesheet" type="text/css" title="red" /> 
    <link href="css/blue.css" media="screen" rel="alternate stylesheet" type="text/css" title="blue" /> 
    <link href="css/brown.css" media="screen" rel="alternate stylesheet" type="text/css" title="brown" /> 
    <link href="css/cyan.css" media="screen" rel="alternate stylesheet" type="text/css" title="cyan" /> 
    <link href="css/purple.css" media="screen" rel="alternate stylesheet" type="text/css" title="purple" /> 

    <!-- Your Custom Stylesheet --> 
    <link href="css/custom.css" media="screen" rel="stylesheet" type="text/css" /> 

    <!-- RSS links (if needed) --> 
    <link href="top.rss" rel="alternate" type="application/rss+xml" title="Top Destinations" /> 
    <link href="deals.rss" rel="alternate" type="application/rss+xml" title="Best Deals" /> 
    <link href="blog.rss" rel="alternate" type="application/rss+xml" title="Latest News" /> 

    <!-- jQuery with plugins --> 
    <script src="js/jquery-1.4.2.min.js" type="text/javascript"></script><!-- Could be loaded remotely from Google CDN : <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> --> 
    <script src="js/jquery.ui.core.min.js" type="text/javascript"></script> 
    <script src="js/jquery.ui.widget.min.js" type="text/javascript"></script> 
    <script src="js/jquery.ui.tabs.min.js" type="text/javascript"></script> 
    <script src="js/jquery.datepick.pack.js" type="text/javascript"></script> 
    <script src="js/jquery.datepick-en-GB.js" type="text/javascript"></script><!-- Datepick localisations: http://keith-wood.name/datepick.html --> 
    <script src="js/jquery.imgpreview.js" type="text/javascript"></script> 
    <script src="js/jquery.nyroModal.pack.js" type="text/javascript"></script> 
    <script src="js/jquery.notice.js" type="text/javascript"></script> 
    <script src="js/jquery.cycle.pack.js" type="text/javascript"></script> 
    <script src="js/jquery.notice.js" type="text/javascript"></script> 

    <!-- Google maps and marker clustering --> 
    <script src="http://www.google.com/jsapi?autoload={'modules':[{name:'maps',version:3,other_params:'sensor=false'}]}" type="text/javascript"></script> 
    <script src="js/Fluster2.packed.js" type="text/javascript"></script> 

    <!-- Custom template functions --> 
    <script src="js/custom.js" type="text/javascript"></script> 
    <script src="js/styleswitch.js" type="text/javascript"></script> 

    <!-- Internet Explorer Fixes --> 
    <!--[if IE]> 
    <link rel="stylesheet" type="text/css" media="all" href="css/ie.css"/> 
    <script src="js/IE8.js"></script> 
    <script type="text/javascript"> 
     //<![CDATA[ 
     $(document).ready(function() { 
     //alert("hi"); 

     $("#getpassword").hide(); 

     $("#change_pass").click(function() { 
      $("#getpassword").show(); 
      $("#getdetails").hide(); 
     }); 

     // Template setup 
     Site.setup(); 

     // FAQ click handling 
     $('.question > a').click(function() { 
      $(this).parent().find('q').toggle(); 
      return false; 
     }); 
     }); 
     //]]> 

    </script> 
    </head> 

    <?php include("header.php");?> 
    <!-- Left menu: Categories --> 
    <!-- End of Left menu: Categories --> 
    <!-- Questions and Answers --> 
    <div class="grid_12"> 
    <div class="padded" style="height:425px;"> 
     <div id="signin_frm" align="center"> 
     <br /> 
     <?php 
      if(isset($_REQUEST['err'])) { 
      if(isset($_SESSION['agentmsg'])) { 
       echo $_SESSION['agentmsg']; 
       unset($_SESSION['agentmsg']); 
      } 
      } 
     ?> 
     <br /> 
     <br /> 
     <form name="login" action="<?=$_SERVER['PHP_SELF']?>" method="post"> 
      <div id="getdetails"> 
      <table cellpadding="5" cellspacing="0" border="0" style="border:1px solid #999;" align="center" > 
       <tr> 
       <td colspan="2" align="center" style="padding:10px !important;"> 
        <?php 
        if(isset($_SESSION['msg'])) { 
         echo "<h3>".$_SESSION['msg']."</h3>"; 
         unset($_SESSION['msg']); 
        } 
        ?> 
        <h4> 
        <?php 
         if(isset($_GET['account']) && base64_decode($_GET['account']) == 1){ echo CLIENT_LOGIN; } 
         if(isset($_GET['account']) && base64_decode($_GET['account']) == 2){ echo AGGENT_LOGIN; } ?></h4> 
       </td> 
       </tr> 
       <tr> 
       <td style="padding:10px !important;"><?=EMMAIL_ADDRESS?></td> 
       <td style="padding:10px !important;"><input type="text" name="login_email" id="login_email" title="Email Address" /></td> 
       </tr> 
       <tr> 
       <td style="padding:10px !important;"><?=PASSWORD?></td> 
       <td style="padding:10px !important;"><input id="login_password" class="" value="" name="login_password" type="password"/> 
        <input type="hidden" name="accountSelect" value="<?= $bsiCore->ClearInput(base64_decode($_GET['account'])) ?>" /> 
       </td> 
       </tr> 
       <tr> 
       <td > 
        <input type="button" name="change_pass" id="change_pass" value="<?=FORGET_PASSWORD?>" class="btn btn-custom radius" /> 
       </td> 
       <td colspan="" style="padding:10px !important;"><input type="submit" name="Myloginbtn" id="Myloginbtn" value="<?= LOGIN_NOW ?>" class="btn btn-custom radius" /></td> 
       </tr> 
      </table> 
      </div> 
      <div id="getpassword"> 
      <table cellpadding="5" cellspacing="0" border="0" style="border:1px solid #999;" align="center" > 
       <tr> 
       <td colspan="2" align="center" style="padding:10px !important;"> 
        <h4><?= GET_PASS ?></h4> 
       </td> 
       </tr> 
       <tr> 
       <td style="padding:10px !important;"><?=EMMAIL_ADDRESS?></td> 
       <td style="padding:10px !important;"><input type="text" name="email_addr" id="email_addr" title="Email Addr" /></td> 
       </tr> 
       <tr> 
       <td> 
        <input type="hidden" name="user_or_agant" value="<?php echo base64_decode($_GET['account']); ?>" /> 
       </td> 
       <td style="padding:10px !important;"><input type="submit" name="getpass" id="getpass" value="<?=GET_PASS?>" class="btn btn-custom radius" /> 
       </td> 
       </tr> 
      </table> 
      </div> 
     </form> 
     <br /> 
     <br /> 
     <br /> 
     </div> 
    </div> 
    </div> 
    <!-- End of Questions and Answers --> 
    <p>&nbsp;</p> 
    <div class="clear">&nbsp;</div> 
    </div> 
    <?php include("footer.php");?> 
    <!-- Scroll to top link --> 
    <a href="#" id="totop" class="radius" title="back to top"><img src="img/top.png" alt="back to top" /></a> 
    </body> 
</html> 

这是我做了什么,但它不工作:

 <div id="DefaultPghdLog" class="login-container"> 
    <div id="ctl00_ctl00_cphContent_Login1_ValidationSummary1" style="color:Red;display:none;"> 
    </div> 
    <div id="ctl00_ctl00_cphContent_Login1_ValidationSummary2" style="color:Red;display:none;"> 
    </div> 
    <div id="ctl00_ctl00_cphContent_Login1_divRegistration"> 
    <div> 
    <span class="login-title logInradio"><input id="ctl00_ctl00_cphContent_Login1_rdRegistration" type="radio" name="ctl00$ctl00$cphContent$Login1$Login" value="rdRegistration" checked="checked" onclick="javascript:ChangeControlDisplayStyle('DivPublicLogin',true,'DivAgentLogin');"><label for="ctl00_ctl00_cphContent_Login1_rdRegistration">Client Login</label></span> 
    </div> 
    <div> 
    <span class="login-title logInradio"><input id="ctl00_ctl00_cphContent_Login1_rdAgentLogin" type="radio" name="ctl00$ctl00$cphContent$Login1$Login" value="rdAgentLogin" onclick="javascript:ChangeControlDisplayStyle('DivAgentLogin',true,'DivPublicLogin');"><label for="ctl00_ctl00_cphContent_Login1_rdAgentLogin"> Agent Login</label></span> 
    </div> 
    <div id="ctl00_ctl00_cphContent_Login1_UpdatePanel2"> 
      <div class="login-errormsg"> 
         </div> 
    </div> 
    <div id="ctl00_ctl00_cphContent_Login1_pnlLogin" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'ctl00_ctl00_cphContent_Login1_btnAgentLogin')"> 
     <div id="DivAgentLogin" class="AgentLogin" style="display: none;"> 
     <h2>AGENT LOGIN</h2> 
     <div class="grid_12 treelogn"> 
    <div class="paddedf"> 
     <div id="signin_frm" align="center"> 
     <?php 
     if(isset($_REQUEST['err'])){ 
      if(isset($_SESSION['agentmsg'])){ 
       echo $_SESSION['agentmsg']; 
       unset($_SESSION['agentmsg']); 
      } 
     } 
     ?> 
    <form name="login" action="<?=$_SERVER['PHP_SELF']?>" method="post"> 
     <div id="getdetails"> 
     <tr> 
       <td colspan="2" align="center" style="padding:10px !important;"> 
       <?php if(isset($_SESSION['msg'])){ 
       echo "<h3>".$_SESSION['msg']."</h3>"; 
       unset($_SESSION['msg']); 
       } 
           ?> 
       <h4><?php if(isset($_GET['account']) && base64_decode($_GET['account']) == 1){ echo CLIENT_LOGIN; }if(isset($_GET['account']) && base64_decode($_GET['account']) == 2){ echo AGGENT_LOGIN; } ?></h4></td> 
      </tr> 
     <tr> 
       <td style="padding:10px !important;"><input type="text" name="login_email" id="login_email" placeholder="Email Address" title="Email Address" /></td> 
      </tr> 
      <tr> 
       <td style="padding:10px !important;"><input id="login_password" class="" value="" placeholder="password" name="login_password" type="password"/> 
       <input type="hidden" name="accountSelect" value="<?=$bsiCore->ClearInput(base64_decode($_GET['account']))?>" /></td> 
      </tr> 
      <tr> 
      <td colspan="" style="padding:10px !important;"><input type="submit" name="Myloginbtn" id="Myloginbtn" value="<?=LOGIN_NOW?>" class="btn btn-custom radius" /></td> 
       </tr> 
       </div> 
        <div id="getpassword"> 
     <table cellpadding="5" cellspacing="0" border="0" style="border:1px solid #999;" align="center" > 
      </table> 
     </div> 
     </form> 
      <br /> 
     <br /> 
     <br /> 
    </div> 
     </div> 
    </div> 
+4

我们不打算通读大量严重格式化的代码来试图猜测问题出在哪里。 –

+0

我很抱歉,但这是我的第一篇文章,谢谢Mr.jvperrin的编辑。 – user3373354

+0

“css已准备就绪”,就问题的本质而言,还没有准备好:准备好的css产生了你的第一个例子(我猜 - 你已经发布了php代码,而不是css),而一个*完全*不同的代码会产生你想要的结果。你想在CSS上做什么尝试? –

回答

0

如果我看到了您的权利必须在登录页面的开头使用PHP代码,并使用if($_POST['accountSelect'] == 2) {更改零件,以便使用您的单选按钮。

相关问题