관리-도구
편집 파일: index.php
<? include_once('../includes/constants.php'); $page_title = "Arizona's Finest Wedding Sites, Wedding Locations and Wedding Services : Arizona Wedding Reception Sites | Arizona Wedding Vendors | AZ Wedding Sites"; if (file_exists($DOCUMENT_ROOT."/includes/header.php")) { include_once("../includes/header.php"); } else { header("location: /error.php"); } ?> <script src="js/jquery.js" type="text/javascript" language="javascript"></script> <script language="javascript"> $(document).ready(function() { $("#login_form").submit(function() { //remove all the class add the messagebox classes and start fading $("#msgbox").removeClass().addClass('messagebox').text('Validating....').fadeIn(1000); //check the username exists or not from ajax $.post("ajax_login.php",{ user_name:$('#username').val(),password:$('#password').val(),rand:Math.random() } ,function(data) { if(data=='yes') //if correct login detail { $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox { //add message and change the class of the box and start fading $(this).html('Logging in.....').addClass('messageboxok').fadeTo(900,1, function() { //redirect to secure page document.location='data_entry.php'; }); }); } else { $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox { //add message and change the class of the box and start fading $(this).html('Incorrect username/password..').addClass('messageboxerror').fadeTo(900,1); }); } }); return false; //not to post the form physically }); //now call the ajax also focus move from $("#password").blur(function() { $("#login_form").trigger('submit'); }); }); </script> <style type="text/css"> body { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; } .top { margin-bottom: 15px; } .buttondiv { margin-top: 10px; } .messagebox{ position:absolute; width:100px; margin-left:30px; border:1px solid #c93; background:#ffc; padding:3px; } .messageboxok{ position:absolute; width:auto; margin-left:30px; border:1px solid #349534; background:#C9FFCA; padding:3px; font-weight:bold; color:#008000; } .messageboxerror{ position:absolute; width:auto; margin-left:30px; border:1px solid #CC0000; background:#F7CBCA; padding:3px; font-weight:bold; color:#CC0000; } </style> <form method="post" action="" id="login_form"> <div id="content"> <h1 class="title">Login Page</h1> <p><br /> </p> <div align="center"> <div class="top" > <div > User Name : <input name="username" type="text" id="username" value="" maxlength="20" /> </div> <div style="margin-top:5px" > Password : <input name="password" type="password" id="password" value="" maxlength="20" /> </div> <div class="buttondiv"> <input name="Submit" type="submit" id="submit" value="Login" style="margin-left:-10px; height:23px" /> <span id="msgbox" style="display:none"></span> </div> </div> </p> </div> </form> </div> </div> <? if (file_exists($DOCUMENT_ROOT."/includes/footer.php")) { include_once("../includes/footer.php"); } else { header("location: /error.php"); } ?>