欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

简单的站内信系统

程序员文章站 2022-06-10 13:05:39
...
  到公司实习一个月了,做了十几年的学生,突然就变成了一名员工。从说“去上课了”变成了“去上班了”。会或多或少的有一些不适应,不管是生活方式还是学习方式甚至是朋友圈都有了特别大的变化。从开始的时候没有什么思路,不知道该怎么去适应公司的工作环境,该怎么去学习才能做一名合格的员工,该学习哪些知识才能适应公司的需求,那么多的工作我到底适合做哪一个。到现在为止,终于不是那么很迷茫,知道自己喜欢什么,知道自己适合什么,知道自己的目标是什么,愿意一步一步的去前进去奋斗,我想这就是很大的进步吧。每一份工作,每一次经历,我相信都会在某一方面给予我很大的启发。

  越努力越幸运,加油~!

1.主要实现功能及工具

  1>使用Mysql数据库,使用Bootstrap框架

  2>能够实现登录注册功能,带有简单的验证

  3>能够实现 发送邮件 查看邮件 选择收件人的功能

  4>发信时能够制定标题内容

2.注意事项

  1>提交按钮用标签,button标签不可以。出现问题:找不到请求按钮

  2>php代码和页面分开写,有时会出现一些notice提示,影响页面美观

  3>登录时注意用session保存登录的用户

  4>登录验证问题

  5>查看发件箱收件箱的sql语句要写收件人和发件人的条件,否则会显示所有信箱的内容

  6>注意一些值为空的情况要写判断语句

  7>注意格式排版!!慢慢提高,写的真的好乱~!

3.数据库设计

  1>用户表:ID,userID,username,password,confirmPassword,isAdmin,emial

  2>邮件内容:emailBoxID,receiver,sender,title,content

4.思路及步骤

  1>登录界面的实现

  2>数据库的设计

  3>主界面,注册界面的设计与实现

  4>发送邮件 邮件列表 发件箱 界面设计与实现

  5>查找缺陷进行补充

5.登录页面

简单的站内信系统
html>
    head>
        meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        title>邮箱登录title>
        link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css"/>
        link src="../bootstrap/js/jquery.min.cs"/>
        link src="../bootstrap.min.js"/>
    head> 
    style type="text/css">
            html,body{
                    height: 100%;
                    background-color: #A3D5FB;
            }
            
            .login-box{
                width: 100%;
                max-width: 400px;
                height: 700px;
                position: absolute;
                top: 50%;    
                margin-top: -200px;        
            }
            .form-group{
                margin-bottom: 30px;
            }
            .login-title{
                padding: 20px 10px;
                background-color: rgba(0,0,0,0.6)            
            }
            .login-title small{
                color: #fff;            
            }
            .login-content{
                height: 400px;
                width: 100%;
                max-width: 500px;
                background-color: rgba(255,255,255,0.6);
                float: left;            
            }
            @media screen and (min-width:500px){
                .login-box {
                        left: 50%;
                        margin-left: -250px;
    }
}
    .btn{
        padding: 6px 30px;
}
    .input-group{
        margin-bottom: 0px;
        margin: 0px 0px 30px 0px;
        height: 50px;    
    }
    .form-control{
        height: 50px;    
    }
    .link p{
        line-height: 20px;
        margin-top: 30px;    
        
    }

            
    style>
    body>
    script type="text/javascript">
        function doSubmit() {
            if($("#username").value()){
                alert("用户名不能为空");
                return;            
            }
            if ($("#password").value)) {
                alert("密码不能为空");
                return;
            }
            $("form1").submit();
        }
    script>

    
        div class="container">
            div class="box">
                div class="login-box">
                    div class="login-title text-center">
                        h1>small>站内信登录small>h1>
                    div>
                    div class="login-content">
                        form name="form1" method="post" action="../php/login.php">
                            
                                div class="form-group">
                                    div class="col-md-12">
                                        div class="input-group">
                                            span class="input-group-addon">span class="glyphicon glyphicon-user">span>span>
                                            input type="text" name="userID" id="userID" class="form-control" placeholder="用户ID">    
                                        div>
                                    div>
                                div>
                            
                                div class="form-group">
                                    div class="col-md-12">
                                        div class="input-group">
                                            span class="input-group-addon">span class="glyphicon glyphicon-lock">span>span>
                                            input type="password" name="password" id="password" class="form-control" placeholder="密码">            
                                        div>
                                    div>
                                div>
                            
                                div class="form-group">
                                    div class="col-md-4 col-md-offset-4">
                                        input class="btn btn-info active navbar-btn " name="submit" id="submit" type="submit" value="登录">
                                    div>
                                div>

                                    div class="form-group">

                                            div class="col-md-12 col-md-offset-9 link">
                                            div class="input-group">
                                                p class="text-center remove-margin"> a href="javascript:void(0)">忘记密码a>
                                                p>

                                                div>
                                            div>        
                                        div>
                                                            
                        form>                    
                    div>
                div>            
            div>
    body>
html>
login.html

6.帮助类

简单的站内信系统
 1 php
 2     if (!isset ($_SESSION)) {
 3     ob_start();
 4     session_start();
 5 }
 6  header("Content-type:text/html;charset=utf-8");
 7       $conn=mysql_connect('127.0.0.1','root','root');
 8      if($conn) {
 9          mysql_select_db("MailUserManage", $conn);
10          mysql_query("set names 'utf-8'");
11          }
12          else {
13              die();
14         }
15 ?>
helper.php

7.登录功能实现

 1 php
 2     require_once("helper.php");
 3     
 4 
 5 if(isset($_POST['submit'])) 
 6 {
 7         $userID=$_POST['userID'];
 8         $password=$_POST['password'];
 9         $sql="select * from Users where userID='$userID'";
10         $result=mysql_query($sql) or die("帐号不正确");
11         $num=mysql_num_rows($result);
12          if($num) {
13             $row=mysql_fetch_array($result);
14             
15         if($row['password']==$password) {    
16             echo "登录成功,正在为您跳转至邮箱首页";    
17             $_SESSION['Users']=$_POST['userID'];
18             header("Location:../index.php");
19         }
20         else {        
21             echo "";
22             mysql_close();
23         }
24     }
25     }
26     else{
27         echo "";    
28     }
29 
30 ?>

8.注册界面

  1 html>
  2 
  3     head>
  4         meta charset="utf-8">
  5             title>注册新用户title>
  6             link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css"/>
  7             link src="../bootstrap/js/jquery.min.cs"/>
  8             link src="../bootstrap.min.js"/>
  9             script>
 10                 
 11             script>
 12             
 13     head>
 14     style type="text/css">
 15             body{
 16                     height: 100%;
 17                     background-color: #A3D5FB;
 18             }
 19             
 20             .login-box{
 21                 width: 100%;
 22                 max-width: 400px;
 23                 height: 800px;
 24                 position: absolute;
 25                 top: 50%;    
 26                 margin-top: -300px;        
 27             }
 28             .form-group{
 29                 margin-bottom: 30px;
 30             }
 31             .login-title{
 32                 padding: 20px 10px;
 33                 background-color: rgba(0,0,0,0.6)            
 34             }
 35             .login-title small{
 36                 color: #fff;            
 37             }
 38             .login-content{
 39                 height: 500px;
 40                 width: 100%;
 41                 max-width: 600px;
 42                 background-color: rgba(255,255,255,0.6);
 43                 float: left;
 44                 padding-top: 20px;            
 45             }
 46             @media screen and (min-width:500px){
 47                 .login-box {
 48                         left: 50%;
 49                         margin-left: -250px;
 50     }
 51 }
 52     .btn{
 53         padding: 6px 30px;
 54 }
 55     .input-group{
 56         margin-bottom: 0px;
 57         margin: 0px 0px 30px 0px;
 58         height: 50px;    
 59     }
 60     .form-control{
 61         height: 50px;    
 62     }
 63     .link p{
 64         line-height: 20px;
 65         margin-top: 30px;    
 66         
 67     }
 68     .navbar-btn{
 69         margin-top: 0px;    
 70     }        
 71     
 72     style>
 73         
 74             
 75 
 76     
 77             form method="post" action="../php/regist.php">
 78 
 79             div class="container">
 80             div class="box">
 81                 div class="login-box">
 82                     div class="login-title text-center">
 83                         h1>small>用户注册small>h1>
 84                     div>
 85                     div class="login-content">    
 86                             
 87                                 div class="form-group">
 88                                     div class="col-md-12">
 89                                         div class="input-group">
 90                                             span class="input-group-addon">  IDspan>
 91                                             input type="text" name="userID" id="userID" class="form-control" placeholder="只能为字母和数字,以字母开头,长度6-10位">
 92                                         div>
 93                                     div>
 94                                 div>
 95                                 
 96                             
 97                                 div class="form-group">
 98                                     div class="col-md-12">
 99                                         div class="input-group">
100                                             span class="input-group-addon">      span>
101                                             input type="password" name="password" id="password" class="form-control" placeholder="6位以上">            
102                                         div>
103                                     div>
104                                 div>
105                                 
106                                 
107                                 div class="form-group">
108                                     div class="col-md-12">
109                                         div class="input-group">
110                                             span class="input-group-addon">确认密码span>
111                                             input type="password" name="configPassword" id="configPassword" class="form-control" placeholder="确认密码">            
112                                         div>
113                                     div>
114                                 div>
115                                 
116                                 div class简单的站内信系统

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频