www.gusucode.com > 仿51.com的php源码 1.1 > Memo/MemoAdd.php

    <?php
include("../User/CheckLogined.php");
include("../include/dbclass.php");
$dbc=new DbConn();
$uid=$_COOKIE["uid"];
if($_GET["action"]=="add")
{
$Memo_Title=$_POST["f_Memo_Title"];
$Memo_Top=$_POST["f_Memo_Top"];
$Memo_Memo=$_POST["f_Memo_Memo"];
$Memo_AddDate=$_POST["f_Memo_AddDate"];
$sql="insert into memo (Memo_Title,Memo_Top,Memo_Memo,User_Account,Memo_AddDate) values ('$Memo_Title','$Memo_Top','$Memo_Memo','$uid','$Memo_AddDate')";
$dbc->Execute($sql);
header("Location:MemoList.php");
}
?>
<!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 http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>村委会档案管理中心 - 秘密记事本</title>
<script src="../js/global.js" language="javascript"></script>
<link href="../images/User_Main.css" rel="stylesheet" type="text/css" />
<script>
try{
	if(top!=window){
		document.domain	="www.wu-liao.com";		
	}else{
		top.location.href="/webin.php?refer=%2FMemo%2FMemoAdd.php";
	}
}catch(e){}
function showNewMessage(user){
	top.showNewMessage(user);
}

</script>
<script>
/*********Js Function Begin*********/
function AppCtrlEnterDiary(form, button){
	try{
		checkstatus();
	}catch(e){}
	if( (event.ctrlKey && event.keyCode == 13) || (event.altKey && event.keyCode == 83))
	{
		unload_flag = true;
		ret = fnSaveInput();
		if (!ret){
			unload_flag = false;
			return false;
		}
		if(button)
			button.disabled = true;
		form.submit();
	}
}
/*********Js Function End*********/
function fnSaveInput(){
	var oTempText=document.all.f_Memo_Memo;
	if (oTempText.value.length < 4){
		alert('字数不能少于4个字');
		unload_flag=false;
		return false;
	}
	if (oTempText.value.length > 10000){
		alert('字数不能超过10000');
		unload_flag=false;
		return false;
	}
	oTempText.setAttribute("f_Memo_Memo",oTempText.value);
	oTempText.save("oXMLBranch");
	unload_flag	=true;
	return true;
}
function fnLoadInput(){
	var oTempText=document.all.f_Memo_Memo;
	oTempText.load("oXMLBranch");
	oTempText.value=oTempText.getAttribute("f_Memo_Memo");
}
</script>
</head>
<body>
<div id="top">
<div id="logo"><a href="/User/Main.php"></a></div>
<div id="topr">
<div id="exit"><a href="http://www.wu-liao.com/" target="_top">网站首页</a><!--| <a href="/User/Online.php">在线列表</a> | <a href="http://bbs.51.com/gourl.php?refer=/index.html" target=_blank>论坛</a> | <a href="http://qun.51.com/gourl.php?refer=/index.php" style="color:#0000cc;text-decoration: underline;">群组</a> --><?php if($_COOKIE["uid"] !=""){?> | <a href="http://www.wu-liao.com/home.php?user=<?php echo $_COOKIE["uid"]; ?>" target="_blank" style="color:#0000cc;text-decoration: underline;" id="myhomepage">我的主页</a> | <a href="../login.php?action=logout" target="_top">安全退出</a></div><?php } ?>
<div id="menu">
<div class="m2">
<div class="mg"><a href="/User/Main.php">用户管理中心</a></div>
<div class="mh"><a href="/Diary/DiaryList.php">日记文集</a></div>
<div class="ma"><a href="/Photo/PhotoList.php">相册</a></div>
<div class="ma"><a href="/Image/ImageList.php">图库</a></div>
<div class="mb"><a href="/Music/MusicList.php">音乐</a></div>
<div class="mc" id="do2"><div id="ms"><a href="/Memo/MemoList.php"><img src="../images/suo2.gif" width="10" height="12" />&nbsp;秘密记事本</a></div>
</div>
<div class="me"><a href="/Fav/FavList.php">网址收藏夹</a></div>
<div class="mf"><a href="/Addr/AddrList.php">通讯录</a></div>
</div>
</div>
</div>
<div id="nav">
<div id="navt">记事本主要用于记录一些重要资料和事件备忘等,记事本信息不对外公开。</div>
</div>


<div id="mjx"></div>
<div id="main">
<div id="mimi">
</div>
<div id="right">
<div id="fenle">
<style>
.storeuserData {behavior:url(#default#userData);}
</style>
<DIV ID="FieldAdd_FormBox">
<form id="form1" name="form1" method="post" action="?action=add" onsubmit="unload_flag = true;return fnSaveInput();" enctype="multipart/form-data" >
<table  style="width:520px;text-align:left"><TR><TD style="height:35px;margin-top:10px; text-align:left" align="left">标题:<INPUT Name="f_Memo_Title" type="Text" size="45"/></TD><TD> 重要程度:<select name="f_Memo_Top"  ><option value="普通">普通</option><option value="重要">重要</option></select></TD><TD ></TD><TD ><INPUT Name="f_Memo_AddDate" type="hidden" value="<?php echo date("Y-m-d H:i:s",time());?>"/></TD></TR></table><table  style="width:520px;text-align:left"><TR><TD>&nbsp;</TD><TD><TextArea class="storeuserData" name="f_Memo_Memo" style="height: 240px;width: 520px;font-size:14px;line-height:22px;" onkeydown="return AppCtrlEnterDiary(form1,false)"></TextArea></TD></TR></table><table  style="width:520px;text-align:left"><TR><div style="width:520px;height:40px;text-align:left;padding-top:5px;"><input type="submit" class="btn" onclick="unload_flag = true;" value="保存记事">&nbsp;&nbsp;<input class="btn" type="button" value="取消" onclick="try{window.location.href='MemoList.php';}catch(e){}">&nbsp;&nbsp;<input class="btn" type=button value=" 调入上次内容 " onclick="if(confirm('调入上次输入的文章内容,将覆盖当前的内容,确定吗?')){fnLoadInput()}">&nbsp;&nbsp; 记事内容只有您本人登陆可见! </div></TR></table>
</form>
</DIV>

<script>
var unload_flag=false;
window.onbeforeunload=function()
{
	if(!unload_flag&&document.all.f_Memo_Memo.value!="")
	{
		return "离开前请先保存您输入的内容!";
	}
	else
	{
		unload_flag = false;
	}
}
</script>
</div>
</div>
</div>
<div id="bottom">
<div id="baidu" style="color:#a0a0a0;"><?php require("../foot.php"); ?></div>
</div>
</body>
</html>