PHP-MYSQL hotel room management system (with source code)

PHP-MYSQL hotel room management system (with source code)


is divided into Foreground user and Backstage administrator Two roles, with complete functions, beautiful interface and good operation. (There is a way to obtain the source code at the end of the article)

The main function

Use:

  • View room information

  • Online booking

  • Order Tracking

  • Information messages, etc.

Management staff

  • Check-in management: (lobby check-in, order check-in, check-in inquiry, check-in statistics)
  • Check-out management: (check-out clearing)
  • Room management: (Add room, room edit)
  • Room category management: (Add new room category, edit room category)
  • Album management: (Add album, edit album)
  • Message management: (View messages)
  • System management: (Add personnel, change password, exit the system)

main language

PHP MySQL JavaScript HTML JQuery

This system adoptsphpstudy development platform, using PHP and MySQL database for development, and the development tool is HBuilder. At the same time, it can run normally in editor software such as Dw, PHPstorm, submit, Vscode, etc.

phpStudy is a PHP debugging environment program that integrates the latest Apache+PHP+MySQL+phpMyAdmin. It can be installed once and can be used without configuration. It is a very convenient and easy-to-use PHP debugging environment. (Other development platforms are acceptable)

Part of the interface

  • Backend login

Backend login

<?php
require("../dbconnect.php");
if($_POST['action'] == "test")
{
    
    
  function make_safe($variable) 
  {
    
     
    $variable = addslashes(trim($variable)); 
    return $variable; 
  } 

  $user=make_safe($_POST["username"]); 
  $pass=make_safe($_POST["pwd"]); 
 
  $sql="select * from admin where name='$user'";
  $result=mysqli_query($db_link,$sql);
  $row = mysqli_fetch_assoc($result); 
  if($row==false)
  {
    
    
    echo "<script language='javascript'>alert('不存在此用户!');history.back();</script>";
    exit;
  }
  else
  {
    
     
    if($row["passwd"]==$pass)
    {
    
    
      session_start();
      $_SESSION['aname']=$row["name"];
      // 重定向
      header("location:admin_index.php");
      exit;
    }
    else 
    {
    
    
      echo "<script language='javascript'>alert('密码输入错误!');history.back();</script>";
      exit;
    }
   
  }
}
?>
  • Online booking

Online booking

<?php
              require("dbconnect.php");
              $pagesize = 10;
              $sql = "select a.roomid,b.typeid,b.typename,b.area,b.hasNet,b.hasTV,b.price from room a,roomtype b where a.typeid=b.typeid and a.status='否' and b.leftnum>0 and a.roomid not in (select roomid from orders where ostatus='是')";
              $rs=mysqli_query($db_link,$sql);
              if(!$rs)
              {
    
    
                  echo "抱歉,房间已满";
                  exit;
              }
              $recordcount=mysqli_num_rows($rs);
              $pagecount=($recordcount-1)/$pagesize+1;
              $pagecount=(int)$pagecount;
              $pageno=@$_GET["pageno"];
              if($pageno=="")
              {
    
    
                  $pageno=1;
              }
              if($pageno>$pagecount)
              {
    
    
                  $pageno=$pagecount;
              }
              $startno=($pageno-1)*$pagesize;
              $sql="select a.roomid,b.typeid,b.typename,b.area,b.hasNet,b.hasTV,b.price from room a,roomtype b where a.typeid=b.typeid and a.status='否' and b.leftnum>0 and a.roomid not in (select roomid from orders where ostatus='是') order by roomid asc limit $startno,$pagesize";
           
              $rs=mysqli_query($db_link,$sql);
              if(!$rs)
              {
    
    
                  echo "抱歉,房间已满";
                  exit;
              }
              while($rows=mysqli_fetch_assoc($rs))
              {
    
      ?>
                <tr>
                <td class='tc'><?php echo $rows["roomid"] ?></td>
                <td class='tc'><?php echo $rows["typeid"] ?></td>
                <td class='tc'><?php echo $rows["typename"] ?></td>
                <td class='tc'><?php echo $rows["area"] ?></td>
                <td class='tc'><?php echo $rows["hasNet"] ?></td>
                <td class='tc'><?php echo $rows["hasTV"] ?></td>
                <td class='tc'><?php echo $rows["price"] ?></td>
                
                <td class='tc'>
                <a href='online_order.php?orid=<?php echo $rows["roomid"] ?>'  class='link-update'>在线预订</a>
                </td>
                </tr>

            <?php } ?>          
  • Order Tracking

Order Tracking

<?php
      require("dbconnect.php");
      $sql="select a.roomid,b.typeid,b.typename,b.price from room a,roomtype b where a.typeid=b.typeid and a.roomid='".$_GET["orid"]."'";
      $arr=mysqli_query($db_link,$sql);
      $rows=mysqli_fetch_row($arr);
 ?>
  • Album management

Album management

<?php
              require("../dbconnect.php");
              $pagesize = 10;
              $sql = "select * from news";
              $rs=mysqli_query($db_link,$sql);
              if(!$rs)
              {
    
    
                  echo "无相册信息!";
                  exit;
              }
              $recordcount=mysqli_num_rows($rs);
              $pagecount=($recordcount-1)/$pagesize+1;
              $pagecount=(int)$pagecount;
              $pageno=@$_GET["pageno"];
              if($pageno=="")
              {
    
    
                  $pageno=1;
              }
              if($pageno>$pagecount)
              {
    
    
                  $pageno=$pagecount;
              }
              $startno=($pageno-1)*$pagesize;
              $sql="select * from news order by id asc limit $startno,$pagesize";
           
              $rs=mysqli_query($db_link,$sql);
              if(!$rs)
              {
    
    
                  echo "无相册信息";
                  exit;
              }
              while($rows=mysqli_fetch_assoc($rs))
              {
    
      ?>
                <tr>
                <td class='tc'><?php echo $rows["id"] ?></td>
                <td class='tc'><?php echo $rows["title"] ?></td>
                <td class='tc'>
                <img height='auto' width="60px" src='../images/<?php echo $rows["spic"] ?>'>
                </td>
                <td class='tc'>
                <img height='auto' width="60px" src='../images/<?php echo $rows["bpic"] ?>'>
                </td>
                <td class='tc'><?php echo $rows["describes"] ?></td>
                <td class='tc'>
                <a href='admin_photomod.php?pid=<?php echo $rows["id"] ?>'  class='link-update'>修改</a>&nbsp;&nbsp;<a href='delete.php?pid=<?php echo $rows["id"] ?>' class='link-del''>删除</a>
                </td>
                </tr>
            <?php } ?>
  • Check-in at lobby

Check-in at lobby

<?php
              require("../dbconnect.php");
              $pagesize = 10;
              $sql = "select a.roomid,b.typeid,b.typename,b.area,b.hasNet,b.hasTV,b.price from room a,roomtype b where a.typeid=b.typeid and a.status='否' and b.leftnum>0 and a.roomid not in (select roomid from orders where ostatus='是')";
              $rs=mysqli_query($db_link,$sql);
              if(!$rs)
              {
    
    
                  echo "抱歉,房间已满!";
                  exit;
              }
              $recordcount=mysqli_num_rows($rs);
              $pagecount=($recordcount-1)/$pagesize+1;
              $pagecount=(int)$pagecount;
              $pageno=@$_GET["pageno"];
              if($pageno=="")
              {
    
    
                  $pageno=1;
              }
              if($pageno>$pagecount)
              {
    
    
                  $pageno=$pagecount;
              }
              $startno=($pageno-1)*$pagesize;
              $sql="select a.roomid,b.typeid,b.typename,b.area,b.hasNet,b.hasTV,b.price from room a,roomtype b where a.typeid=b.typeid and a.status='否' and b.leftnum>0 and a.roomid not in (select roomid from orders where ostatus='是') order by a.roomid asc limit $startno,$pagesize";
           
              $rs=mysqli_query($db_link,$sql);
              if(!$rs)
              {
    
    
                  echo "抱歉,房间已满";
                  exit;
              }
              while($rows=mysqli_fetch_assoc($rs))
              {
    
      ?>
                <tr>
                <td class='tc'><?php echo $rows["roomid"] ?></td>
                <td class='tc'><?php echo $rows["typeid"] ?></td>
                <td class='tc'><?php echo $rows["typename"] ?></td>
                <td class='tc'><?php echo $rows["area"] ?></td>
                <td class='tc'><?php echo $rows["hasNet"] ?></td>
                <td class='tc'><?php echo $rows["hasTV"] ?></td>
                <td class='tc'><?php echo $rows["price"] ?></td>
                
                <td class='tc'>
                <a href='admin_order.php?orid=<?php echo $rows["roomid"] ?>'  class='link-update'>办理入住</a>
                </td>
                </tr>
            <?php } ?>
  • Personnel added

Personnel added

<?php
              require("../dbconnect.php");
              $pagesize = 10;
              $sql = "select * from admin";
              $rs=mysqli_query($db_link,$sql);
              $recordcount=mysqli_num_rows($rs);
              $pagecount=($recordcount-1)/$pagesize+1;
              $pagecount=(int)$pagecount;
              $pageno=@$_GET["pageno"];
              if($pageno=="")
              {
    
    
                  $pageno=1;
              }
              if($pageno>$pagecount)
              {
    
    
                  $pageno=$pagecount;
              }
              $startno=($pageno-1)*$pagesize;
              $sql="select * from admin order by id asc limit $startno,$pagesize";
              $rs=mysqli_query($db_link,$sql);
              while($rows=mysqli_fetch_assoc($rs))
              {
    
    
                ?>                            
                <tr>
                <td class='tc'><?php echo $rows["id"] ?></td>
                <td class='tc'><?php echo $rows["name"] ?></td>
                <td class='tc'><?php echo $rows["passwd"] ?></td>
                <td class='tc'>
                <a href='delete.php?id=<?php echo $rows["id"] ?>'  class='link-update'>删除</a>
                </td>
                              
                </tr>

           <?php } ?>

Demo video

method of obtaining

Method 1:Jump to get the source code
Method 2: Search the official account for "numbed bald head" and reply "hotel room"

Other systems
system

Guess you like

Origin blog.csdn.net/qq_57161040/article/details/129683829
Recommended