webmain/task/runt/beifenAction.php
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
/**
* 运行方式:E:\php\php-5.4.14\php.exe E:\IIS\app\xinhu\task.php beifen
* url:http://demo.rockoa.com/task.php?m=beifen|runt
* url:http://127.0.0.1/app/xinhu/task.php?m=beifen|runt
*/
class beifenClassAction extends runtAction
{
//每天cli备份数据为sql文件的
public function defaultAction()
{
if(PHP_SAPI != 'cli') return 'plase cli run';
$alltabls = $this->db->getalltable();
$nobeifne = array(''.PREFIX.'log',''.PREFIX.'logintoken',''.PREFIX.'kqanay',''.PREFIX.'email_cont',''.PREFIX.'reads',''.PREFIX.'dailyfx',''.PREFIX.'todo',''.PREFIX.'city'); //不备份的表;
$data = array();
$strstr = "/*
备份时间:".$this->now."
*/
";
foreach($alltabls as $tabs){
if(in_array($tabs, $nobeifne))continue;
$strstr .= "DROP TABLE IF EXISTS `$tabs`;\n";
$sqla = $this->db->getall('show create table `'.$tabs.'`');
$strstr .= "".$sqla[0]['Create Table'].";\n";
$rows = $this->db->getall('select * from `'.$tabs.'`');
foreach($rows as $k=>$rs){
$vstr = '';
foreach($rs as $k1=>$v1){
if(!isempt($v1))$v1 = str_replace("\n",'\n', $v1);
$v1 = ($v1==null) ? 'null' : "'$v1'";
$vstr.=",$v1";
}
$strstr .= "INSERT INTO `$tabs` VALUES(".substr($vstr,1).");\n";
}
$strstr .= "\n";
}
$rnd = str_shuffle('abcedfghijk').rand(1000,9999);
$file = ''.DB_BASE.'_'.date('Y.m.d.H.i.s').'_'.$rnd.'.sql';
$filepath = ''.UPDIR.'/data/'.$file.'';
$this->rock->createtxt($filepath, $strstr);
//给管理员邮箱发邮件
m('email')->sendmail(''.TITLE.'数据库备份',''.TITLE.'数据库备份'.$this->rock->now.'', 1 , array(), 1, array(
'attachname'=> $file,
'attachpath'=> $filepath,
));
@unlink($filepath);
return 'success';
}
/**
* 备份数据库
* php task.php beifen,create -table=menu
*/
后面还有 54 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
