Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A12DC902  #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions exam/controller/messages/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
//message控制器
date_default_timezone_set('Asia/Shanghai');
class Messages{
private $id ;
private $room_id;
private $content;
private $sent_at;

//初始化属性
public function __construct($param){

$this->id = isset($param['id'])?$param['id']:'';
$this->room_id = isset($param['room_id'])?$param['room_id']:'';
$this->content = isset($param['content'])?$param['content']:'';
$this->sent_at = isset($param['sent_at'])?$param['sent_at']:'';
//连接数据库
$link = mysql_connect('localhost','root','123456');
$db = mysql_select_db('liuyanban');
}

//类的函数

public static function all(){

}

//添加留言
public function save($param){
$room_id = $this->room_id;
$content = $this->content;
$sent_at = date('Y-m-d H:i:s',time());
$sql = "insert into `messages`(`room_id`,`content`,`sent_at`)values('$room_id','$content','$sent_at')";
$status = mysql_query($sql);
}

public function load($room){
header("Location:/A12DC902/list.php?room_id=".$room);
}


}

if($_POST){
$sent_at = date('Y-m-d H:i:s',time());
$message = new Messages($_POST);
$message->save($_POST);
$room_id = $_POST['room_id'];
$message->load($room_id);
}



?>
77 changes: 77 additions & 0 deletions exam/controller/romms/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<script type="text/javascript" src="home/jquery-1.8.3.min.js"></script>
<title>留言板</title>
<link title="style1" rel="stylesheet" href="home/style.css" type="text/css" />
<link title="style2" rel="alternate stylesheet" href="home/style2.css" type="text/css" />
<link title="style3" rel="alternate stylesheet" href="home/style3.css" type="text/css" />
<link title="style3" rel="alternate stylesheet" href="home/style4.css" type="text/css" />
<link title="style3" rel="alternate stylesheet" href="home/style5.css" type="text/css" />
</head>
<body>
<div class="style_changer" style="text-align:center;">
<div class="style_changer_text">留言板主题选择:</div>
<input type="submit" value="主题1" onclick="setActiveStyleSheet('style1');" />
<input type="submit" value="主题2" onclick="setActiveStyleSheet('style2');" />
<input type="submit" value="主题3" onclick="setActiveStyleSheet('style3');" />
<input type="submit" value="主题4" onclick="setActiveStyleSheet('style4');" />
<input type="submit" value="主题5" onclick="setActiveStyleSheet('style5');" />
</div>

<div class="form_content">

<fieldset>
<div class="field-label" style="height:300px;width:100%;">
<label for="field1">留言列表</label>:
<ul style="width:100%;">
<li>id:<font color="red">11</font>&nbsp;&nbsp;&nbsp;jintiantasdsadasdsadasd大实打实的啊实打实的&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;时间<font color="pink">1231231</font></li>
<li>id:<font color="red">11</font>&nbsp;&nbsp;&nbsp;jintiantasdsadasdsadasd大实打实的啊实打实的&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;时间<font color="pink">1231231</font></li>
<li>id:<font color="red">11</font>&nbsp;&nbsp;&nbsp;jintiantasdsadasdsadasd大实打实的啊实打实的&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;时间<font color="pink">1231231</font></li>
<li>id:<font color="red">11</font>&nbsp;&nbsp;&nbsp;jintiantasdsadasdsadasd大实打实的啊实打实的&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;时间<font color="pink">1231231</font></li>
<li>id:<font color="red">11</font>&nbsp;&nbsp;&nbsp;jintiantasdsadasdsadasd大实打实的啊实打实的&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;时间<font color="pink">1231231</font></li>
<li>id:<font color="red">11</font>&nbsp;&nbsp;&nbsp;jintiantasdsadasdsadasd大实打实的啊实打实的&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;时间<font color="pink">1231231</font></li>
</ul>
</div>
</fieldset>

<form id="test" action="index.php" method="post">
<fieldset>
<legend>留言界面</legend>
<div class="form-row">
<div class="field-label"><label for="field1">内容</label>:</div>
<div class="field-widget"><input name="content" class="required userinfo" placeholder="请输入您需要留言的内容" /></div>
</div>
</fieldset>
<input type="submit" class="submit" value="提交" />
<input class="reset" type="button" value="重置" id="reset" />
</form>

</div>
</body>
</html>
<script>
$(function(){
$('#reset').click(function(){
var object = $('.userinfo');
$.each(object,function(){
$(this).attr('value','');
})

})
})

function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
}



</script>
2 changes: 2 additions & 0 deletions exam/home/jquery-1.8.3.min.js

Large diffs are not rendered by default.

147 changes: 147 additions & 0 deletions exam/home/style1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
body {
color:#333;
background:url(images/bg.gif) repeat;
padding:0px;
font-size:12px;
font-family: Arial, Helvetica, sans-serif;
}
.form_content{
width:575px;
margin:30px auto;
padding:10px;
background:url(images/form_top_bg.gif) repeat-x top #fff;
}
fieldset{
border:1px #ebebeb solid;
padding:15px 10px 15px 10px;
margin:0 0 10px 0;
}
legend{
color:#FFFFFF;
background-color:#0fcdf6;
padding:2px 5px 2px 5px;
}
legend.optional{
color:#FFFFFF;
background-color:#50c150;
padding:2px 5px 2px 5px;
}


.form-row {
clear: both;
float:left;
padding:5px 5px 5px 5px;
}
.form-row-select {
clear: both;
float:left;
padding:10px 5px 5px 5px;
}
.field-label {
width:150px;
float:left;
line-height:25px;
}
label {
float:left;
color:#666666;
}
label.left{
padding:0 20px 0 5px;
float:left;
color:#666666;
}
.field-widget {
float:left;
}
input.required{
width:300px;
height:22px;
border: 1px solid #95E0EF;
background-color:#f3fcfe;
border-left-width:2px;
padding:5px 0 0 2px;
float:left;
}
input.optional{
width:300px;
height:22px;
border: 1px solid #adedad;
background-color:#f3fef3;
border-left-width:2px;
padding:5px 0 0 2px;
}
select.validate-selection{
width:305px;
height:28px;
border: 1px solid #95E0EF;
background-color:#f3fcfe;
border-left-width:2px;
padding:4px 2px 3px 2px;
float:left;
}
textarea.required{
width:300px;
height:75px;
float:left;
border: 1px solid #95E0EF;
background-color:#f3fcfe;
border-left-width:2px;
}
textarea.optional{
width:300px;
height:75px;
border: 1px solid #adedad;
background-color:#f3fef3;
border-left-width:2px;
}

input.submit{
color:#FFFFFF;
background-color:#0fcdf6;
padding:2px 5px 2px 5px;
cursor:pointer;
border:none;
}
input.reset{
color:#FFFFFF;
background-color:#50c150;
cursor:pointer;
padding:2px 5px 2px 5px;
border:none;
}

input.validation-failed, textarea.validation-failed, select.validation-failed {
border: 1px solid #FF9A7F;
background-color:#FFF2EF;
color : #FF3300;
}
input.validation-passed, textarea.validation-passed {
border: 1px solid #00CC00;
color : #000;
}

.validation-advice {
width:50px;
float:left;
margin:0px 0 0 10px;
padding:0px 0 0 25px;
background:url(images/warning.png) no-repeat left;
color:#FF9A7F;
font-size:10px;
}

.custom-advice {
margin: 5px 0;
padding: 5px;
background-color: #C8AA00;
color : #FFF;
font-weight: bold;
}






Loading