php+jquerymobile開發移動web

jQueryMobile是一個轉爲移動終端打造的web開發框架,兼容js語法,靈活的配置,不須要寫不少代碼,就能夠知足移動終端的操做。php

登陸界面腳本以下:css

<?html


  if(isset($_POST['submit'])){jquery

$uname = strtolower(getMagic($_POST['username']));web

$storeid = strtolower(getMagic($_POST['storeid']));ajax

$upass = getMagic($_POST['userpwd']);sql

session_inset("ob_gb","1");session


    $sqlsel="select sym.userpass,rem.storeid,rem.userid,sym.username,str.storename,ch.chanlid,ch.shortname as chanlname "框架

. "  from remstoruser rem inner join symusers sym on sym.userid=rem.userid"ide

. " inner join foustore str on str.storeid=rem.storeid"

. " inner join fousalchanl ch on ch.chanlid=str.chanlid"

. " where rem.userid='".$uname."' and rem.storeid='".$storeid."'";

 

$result = $mycon->mQuery($sqlsel);

$row = $mycon->mQueryFetch($result);

 

if (count($row)>0){

session_inset("ob_storeid",$storeid);

session_inset("ob_storename",strout($row["storename"]));

session_inset("ob_chanlid",$row["chanlid"]);

session_inset("ob_chanlname",strout($row["chanlname"]));

session_inset("ob_userid",$row["userid"]);

session_inset("ob_username",strout($row["username"]));

        header("Location:index.php");

} else {

die();

};

  };  

?>

 

<!doctype html>

<html >

 <head>

  <meta charset="UTF-8">

  <meta name="Generator" content="EditPlus®">

  <meta name="Author" content="">

  <meta name="Keywords" content="">

  <meta name="Description" content="">

<!-- muse used in mobile web 移動web 自適應屏幕大小-->

  <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=1, maximum-scale=1">

  <title>門店移動WEB</title>

<!-- jQuery Mobile 移動web框架-->

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">

<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>

<!-- your js files 你本身的js腳本文件(必須在此處引入)-->

<script> 

            window.onload=function(){ 

                if(document.documentElement.scrollHeight <= document.documentElement.clientHeight) { 

                    bodyTag = document.getElementsByTagName('body')[0]; 

                    bodyTag.style.height = document.documentElement.clientWidth / screen.width * screen.height + 'px'; 

                } 

                setTimeout(function() { 

                    window.scrollTo(0, 1) 

                }, 0); 

            }; 

        </script> 

<!-- form component blur AJAX check  -->

<script>

$(document).ready(function(){

//storeid 


$("#uname").blur(function(){

if ('' != this.value)

{

check_login(this.id);

}

});


$("#userpwd").blur(function(){

if ('' != this.value)

{

check_login(this.id);

}

});


$("#storeid").blur(function(){

//alert(this.value);

if ('' !=this.value)

{

check_login(this.id);

};

});

  check_login = function (id){

  var chk_storeid=$("#storeid").val();

  var chk_username=$("#username").val();

  var chk_userpwd=$("#userpwd").val();

  $.ajax({

type:"post",

url:"ajax.php?action=login_check",

dataType:"text",

    data:"id="+id+"&username="+chk_username+"&userpwd="+chk_userpwd+"&storeid="+chk_storeid,

success:function(msg)

{

if(msg == 0){

$("#"+id+"_check").css("color","red");

} else if(msg == 1) {

$("#"+id+"_check").css("color","green");

}else

{

alert(msg);

}

},

complete:function(XMLHttpRequest,textStatus){},

error:function(){}

  });

  

  };

  

  

});

 

</script>

 

<!--session_inset("ob_storeid",$storeid); -->

<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>

  

  

 </head>

 <body>

  <div data-role="page" id="pagelogin" >

<header data-role="header" data-theme="b"> 

<h1>門店查詢系統</h1>

</header>

<article data-role="content" data-theme="b" >

<!-- <form action="" method="post"  >-->

<form action="#" method="post"  >

 

<div data-role="fieldcontain"  >

<label for="username" id="username_check">用戶名:</label>

<input id="username" name="username" placeholder="請輸入用戶名"  type="text" value="5200232"/>

</div>

<div data-role="fieldcontain"  >

<label for="userpwd" id="userpwd_check">密碼:</label>

<input id="userpwd" name="userpwd" placeholder="請輸入密碼"  type="password" value="1"/>

</div>

<div data-role="fieldcontain" data-autodividers="false" >

<!--<span id="storeid_check"></span>-->

<label for="storeid" id="storeid_check">店鋪號:</label>

<input id="storeid" name="storeid"   placeholder="請輸入店鋪號"  type="text" value="11002001"/>

</div>

<input name="submit" type="submit"  value="提交">

</form>  

</article>

     <footer data-role="footer" data-theme="b">

<h1>copyright 2004-2014 by ifuns ltd. </h1>

</footer>

  </div>

 </body>

</html>

相關文章
相關標籤/搜索