⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pm.php

📁 功能齐全
💻 PHP
字号:
<?php
require_once("config.inc.php");
require_once("include/DataSet.inc.php");
require_once("include/DB.inc.php");
require_once("include/Vant.inc.php");
require_once("include/OutputHtml.inc.php");
require_once("include/Language.inc.php");

$db   = & new DB(HOST,USERNAME,PASSWORD,DATABASE,'');
$db->connect();
$data = & new DataSet($db);
$sys_lang = new Language("include/language/");
$sys_lang->setLanguage();
require_once($sys_lang->getLangfile());
require_once("function.php");
$gourl=getFromUrl();
$tpl  = & new Vant("templates/");
$tpl->set("sitename",$nav["sitename"]);
$tpl->set("column",$nav["pm"]);
$username = $_COOKIE['loginname'];
$tpl->set("user",$username);
if ($username=='') 
{
	$tpl->set("msg",$lang_sysmsg["nologin"]);
	$tpl->set("gourl","index.php");
	$tpl->set("timesup","2000");
	$tpl->set("main_middle","sysmsg.html");
	$tpl->parse("main.html");
	phpexit();
}
/*
判断是否管理员登录
*/
if(isAdmin($username))$admin=1;
else $admin=0;
$tpl->set("admin",$admin);
$tpl->set("loginname",$username);

$op = $_GET['op'] != '' ? $_GET['op']:$_POST['op'];
if($op=='')phpexit();
call_user_func($op);
phpexit();

function phpexit()
{
	global $db;
	$db->close();
	exit;
}

function ListPm()
{
	global $db,$data,$lang_nav,$tpl,$username;
	$str = "select * from user_pm where pto='$username' and box='1'";
	$coObj = $data->getList($str,20);
	$coObj->navchar=$lang_nav;
	$tpl->set("navbar",$coObj->navbar(10));
	$tpl->set("list",$coObj->field);
	$tpl->set("pagejump",$coObj->pagejump());
	$tpl->set("main_middle","pm_list.html");
	$tpl->parse("main.html");	
}

function ViewPm()
{
	global $db,$data,$tpl,$username,$lang_sysmsg;
	$id=$_GET["id"];
	$arr = $db->fetch_array($db->query("select * from user_pm where pto='$username' and id='$id'"));
	$free = $arr["free"];
	$flag = $arr["readed"];
	if($free==0&&$flag==0)
	{
		if(!upPoint($username,"ViewPm",""))
		{
			$tpl->set("msg",$lang_sysmsg['nopoints']);
			$tpl->set("gourl","index.php?op=BuyPoint");
			$tpl->set("timesup","2000");
			$tpl->set("main_middle","sysmsg.html");
			$tpl->parse("main.html");
			phpexit();
		}
	}
	$db->query("update user_pm set readed='1' where pto='$username' and id='$id'");
	$str = "select * from user_pm where pto='$username' and id='$id'";
	$coObj = $data->getList($str,1);
	$tpl->set("list",$coObj->field);
	$tpl->set("main_middle","pm_view.html");
	$tpl->parse("main.html");	
}

function NewPm()
{
	global $db,$tpl,$gourl,$system_msg;
	if($_POST["Submit"]!="")
	{
		$from = $_POST["from"];
		$to	= $_POST["to"];
		$title = $_POST["title"];
		$msg = $_POST["msg"];
		$time = date("Y-m-d H:i:s");
		if($title=="")
		{
			echo "<script>history.back();</script>";
			exit("no title!");
		}
		$db->query("insert into user_pm values('','$from','$to','$title','$msg','$time','0','1','0')");
		$tpl->set("msg",$system_msg[2026]);
		$tpl->set("gourl",$gourl);
		$tpl->set("timesup","2000");
		$tpl->set("main_middle","sysmsg.html");
		$tpl->parse("main.html");
	}
	else
	{
		$tpl->set("to",$_GET["to"]);
		$tpl->set("main_middle","pm_post.html");
		$tpl->parse("main.html");	
	}
}

function DelPm()
{
	global $db,$tpl,$gourl,$system_msg,$username;
	$id = $_GET["id"];
	$db->query("delete from user_pm where pto='$username' and id='$id'");	
	$tpl->set("msg",$system_msg[2027]);
	$tpl->set("gourl",$gourl);
	$tpl->set("timesup","2000");
	$tpl->set("main_middle","sysmsg.html");
	$tpl->parse("main.html");
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -