加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
hyang.model.php 3.61 KB
一键复制 编辑 原始数据 按行查看 历史
Joshua Conero 提交于 2016-05-15 22:56 . no commit message
<?php
require_once dirname(__FILE__).'./hyang/ModelAbstract.php';
class model extends ModelAbstract{
public function adminM()
{
$db = db();
if(array_key_exists($_POST['admin'],$db))
{
if($db[$_POST['admin']] == $_POST['passw'] )
{
echo '登入成功!';
$_SESSION['sid'] = crypt('delete','hyang');
header('Refresh: 1; url=hyang.php');
}
else
{
echo '<script>alert("密码输入错误!");</script>';
header('Refresh: 1; url=index.php');
}
}
else
{
echo '<script>alert("用户不存在!");</script>';
header('Refresh: 1; url=index.php');
}
}
public function emailM()
{
$to = $_POST['Eto'];
$subject = $_POST['Etitle'];
$message = str_replace("\n.", "\n..", $_POST['Econtent']);
//$headers = 'From: webmaster@example.com' . "\r\n" .'Reply-To: webmaster@example.com' . "\r\n" .'X-Mailer: PHP/' .phpversion();
//mail($to,$subject,$message,$headers)
if(mail($to,$subject,$message))
{
echo '<p>邮箱发送成功!</p>';
header('Refresh: 2; url=index.php');
}
else
{
echo '<p>邮箱发送失败!</p>';
}
}
function testModel()
{
header('Content-Type:text/html; charset=GBK;');
isset($_POST['action']) or die('页面加载失败!<br> Page Loading Failure (:-');
$filePHP = './log/codeTest.php';
$filedate = './log/codeList/filedata.json';
if($_POST['action'] == 'test')
{
$code = str_replace('<br />',"\r\n",nl2br($_POST['code']));
$handle =fopen($filePHP,'r+');
$content = "<?\r\n\r\n";
$content .= '// 测试-运行页面(2015/12/11 星期五版)。实际执行与:'.sys_date('')."\r\n\r\n";
$content .= $code;
$content .= "\r\n\r\n?>";
fwrite($handle,$content);
fclose($handle);
}
if($_POST['action'] == 'testSave')
{
//print_r($_POST);
(isset($_POST['filename']) && $_POST['filename']) or die('没有文件名或文件名为空!!<br> Cannot fine the File name');
$filename = $_POST['filename'].'.php';
$fileurl = './log/codeList/'.$filename;
$handle = fopen($filedate,'r+');
$data = file_get_contents($filedate);
$json = '';
if($data)
{
$jsonArr = json_decode($data,true);
foreach($jsonArr as $value)
{
if(array_search($filename,$value))
{
echo '<p>文件已经存在,请更换文件名</p>';
exit;
}
}
if(copy($filePHP,$fileurl))
{
$no = uniqid();//13bit
$jsonArr[$no]["date"] = sys_date('');
$jsonArr[$no]["name"] = $filename;
$jsonArr[$no]["fileUrl"] = $fileurl;
$json = json_encode($jsonArr);
fwrite($handle,$json);
fclose($handle);
}
exit;
}
else
{
if(copy($filePHP,$fileurl))
{
$json = '{"'.uniqid().'":{"date":"'.sys_date('').'","name":"'.$filename.'","fileUrl":"'.$fileurl.'"}}';
fwrite($handle,$json);
fclose($handle);
echo '<p>文件保存成功!!</p>';
}
exit;
}
}
if($_POST['action'] == 'testSavePrint')
{
$handle = fopen($filedate,'r+');
$data = file_get_contents($filedate);
$jsonArr = json_decode($data,true);
$html = '';
foreach($jsonArr as $value)
{
$html .= '<br>* ';
foreach($value as $k=>$v)
{
if($k == 'date') $html .= $v.': __';
if($k == 'name') $html .= $v.' ';
if($k == 'fileUrl') $html .= '<a href="'.implode('',explode('\\',$v)).'" target="blank">查看</a>';
}
}
echo '<p>'.$html.'</p>';
fclose($handle);
}
if($_POST['action'] == 'testClear')
{
$empty = './log/codeTest-empty.php';
if(unlink($filePHP))
{
if(copy($empty,$filePHP))
echo "<p>操作成功!=".sys_date('')."</p>";
}
}
}
}
?>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化