购物车网页代码,具体内容如下
1.登录界面login.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" c /> <script src="../jquery-1.11.2.min.js"></script> <title>无标题文档</title> </head> <body> <div>用户名:<input type="text" /></div> <div>密码:<input type="text" /></div> <input type="button" value="登录" /> </body> <script type="text/javascript"> $("#btn").click(function(){ var uid = $("#uid").val(); var pwd = $("#pwd").val(); $.ajax({ url:"loginchuli.php", data:{u:uid,p:pwd}, type:"POST", dataType:"TEXT", success: function(data){ if(data.trim()=="OK") { window.location.href="main.php" ; } else { alert("用户名或密码错误"); } } }) }) </script> </html>
2.登录处理页面loginchuli.php
<?php session_start(); include("../DBDA.class.php"); $db = new DBDA(); $uid = $_POST["u"]; $pwd = $_POST["p"]; $sql = "select password from login where username='{$uid}'"; $mm = $db->StrQuery($sql); if($mm==$pwd && $pwd!="") { $UserName = $_POST["uid"]; $_SESSION["uid"]=$uid; echo "OK"; } else { echo "NO"; }
3.主页面main.php
1 2 3 4 下一页