程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> 簡單的站內信系統,簡單站內信系統

簡單的站內信系統,簡單站內信系統

編輯:關於PHP編程

簡單的站內信系統,簡單站內信系統


  到公司實習一個月了,做了十幾年的學生,突然就變成了一名員工。從說“去上課了”變成了“去上班了”。會或多或少的有一些不適應,不管是生活方式還是學習方式甚至是朋友圈都有了特別大的變化。從開始的時候沒有什麼思路,不知道該怎麼去適應公司的工作環境,該怎麼去學習才能做一名合格的員工,該學習哪些知識才能適應公司的需求,那麼多的工作我到底適合做哪一個。到現在為止,終於不是那麼很迷茫,知道自己喜歡什麼,知道自己適合什麼,知道自己的目標是什麼,願意一步一步的去前進去奮斗,我想這就是很大的進步吧。每一份工作,每一次經歷,我相信都會在某一方面給予我很大的啟發。

  越努力越幸運,加油~!

 

1.主要實現功能及工具

  1>使用Mysql數據庫,使用Bootstrap框架

  2>能夠實現登錄注冊功能,帶有簡單的驗證

  3>能夠實現  發送郵件 查看郵件  選擇收件人的功能

  4>發信時能夠制定標題內容

2.注意事項

  1>提交按鈕用<input type="submit">標簽,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"> <!--用戶ID--> <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 "<script>alert('密碼錯誤,請重新輸入');</script>";
22             mysql_close();
23         }
24     }
25     }
26     else{
27         echo "<script>alert('請登錄用戶');</script>";    
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                             <!--用戶ID-->
 87                                 <div class="form-group">
 88                                     <div class="col-md-12">
 89                                         <div class="input-group">
 90                                             <span class="input-group-addon">用&nbsp;戶&nbsp;ID</span>
 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">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;碼</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="form-group">
117                                     <div class="col-md-12">
118                                         <div class="input-group">
119                                             <span class="input-group-addon">昵&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;稱</span>
120                                             <input type="text" name="username" id="username" class="form-control" placeholder="昵稱">            
121                                         </div>
122                                     </div>
123                                 </div>
124                                 <!--郵箱-->
125                                 <div class="form-group">
126                                     <div class="col-md-12">
127                                         <div class="input-group">
128                                             <span class="input-group-addon">郵&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱</span>
129                                             <input type="eamil" name="email" id="email" class="form-control" placeholder="郵箱">            
130                                         </div>
131                                     </div>
132                                 </div>
133                             <!--注冊按鈕-->
134                                 
135                                     <div class="col-md-4 col-md-offset-4">
136                                         <input class="btn btn-success active navbar-btn " name="submit"  type="submit" value="注冊">
137                                     </div>            
138                     </div>
139                 </div>            
140             </div>
141             </div>
142             </form>
143     </body>
144 </html>

9.注冊功能的實現

1 <?php 2 3 require_once("helper.php"); 4 5 if($_POST["submit"]) 6 { 7 8 if(empty($_POST['userID'])) 9 echo "<script>alert('帳號不能為空');location='regist.html';</script>"; 10 else if(empty($_POST['password'])) 11 echo "<script>alert('密碼不能為空');location='regist.html';</script>"; 12 else if($_POST['configPassword']!=$_POST['password']) 13 echo "<script>alert('兩次密碼不一樣');location='regist.html';</script>"; 14 elseif(empty($_POST['username'])) 15 echo "<script>alert('昵稱不能為空');location='regist.html';</script>"; 16 else if(!empty($_POST['email'])&&!ereg("([0-9a-zA-Z]+)([@])([0-9a-zA-Z]+)(.)([0-9a-zA-Z]+)",$_POST['email'])) 17 echo "<script>alert('郵箱輸入不合法');location='regist.html';</script>"; 18 19 else { 20 $userID=$_POST['userID']; 21 $password=$_POST['password']; 22 $configPassword=$_POST['configPassword']; 23 $username=$_POST['username']; 24 $email=$_POST['email']; 25 26 //檢測用戶ID是否已經存在 27 $check_query = mysql_query("select userID from Users where userID='$userID'"); 28 29 if(mysql_fetch_array($check_query)) 30 { 31 echo '用戶名已經存在。請重新輸入'; 32 } 33 else 34 { 35 $sql = "INSERT INTO Users(userID,password,configPassword,username,email,admin)VALUES('$userID','$password','$configPassword','$username','$email','1')"; 36 if(mysql_query($sql)){ 37 echo('用戶注冊成功將為您跳轉至登陸界面'); 38 header("Location:../html/login.html"); 39 var_dump($_POST); 40 41 } 42 43 else { 44 echo ''; 45 mysql_error(); 46 } 47 } 48 } 49 } 50 else 51 { 52 echo "不存在submit"; 53 } 54 55 ?> regist.php

10.主界面

1 <?php 2 require_once("php/helper.php"); 3 if($_SESSION['Users']) { 4 $result=mysql_query("select * from Users where userID='".$_SESSION['Users']."'"); 5 while($rs=mysql_fetch_array($result)){ 6 ?> 7 <html> 8 <head> 9 <meta charset="utf-8"/> 10 <meta name="viewport" content="width=device-width,initial-scale=1.0"> 11 <title>站內信</title> 12 <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/> 13 <link src="bootstrap/js/jquery.min.cs"/> 14 <link src="bootstrap.min.js"/> 15 <style type="text/css"> 16 .navbar-header{ 17 background-image: images/headback.gif; 18 } 19 .btn{ 20 padding: 10px 37.5px; 21 background-color: #D8E7F1; 22 } 23 .header{ 24 position: fixed; 25 left: 0; 26 right: 0; 27 z-index: 1002; 28 min-height: 60px; 29 padding: :0 15px; 30 display: block; 31 32 } 33 .navbar-btn{ 34 margin-top: 0px; 35 margin-bottom: 0px; 36 } 37 .nav-bg{ 38 background: #A3D5FB; 39 border-bottom: 1px solid #A3D5FB; 40 height: 80px; 41 } 42 43 .nav-tabs{ 44 margin-top: 38px; 45 margin-left: 190px; 46 } 47 .nav-tabs>li>a{ 48 margin-right: 0px; 49 } 50 .nav>li>a{ 51 padding: 10px 60px; 52 } 53 .nav-tabs > li.active > a, .nav-tabs > li.active > a:focus, .nav-tabs > li.active > a:hover{ 54 background-color: #E3EEF7; 55 } 56 .aside{ 57 background: #F5F8FD; 58 height: 100%; 59 width: 210px; 60 } 61 .leftaside 62 { 63 background-color:#E3EEF7; 64 } 65 .navbar-collapse{ 66 padding-right: 0px; 67 padding-left: 0px; 68 } 69 .newUser{ 70 padding-left: 570px; 71 } 72 .container{ 73 position: absolute; 74 left:-220px; 75 top: 86px; 76 bottom:0px; 77 right: 0px; 78 z-index: 23; 79 } 80 .inner{ 81 padding: 8px;24px;18px;28px; 82 } 83 .title{ 84 float: left; 85 margin-top: 8px; 86 margin-left: 20px; 87 height: 24px; 88 font-size: 16px; 89 width: 950px; 90 } 91 .headphoto{ 92 width: 106px; 93 height: 106px; 94 float: left; 95 } 96 .menu{ 97 height: 85px; 98 margin-left: 10px; 99 margin-top: 30px; 100 height: 30px; 101 float: left; 102 103 } 104 105 li{ 106 display: inline-block; 107 108 } 109 .xuanxiang{ 110 width: 70px; 111 } 112 </style> 113 </head> 114 <body> 115 <div class="container-fluid "> 116 <header class="nav-bg"> 117 <div class="navbar-header"> 118 <a href="#"><img src="images/logo.jpg" height="80px"width="210px" alt="郵箱logo"></a> 119 </div> 120 <div class="collapse navbar-collapse"> 121 <ul class="nav nav-tabs" > 122 <li class="active"><a href="#">首頁</a></li> 123 <li class="active"><a href="#">通訊錄</a></li> 124 <li class="active"><a href="#">應用中心</a></li> 125 <li class="active"><a href="html/mailList.php">收件箱</a></li> 126 127 <li class="newUser"><a href="html/regist.html">注冊新用戶</a></li> 128 <li class="newUser1"><a href="html/update.html">修改密碼</a></li> 129 </ul> 130 </div> 131 </header> 132 <aside> 133 <div class="aside"> 134 <div class="btn-group"> 135 <a class="btn btn-default" href="html/sendEmail.php" >寫信</a> 136 <a class="btn btn-default"href="html/mailList.php">收信</a> 137 138 </div> 139 140 <div class="collapse navbar-collapse"> 141 <ul class="nav"> 142 <li><a class="leftaside" href="html/mailList.php">收件箱</a></li> 143 <li><a class="leftaside" >草稿箱</a></li> 144 <li><a class="leftaside" href="html/sendBox.php">已發送</a></li> 145 </ul> 146 </div> 147 </div> 148 </aside> 149 <div class="container"> 150 <div class="inner"> 151 <div class="content-top"> 152 153 <div class="headphoto"> 154 <img src="images/cat.jpg" height="100px" width="100px" alt="用戶頭像"> 155 </div> 156 <div class="title"> 157 <span><?php echo htmlspecialchars($rs['userID']);?></span> 158 <span>,歡迎進入郵箱首頁</span> 159 </div> 160 <div class="menu"> 161 <ul class="list"> 162 <li class="xuanxiang"><a href="">未讀郵件</a></li> 163 <li class="xuanxiang"><a href="">待辦郵件</a></li> 164 165 <li class="xuanxiang"><a href="">訂閱中心</a></li> 166 167 </ul> 168 </div> 169 </div> 170 </div> 171 </div> 172 <?php 173 } 174 } 175 else { 176 echo "用戶未登錄"; 177 } 178 179 ?> 180 </body> 181 </html> index.php

11.發送郵件頁面

1 <?php 2 require_once("../php/helper.php"); 3 if($_SESSION['Users']) { 4 $result=mysql_query("select * from Users where userID='".$_SESSION['Users']."'"); 5 $sql=mysql_query("select userID from Users"); 6 7 while($rs=mysql_fetch_array($result)){ 8 $sender=htmlspecialchars($rs['userID']); 9 10 ?> 11 12 <html> 13 <head> 14 <meta charset="utf-8"/> 15 <meta name="viewport" content="width=device-width,initial-scale=1.0"> 16 <title>站內信</title> 17 <script src="../jquery-3.1.0.min.js"></script> 18 <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css"/> 19 <link src="../bootstrap/js/jquery.min.cs"/> 20 <link src="../bootstrap.min.js"/> 21 <style type="text/css"> 22 23 24 .p-window { 25 position: absolute; 26 border: 1px #888 solid; 27 top: 50%; 28 left: 50%; 29 background: #FFF; 30 border-radius: 3px; 31 z-index: 100; 32 } 33 34 .p-title { 35 height: 25px; 36 line-height: 25px; 37 font-size: 14px; 38 text-align: center; 39 background: #F2F2F2; 40 } 41 .p-content-container 42 { 43 width: 484px; 44 height: 393px; 45 46 } 47 .p-toolbar{ 48 49 width: 484px; 50 height: 46px; 51 } 52 53 .p-left{ 54 55 width: 195px; 56 height: 392px; 57 float: left; 58 padding: 20px 32px; 59 } 60 .p-left-box{ 61 width: 197px; 62 height: 329px; 63 border:1px #DFDFDF solid; 64 border-radius: 3px; 65 } 66 .p-right{ 67 width: 197px; 68 height: 392px; 69 float: right; 70 padding: 20px 32px; 71 } 72 .p-right-title{ 73 margin-left: -60px; 74 75 } 76 .p-right-box{ 77 width: 197px; 78 height: 329px; 79 border:1px #DFDFDF solid; 80 border-radius:3px; 81 margin-left:-65px; 82 83 } 84 85 .glyphicon-arrow-right{ 86 87 top: 160px; 88 left:40px; 89 } 90 91 92 93 94 .navbar-header{ 95 background-image: images/headback.gif; 96 } 97 .function{ 98 padding: 10px 37.5px; 99 background-color: #D8E7F1; 100 } 101 .header{ 102 position: fixed; 103 left: 0; 104 right: 0; 105 z-index: 1002; 106 min-height: 60px; 107 padding: :0 15px; 108 display: block; 109 110 } 111 .navbar-btn{ 112 margin-top: 0px; 113 margin-bottom: 0px; 114 } 115 .nav-bg{ 116 background: #A3D5FB; 117 border-bottom: 1px solid #A3D5FB; 118 height: 80px; 119 } 120 121 .nav-tabs{ 122 margin-top: 38px; 123 margin-left: 0px; 124 } 125 .nav-tabs>li>a{ 126 margin-right: 0px; 127 } 128 .nav>li>a{ 129 padding: 10px 60px; 130 } 131 .nav-tabs > li.active > a, .nav-tabs > li.active > a:focus, .nav-tabs > li.active > a:hover{ 132 background-color: #E3EEF7; 133 } 134 .aside{ 135 background: #F5F8FD; 136 height: 100%; 137 width: 210px; 138 } 139 .leftaside 140 { 141 background-color:#E3EEF7; 142 } 143 .navbar-collapse{ 144 padding-right: 0px; 145 padding-left: 0px; 146 } 147 .newUser{ 148 padding-left: 570px; 149 } 150 151 152 .container{ 153 position: absolute; 154 left:-150px; 155 top: 100px; 156 bottom:0px; 157 right: 0px; 158 z-index: 23; 159 } 160 .anniu{ 161 margin-top: 0px; 162 } 163 .content{ 164 margin-top: 15px; 165 166 } 167 .input-group , .text{ 168 margin-bottom: 0px; 169 margin: 0px 0px 25px 0px; 170 171 } 172 .footer{ 173 float: right; 174 } 175 .receiver 176 { 177 cursor:pointer 178 } 179 .p-button{ 180 float: right; 181 width: 150px; 182 } 183 .p-select{ 184 width: 100%; 185 height: 100%; 186 } 187 select[multiple]{ 188 189 height: 100%; 190 191 } 192 </style> 193 </head> 194 <body> 195 196 197 198 <script> 199 200 /** 201 * window class 202 * @param {Object} options 203 * options = { 204 * width : 400, 205 * height : 300 206 * title : '', 207 * content : '', 208 * buttons : [{ 209 * name : 'submit', 210 * clickEvent : function() { 211 * } 212 * }, { 213 * name : 'close', 214 * clickEvent : function() { 215 * 216 * }] 217 * } 218 */ 219 var PWindow = function(options) { 220 this.defaultOptions = options; 221 222 this.handler = { 223 window : null 224 }; 225 226 this.createWindow = function() { 227 this.handler.window = $(this.defaultOptions.content).hide(); 228 return this; 229 }; 230 231 this.layout = function() { 232 this.handler.window.width(this.defaultOptions.width).height(this.defaultOptions.height) 233 .css({ 234 marginTop : -1 * this.defaultOptions.height/2, 235 marginLeft : -1 * this.defaultOptions.width/2 236 }); 237 238 $('.p-title').html(this.defaultOptions.title); 239 $('.p-left-title').html(this.defaultOptions.lefttitle); 240 $('.p-right-title').html(this.defaultOptions.righttitle); 241 242 return this; 243 } 244 }; 245 246 PWindow.prototype.show = function(msg) { 247 this.handler.window.show(); 248 console.log('ok'); 249 return this; 250 }; 251 252 PWindow.prototype.close = function() { 253 this.handler.window.empty().remove(); 254 return this; 255 }; 256 257 PWindow.prototype.render = function() { 258 this.createWindow(); 259 260 $('body').append(this.handler.window); 261 262 this.layout(); 263 return this; 264 } 265 266 267 var win; 268 269 function cl() { 270 win.close(); 271 } 272 273 function ok() { 274 275 var receiver=$(".p-select-user").text(); 276 277 $('#receiver').val(receiver); 278 279 win.close(); 280 281 } 282 283 function rt() { 284 var selectedValues = []; 285 $("#p-select :selected").each(function(){ 286 selectedValues.push($(this).val()); 287 }); 288 $(".p-select-user").text(selectedValues); 289 } 290 291 $(function() { 292 $('.receiver').on('click', function() { 293 294 win = new PWindow({ 295 width : 486, 296 height : 467, 297 title : '快速添加收件人', 298 lefttitle:'所有聯系人', 299 righttitle:'收件人', 300 content : '<div class="p-window"><div class="p-title"></div> <div class="p-content-container"><div class="p-left"><div class="p-left-title"></div><div class="p-left-box"><select id="p-select" class="p-select" multiple="multiple" onchange="rt()"><option value="">----------請選擇----------</option><?php $info=mysql_query("select userID from Users");while($rt=mysql_fetch_array($info)){ ?><option><?php echo $rt['userID']; ?></option><?php } ?></select></div></div> <span class="glyphicon glyphicon-arrow-right"></span> <div class="p-right"><div class="p-right-title"></div><div class="p-right-box"><table class="table"><tr><td class="p-select-user"></td></tr></table></div></div></div> <div class="p-toolbar"><div class="p-button"><input type="button" onClick="ok()" value="確定"><input type="button" value="取消" onClick="cl()"></div></div> </div> ' 301 }); 302 303 304 305 win.render().show(); 306 307 }); 308 }); 309 310 311 312 </script> 313 314 315 <div class="container-fluid "> 316 <header class="nav-bg"> 317 <div class="navbar-header"> 318 <a href="#"><img src="../images/logo.jpg" height="80px"width="210px" alt="郵箱logo"></a> 319 </div> 320 <div class="collapse navbar-collapse"> 321 <ul class="nav nav-tabs" > 322 <li class="active"><a href="../index.php">首頁</a></li> 323 <li class="active"><a href="#">通訊錄</a></li> 324 <li class="active"><a href="#">應用中心</a></li> 325 <li class="active"><a href="mailList.php">收件箱</a></li> 326 <li class="newUser"><a href="regist.html">注冊新用戶</a></li> 327 <li class="newUser1"><a href="update.html">修改密碼</a></li> 328 </ul> 329 </div> 330 </header> 331 <aside> 332 <div class="aside"> 333 <div class="btn-group"> 334 <a class="btn btn-default function" href="sendEmail.php" role="button">寫信</a> 335 <a class="btn btn-default function" role="button" href="mailList.php">收信</a> 336 </div> 337 338 <div class="collapse navbar-collapse"> 339 <ul class="nav"> 340 <li><a class="leftaside" href="mailList.php">收件箱</a></li> 341 <li><a class="leftaside">草稿箱</a></li> 342 <li><a class="leftaside"href="sendBox.php">已發送</a></li> 343 </ul> 344 </div> 345 </div> 346 </aside> 347 348 <form method="post" action="../php/SE.php"> 349 <div class="container"> 350 <div class="toolbar"> 351 <input class="btn btn-success button" name="submit" type="submit" id="submit" value="發送"> 352 </div> 353 354 <div class="content"> 355 <header> 356 357 <div class="input-group"> 358 <span class="input-group-addon receiver">收件人</span> 359 <input type="text" role="presentation" class="form-control" name="receiver" id="receiver"> 360 </div> 361 <div class="input-group"> 362 <span class="input-group-addon info">主&nbsp;&nbsp;&nbsp;&nbsp;題</span> 363 <input type="text"class="form-control" name="title"> 364 </div> 365 </header> 366 <div class="text"> 367 <textarea>368 </div> 369 <div class="footer"> 370 <span>發件人:<?php echo $sender;?></span> 371 </div> 372 </div> 373 </div> 374 </form> 375 376 <?php 377 } 378 } 379 else { 380 echo "用戶未登錄"; 381 } 382 383 ?> 384 385 386 </body> 387 </html> sendEmail.php

12.發送郵件功能

<?php require_once("../php/helper.php"); if($_SESSION['Users']) { $result=mysql_query("select * from Users where userID='".$_SESSION['Users']."'"); while($rs=mysql_fetch_array($result)){ $sender=htmlspecialchars($rs['userID']); if($_POST['submit']){ if(empty($_POST['receiver'])) echo "<script>alert('收件人不能為空,請選擇收件人');location='../html/sendEmail.html';</script>"; else if(empty($_POST['title'])) echo "<script>alert('主題不能為空,請填寫主題');location='../html/sendEmail.html'</script>"; else if(empty($_POST['content'])) echo "<script>alert('內容不能為空,請填寫內容');location='../html/sendEmial.html'</script>"; else { $receiver=$_POST['receiver']; $re =split ('[,]', $receiver); $title=$_POST['title']; $content=$_POST['content']; for($i=0;$i<count($re);$i++){ echo $re[$i]; echo $sql="INSERT INTO EmailBox(receiver,sender,title,content)VALUES('$re[$i]','$sender','$title','$content')"; } if(mysql_query($sql)) { echo "<script>alert('發送成功');location='../html/sendEmail.php'</script>"; } else { echo"發送失敗!"; mysql_error(); } } } else { echo "不存在submit"; } } } ?> SE.php

13.郵件列表

1 <?php 2 include('../php/helper.php'); 3 if(empty($_SESSION['Users'])){ 4 echo "<script>alert('請進行登錄或注冊!');location='../index.php';"; 5 } 6 ?> 7 8 9 <html> 10 <head> 11 <meta charset="utf-8"/> 12 <meta name="viewport" content="width=device-width,initial-scale=1.0"> 13 <title>站內信</title> 14 <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css"/> 15 <link src="../bootstrap/js/jquery.min.cs"/> 16 <link src="../bootstrap.min.js"/> 17 <style type="text/css"> 18 .navbar-header{ 19 background-image: images/headback.gif; 20 } 21 .function{ 22 padding: 10px 37.5px; 23 background-color: #D8E7F1; 24 } 25 .header{ 26 position: fixed; 27 left: 0; 28 right: 0; 29 z-index: 1002; 30 min-height: 60px; 31 padding: :0 15px; 32 display: block; 33 34 } 35 .navbar-btn{ 36 margin-top: 0px; 37 margin-bottom: 0px; 38 } 39 .nav-bg{ 40 background: #A3D5FB; 41 border-bottom: 1px solid #A3D5FB; 42 height: 80px; 43 } 44 45 .nav-tabs{ 46 margin-top: 38px; 47 margin-left: 0px; 48 } 49 .nav-tabs>li>a{ 50 margin-right: 0px; 51 } 52 .nav>li>a{ 53 padding: 10px 60px; 54 } 55 .nav-tabs > li.active > a, .nav-tabs > li.active > a:focus, .nav-tabs > li.active > a:hover{ 56 background-color: #E3EEF7; 57 } 58 .aside{ 59 background: #F5F8FD; 60 height: 100%; 61 width: 210px; 62 } 63 .leftaside 64 { 65 background-color:#E3EEF7; 66 } 67 .navbar-collapse{ 68 padding-right: 0px; 69 padding-left: 0px; 70 } 71 .newUser{ 72 padding-left: 570px; 73 } 74 75 76 .container{ 77 position: absolute; 78 left:210px; 79 top: 80px; 80 bottom:0px; 81 right: 0px; 82 z-index: 23; 83 width: 1812px; 84 padding-left: 0px; 85 } 86 .container-fluid{ 87 padding-left: 0px; 88 padding-right: 0px; 89 } 90 .anniu{ 91 margin-top: 0px; 92 } 93 .content{ 94 margin-top: 15px; 95 96 } 97 .input-group , .text{ 98 margin-bottom: 0px; 99 margin: 0px 0px 25px 0px; 100 101 } 102 .footer{ 103 float: right; 104 } 105 106 .table{ 107 width: 100%; 108 text-align: center; 109 } 110 </style> 111 </head> 112 <body> 113 <div class="container-fluid "> 114 <header class="nav-bg"> 115 <div class="navbar-header"> 116 <a href="#"><img src="../images/logo.jpg" height="80px"width="210px" alt="郵箱logo"></a> 117 </div> 118 <div class="collapse navbar-collapse"> 119 <ul class="nav nav-tabs" > 120 <li class="active"><a href="../index.php">首頁</a></li> 121 <li class="active"><a href="#">通訊錄</a></li> 122 <li class="active"><a href="#">應用中心</a></li> 123 <li class="active"><a href="mailList.php">收件箱</a></li> 124 <li class="newUser"><a href="regist.html">注冊新用戶</a></li> 125 <li class="newUser1"><a href="update.html">修改密碼</a></li> 126 </ul> 127 </div> 128 </header> 129 <aside> 130 <div class="aside"> 131 <div class="btn-group"> 132 <a class="btn btn-default function" href="sendEmail.php" role="button">寫信</a> 133 <a class="btn btn-default function" role="button" href="mailList.php">收信</a> 134 </div> 135 136 <div class="collapse navbar-collapse"> 137 <ul class="nav"> 138 <li><a class="leftaside" href="mailList.php">收件箱</a></li> 139 <li><a class="leftaside">草稿箱</a></li> 140 <li><a class="leftaside"href="sendBox.php">已發送</a></li> 141 </ul> 142 </div> 143 </div> 144 </aside> 145 <div class="container"> 146 <table class="table table-striped"> 147 <tr class="info"> 148 <td>發件人</td> 149 <td>主題</td> 150 <td>內容</td> 151 </tr> 152 <?php 153 154 if($_SESSION['Users']) { 155 $result=mysql_query("select * from Users where userID='".$_SESSION['Users']."'"); 156 $rs=mysql_fetch_array($result); 157 $userID=htmlspecialchars($rs['userID']); 158 $info=mysql_query("select * from EmailBox where receiver='$userID'"); 159 while($rt=mysql_fetch_array($info)){ 160 ?> 161 <tr> 162 <td><?php echo $rt['sender']; ?></td> 163 <td><?php echo $rt['title']; ?></td> 164 <td><?php echo $rt['content']; ?></td> 165 </tr> 166 <?php 167 } 168 } 169 170 ?> 171 </table> 172 </div> 173 174 </body> 175 176 177 </html> mailList.php

14.發件箱

1 <?php 2 include('../php/helper.php'); 3 if(empty($_SESSION['Users'])){ 4 echo "<script>alert('請進行登錄或注冊!');location='../index.php';"; 5 } 6 ?> 7 8 9 10 <html> 11 <head> 12 <meta charset="utf-8"/> 13 <meta name="viewport" content="width=device-width,initial-scale=1.0"> 14 <title>站內信</title> 15 <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css"/> 16 <link src="../bootstrap/js/jquery.min.cs"/> 17 <link src="../bootstrap.min.js"/> 18 <style type="text/css"> 19 .navbar-header{ 20 background-image: images/headback.gif; 21 } 22 .function{ 23 padding: 10px 37.5px; 24 background-color: #D8E7F1; 25 } 26 .header{ 27 position: fixed; 28 left: 0; 29 right: 0; 30 z-index: 1002; 31 min-height: 60px; 32 padding: :0 15px; 33 display: block; 34 35 } 36 .navbar-btn{ 37 margin-top: 0px; 38 margin-bottom: 0px; 39 } 40 .nav-bg{ 41 background: #A3D5FB; 42 border-bottom: 1px solid #A3D5FB; 43 height: 80px; 44 } 45 46 .nav-tabs{ 47 margin-top: 38px; 48 margin-left: 0px; 49 } 50 .nav-tabs>li>a{ 51 margin-right: 0px; 52 } 53 .nav>li>a{ 54 padding: 10px 60px; 55 } 56 .nav-tabs > li.active > a, .nav-tabs > li.active > a:focus, .nav-tabs > li.active > a:hover{ 57 background-color: #E3EEF7; 58 } 59 .aside{ 60 background: #F5F8FD; 61 height: 100%; 62 width: 210px; 63 } 64 .leftaside 65 { 66 background-color:#E3EEF7; 67 } 68 .navbar-collapse{ 69 padding-right: 0px; 70 padding-left: 0px; 71 } 72 .newUser{ 73 padding-left: 570px; 74 } 75 76 77 .container{ 78 position: absolute; 79 left:210px; 80 top: 80px; 81 bottom:0px; 82 right: 0px; 83 z-index: 23; 84 width: 1812px; 85 padding-left: 0px; 86 } 87 .container-fluid{ 88 padding-left: 0px; 89 padding-right: 0px; 90 } 91 .anniu{ 92 margin-top: 0px; 93 } 94 .content{ 95 margin-top: 15px; 96 97 } 98 .input-group , .text{ 99 margin-bottom: 0px; 100 margin: 0px 0px 25px 0px; 101 102 } 103 .footer{ 104 float: right; 105 } 106 107 .table{ 108 width: 100%; 109 text-align: center; 110 } 111 </style> 112 </head> 113 <body> 114 <div class="container-fluid "> 115 <header class="nav-bg"> 116 <div class="navbar-header"> 117 <a href="#"><img src="../images/logo.jpg" height="80px"width="210px" alt="郵箱logo"></a> 118 </div> 119 <div class="collapse navbar-collapse"> 120 <ul class="nav nav-tabs" > 121 <li class="active"><a href="../index.php">首頁</a></li> 122 <li class="active"><a href="#">通訊錄</a></li> 123 <li class="active"><a href="#">應用中心</a></li> 124 <li class="active"><a href="mailList.php">收件箱</a></li> 125 <li class="newUser"><a href="regist.html">注冊新用戶</a></li> 126 <li class="newUser1"><a href="update.html">修改密碼</a></li> 127 </ul> 128 </div> 129 </header> 130 <aside> 131 <div class="aside"> 132 <div class="btn-group"> 133 <a class="btn btn-default function" href="sendEmail.php" role="button">寫信</a> 134 <a class="btn btn-default function" role="button" href="mailList.php">收信</a> 135 </div> 136 137 <div class="collapse navbar-collapse"> 138 <ul class="nav"> 139 <li><a class="leftaside" href="mailList.php">收件箱</a></li> 140 <li><a class="leftaside">草稿箱</a></li> 141 <li><a class="leftaside" href="sendBox.php">已發送</a></li> 142 </ul> 143 </div> 144 </div> 145 </aside> 146 <div class="container"> 147 <table class="table"> 148 <tr class="info"> 149 <td>收件人</td> 150 <td>主題</td> 151 <td>內容</td> 152 </tr> 153 <?php 154 155 if($_SESSION['Users']) { 156 $result=mysql_query("select * from Users where userID='".$_SESSION['Users']."'"); 157 $rs=mysql_fetch_array($result); 158 $userID=htmlspecialchars($rs['userID']); 159 $info=mysql_query("select * from EmailBox where sender='$userID'"); 160 while($rt=mysql_fetch_array($info)){ 161 ?> 162 <tr> 163 <td><?php echo $rt['receiver']; ?></td> 164 <td><?php echo $rt['title']; ?></td> 165 <td><?php echo $rt['content']; ?></td> 166 </tr> 167 <?php 168 } 169 } 170 171 ?> 172 </table> 173 </div> 174 175 </body> 176 </html> sendBox.php

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved