สอนทำระบบ POS (ระบบขายหน้าร้าน) Ep 7. สร้างไฟล์ สำหรับ เช็ค ข้อมูลการ Login (Login Part 1)
สอนทำระบบ POS (ระบบขายหน้าร้าน) Ep 7.
สร้างไฟล์ สำหรับ เช็ค ข้อมูลการ Login (Login Part 1)
ระบบ บริหารจัดการร้านกาแฟ PHP | FD22-Cafe (Coffee AND Bakery)
ระบบบริหารจัดการ รีสอร์ท | Booking Resort System PHP
CART&POS (ระบบจัดการงานขายหน้าร้านและ ออนไลน์ สำหรับร้านค้าขนาดกลาง,SME)
ระบบ POS (Point of Sale) ระบบขายหน้าร้าน ตัวเต็ม
(มีระบบ BarCode และ QR-Code รองรับเครื่องแสกน)
สอนทำระบบ POS (ระบบขายหน้าร้าน) Ep 7. สร้างไฟล์ สำหรับ เช็ค ข้อมูลการ Login (Login Part 1)
ไฟล์ chk_login.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
<?php session_start(); if(isset($_POST['mem_username'])){ //connection include("condb.php"); //รับค่า user & mem_password $mem_username = mysqli_real_escape_string($condb,$_POST['mem_username']); $mem_password = mysqli_real_escape_string($condb,sha1($_POST['mem_password'])); $chk = trim($mem_username) OR trim($mem_password); if($chk==''){ echo '<script>'; echo "alert(\" username หรือ mem_password ไม่ถูกต้อง\");"; echo "window.history.back()"; echo '</script>'; }//close if chk trim else{ //query $sql="SELECT * FROM tbl_member WHERE mem_username='".$mem_username."' AND mem_password='".$mem_password."' "; $result = mysqli_query($condb,$sql); //echo mysqli_num_rows($result); //exit; if(mysqli_num_rows($result)==1){ $row = mysqli_fetch_array($result); $_SESSION["mem_id"] = $row["mem_id"]; $_SESSION["mem_name"] = $row["mem_name"]; $_SESSION["ref_l_id"] = $row["ref_l_id"]; $_SESSION["mem_img"] = $row["mem_img"]; $_SESSION["mem_address"] = $row["mem_address"]; //print_r($_SESSION); //var_dump($_SESSION); //exit(); if($_SESSION["ref_l_id"]=="1"){ //ถ้าเป็น admin ให้กระโดดไปหน้า admin_page.php //echo "Are Your Admin"; //exit(); Header("Location: admin/"); } elseif($_SESSION["ref_l_id"]=="2"){ Header("Location: admin/"); } }else{ echo "<script>"; echo "alert(\" user หรือ mem_password ไม่ถูกต้อง\");"; echo "window.history.back()"; echo "</script>"; } }//close else chk trim //exit(); }else{ Header("Location: login.php"); //user & mem_password incorrect back to login again } ?> |
ไฟล์ logout.php
1 2 3 4 5 |
<?php session_start(); session_destroy(); header("Location: index.php "); ?> |