<?php
session_start();
$stuid = $_POST['sid'];
$pwd = $_POST['pwd'];
$conn = new
mysqli('localhost', 'root', 'root', 'breakfast');
$sql = "SELECT account, cname FROM customers";
$sql .= " WHERE account='" . $stuid . "'";
$sql .= " AND pwd='" . $pwd . "'";
$rs = $conn -> query( $sql );
if($rs->num_rows == 1) {
$row = $rs->fetch_array();
$_SESSION['cname'] = $row["cname"];
$_SESSION['sid'] = $stuid;
echo "<script>location.href='order.php';</script>";
} else {
echo "<script>alert('wrong!');location.href='index.html';</script>";
}
session_start();
$stuid = $_POST['sid'];
$pwd = $_POST['pwd'];
$conn = new
mysqli('localhost', 'root', 'root', 'breakfast');
$sql = "SELECT account, cname FROM customers";
$sql .= " WHERE account='" . $stuid . "'";
$sql .= " AND pwd='" . $pwd . "'";
$rs = $conn -> query( $sql );
if($rs->num_rows == 1) {
$row = $rs->fetch_array();
$_SESSION['cname'] = $row["cname"];
$_SESSION['sid'] = $stuid;
echo "<script>location.href='order.php';</script>";
} else {
echo "<script>alert('wrong!');location.href='index.html';</script>";
}
?>
购买页面