<?php if( $_POST['title']=="") { reurl('add_order.html'); } include("menu.php"); $title =$_POST['title']; $info =$_POST['info']; $lowprice=$_POST['lowprice']; $stmt =$db->prepare("insert into orders (title,info,lowprice) values (:title,:info,:lowprice)"); $stmt->bindValue(':title',$title); $stmt->bindValue(':info',$info); $stmt->bindValue(':lowprice',$lowprice); $result=$stmt->execute(); if($result>0) alert_and_reurl('发布成功','orders.php'); reurl('add_order.html'); ?>
<?php include("config.php"); if( $_POST['username']=="" || $_POST['password']=="") { alert_back('请填写登录信息'); } $username =$_POST['username']; $password =$_POST['password']; $user_query=$db->prepare("select username from suppliers where username=:username and password=:password"); $user_query->bindValue(':username',$username); $user_query->bindValue(':password',$password); $user=$user_query->execute(); $data=$user_query->fetch(); if(count($data)>1 ) { setcookie("username",$username ); alert_and_reurl('登录成功!','orders.php'); }else alert_back('用户名或密码错误'); ?>
<?php include("config.php"); setcookie("username" ); alert_and_reurl('已退出!','login.html'); ?>
company , tel , address , info ) VALUES ( :username , :password , :email , :company , :tel , :address , :info )"); $stmt->bindValue(':username' ,$username ); $stmt->bindValue(':password' ,$password ); $stmt->bindValue( ':email' ,$email ); $stmt->bindValue(':company' ,$company ); $stmt->bindValue(':tel' ,$tel ); $stmt->bindValue(':address' ,$address ); $stmt->bindValue(':info' ,$info ); $result = $stmt->execute(); if($result){ setcookie("username",$username ); alert_and_reurl('注册成功,'.$username,'orders.php'); }else alert_and_reurl('注册失败','reg.html'); ?>