function attempt_register($username, $password1, $password2) { $pass1 = trim($password1); $pass2 = trim($password2); if ($username != "" && $pass1 != "" && $pass2 != "") { $user = find_username($username); if (!$user) { if ($pass1 === $pass2) { $encryptedPass = password_encrypt($pass1); add_user($username, $encryptedPass); return true; } else { echo "<div id=\"error\">"; echo "passwords do not match"; echo "</div>"; } } else { echo "<div id=\"error\">"; echo " this user name has been taken"; echo "</div>"; } } else { echo "<div id=\"error\">"; echo "please enter all feilds"; echo "</div>"; } }
<?php include_once 'auth_connect.php'; include_once 'data_connect.php'; include_once 'functions.php'; sec_session_start(); if (login_check($mysqli) == true) { echo find_username($_POST["username"], $mysqli); } else { echo false; }
function display_order() { $db = db_connect(); $query = "select * from orders"; $result = $db->query($query); $num_result = $result->num_rows; ?> <div class="col-md-9"> <table class="table"> <tr> <th>订单号</th> <th>用户信息</th> <th>商品信息</th> <th>订单总额</th> <th>收货人</th> <th>收货地址</th> <th>下单时间</th> <th>付款状态</th> </tr> <?php for ($i = 0; $row = $result->fetch_assoc(); $i++) { echo "<tr>"; echo "<td>" . $row['orderid'] . "</td>"; $username = find_username($row['userid']); echo "<td>" . $username . "</td>"; $query = "select isbn,item_price,quantity from order_items where orderid='" . $row['orderid'] . "'"; $result2 = $db->query($query); echo "<td>"; for ($i = 0; $row2 = $result2->fetch_assoc(); $i++) { $book = get_book_details($row2['isbn']); echo $book['title'] . "=" . $row2['item_price'] . "(元) * " . $row2['quantity']; echo "<br>"; } echo "</td>"; echo "<td>" . $row['amount'] . "</td>"; echo "<td>" . $row['ship_name'] . "</td>"; echo "<td>" . $row['ship_country'] . $row['ship_state'] . $row['ship_city'] . $row['ship_address'] . "," . $row['ship_zip'] . "</td>"; echo "<td>" . $row['date'] . "</td>"; echo "<td>" . $row['order_status'] . "</td>"; echo "</tr>"; } ?> </table> </div> </div> <?php }