private function create($data, $submitUrl) { $inputstr = ""; foreach ($data as $key => $v) { $inputstr .= ' <input type="hidden" id="' . $key . '" name="' . $key . '" value="' . $v . '"/> '; } $form = ' <form action="' . $submitUrl . '" name="pay" id="pay" method="POST"> '; $form .= $inputstr; $form .= ' </form> '; $html = ' <!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=utf-8" /> <title>请不要关闭页面,支付跳转中.....</title> </head> <body> '; $html .= $form; $html .= ' <script type="text/javascript"> document.getElementById("pay").submit(); </script> '; $html .= ' </body> </html> '; Mheader('utf-8'); echo $html; exit; }
function goUrl($url, $time, $msg, $sucs = 1, $content = '') { $sucs_css = $sucs == 1 ? 'Prompt_ok' : 'Prompt_x'; $html = '<!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=utf-8" /> <meta http-equiv="X-UA-Compatible" /> </head> <body> <style type="text/css"> * { word-wrap:break-word } body { font:12px Microsoft YaHei,Arial,Helvetica,sans-serif,Simsun; text-align:center; color:#333; } body, div, dl, dt, dd, ul, ol, li, pre, form, fieldset, blockquote, h1, h2, h3, h4, h5, h6,p{ padding:0; margin:0 } h1, h2, h3, h4, h5, h6 { font-weight: normal; } table, td, tr, th { font-size:12px } li { list-style-type:none } table { margin:0 auto } img { border:none } ol, ul { list-style:none } caption, th { text-align:left } .Prompt_top, .Prompt_btm, .Prompt_ok, .Prompt_x { background:url(/Style/tip/images/message.gif) no-repeat; display:inline-block } .Prompt { width:640px; margin:100px auto 180px; text-align:left; } .Prompt_top { background-position:0 0; height:15px; width:100%; } .Prompt_con { width:100%; border-left:1px solid #E7E7E7; border-right:1px solid #E7E7E7; background:#fff; overflow:hidden;} .Prompt_btm { background-position:0 -27px; height:6px; width:100%; overflow:hidden; } .Prompt_con dl { overflow:hidden;border-left:1px solid #E7E7E7; border-right:1px solid #E7E7E7; background:#fff;} .Prompt_con dt { width:100%; font-size:18px; padding:15px; border-bottom:2px solid #E7E7E7;font-weight: bold;_height:20px;} .Prompt_con dd { float:left; display:block; padding:15px; } .Prompt_con dd h2 { font-size:14px; line-height:30px;word-break:break-all;} .Prompt_ok { background-position:-72px -39px; width:68px; height:68px; } .Prompt_x { background-position:0 -39px; width:68px; height:68px; } .Prompt_con a.a { color:#fff; padding:0 15px; line-height:30px; background-color:#307ba0; display:inline-block; font-size:14px; margin:20px 0px; } .con_b {font-size:16px;margin:10px 0;font-weight:bold;} </style> <script> function Jump(){ window.location.href = \'' . $url . '\'; } var waitTime = parseInt("' . $time . '"); if(waitTime >= 0){ document.onload = setTimeout("Jump()" , waitTime* 1000); } if(waitTime > 0){ var wi = setInterval(function(){ document.getElementById("spanWait").innerText = --waitTime; if(waitTime == 0)clearInterval(wi); }, 1000); } </script> <base target="_self" /> <div class="Prompt"> <div class="Prompt_top"></div> <div class="Prompt_con"> <dl> <dt>提示信息</dt> <dd><span class="' . $sucs_css . '"></span></dd> <dd> <h2>' . $msg . '</h2> <p class="con_b">' . $content . '</p> <p>系统将在 <span style="color:blue;font-weight:bold" id="spanWait">3</span> 秒后自动跳转,如果不想等待,直接点击 <A HREF="/">这里</A> 马上跳转</p> </dd> </dl> <div class="c"></div> </div> <div class="Prompt_btm"></div> </div></body> </html> '; Mheader('utf-8'); echo $html; }
public function backup() { $t = $_GET['t']; $s = $_GET['e']; $p = $_GET['p']; $savepath = $_REQUEST['savepath'] ? $_REQUEST['savepath'] : date("YmdHis", time()); $alltotal = $_GET['alltotal']; $thenof = $_GET['thenof']; $fnum = $_GET['fnum']; $stime = $_GET['stime']; $bakpath = C("DB_BAKPATH"); $b_table = $_SESSION['b_table']; //要备份的表checkbox$_POST['checkbox']; if ($_REQUEST['baktable']) { $_SESSION['b_table'] = $_REQUEST['baktable']; //备份信息 $b_table = $_REQUEST['baktable']; //要备份的表checkbox$_POST['checkbox']; } if ($_REQUEST['info']) { $_SESSION['bak_info'] = $_REQUEST['info']; } //备份信息 Mheader("utf-8"); if (empty($savepath)) { $this->error("必须指定备份数据库保存目录"); } $path = $bakpath . "/" . $savepath; if (empty($b_table)) { $this->error("要备份的数据表不能为空"); } $waitbaktime = $this->waitbaktime; if (empty($stime)) { $stime = time(); } $btb = explode(",", $b_table); $count = count($btb); $t = (int) $t; $s = (int) $s; $p = (int) $p; //备份完毕 $btb[$t] = str_replace(";", "", $btb[$t]); if ($t >= $count) { MakeFile($_SESSION['bak_info'], $path . "/info.txt"); //保存备注信息 unset($_SESSION['b_table'], $_SESSION['bak_info']); echo "<script>alert('备份完成\\n\\n共用时" . UseTime($stime) . "');self.location.href='" . __URL__ . "';</script>"; exit; } $cpright = Cpright(); //版权信息 //编码 $b_dbchar = "utf-8"; //默认使用utf-8 if ($b_dbchar == 'auto') { if (empty($s)) { $status_r = Ebak_GetTotal($b_dbname, $btb[$t]); $collation = Ebak_GetSetChar($status_r['Collation']); DoSetDbChar($collation); //总记录数 $num = $limittype ? -1 : $status_r['Rows']; } else { $collation = $_GET['collation']; DoSetDbChar($collation); $num = (int) $alltotal; } $dumpsql .= Ebak_ReturnSetNames($collation); } else { if (empty($s)) { //总记录数 if ($limittype) { $num = -1; } else { $status_r = M()->query("SHOW TABLE STATUS LIKE '" . $btb[$t] . "';"); //当前表的总记录数 $num = $status_r[0]['Rows']; } } else { $num = (int) $alltotal; } } //备份数据库结构 if (empty($s)) { $dumpsql .= DB_t_stru($btb[$t]); } //取得字段数 if (empty($fnum)) { $return_fr = GetTbField($btb[$t]); $fieldnum = $return_fr['num']; //字段数 $noautof = $return_fr['autof']; } else { $fieldnum = $fnum; $noautof = $thenof; } //完整插入 $inf = ''; if ($b_beover == 1) { $inf = '(' . GetInsertSql($btb[$t]) . ')'; //插入语句的字段 } $b = 0; $sql = mysql_query("select * from `" . $btb[$t] . "` limit {$s},{$num}"); while ($r = mysql_fetch_array($sql)) { $b = 1; $s++; $dumpsql .= "DB_I(\"" . $this->b_insertf . " into `" . $btb[$t] . "`" . $inf . " values("; $first = 1; for ($i = 0; $i < $fieldnum; $i++) { //首字段 if (empty($first)) { $dumpsql .= ','; } else { $first = 0; } $myi = $i + 1; if (!isset($r[$i]) || strstr($noautof, ',' . $myi . ',')) { $dumpsql .= 'NULL'; } else { $dumpsql .= GetFieldStr($r[$i]); } } $dumpsql .= ");\");\r\n"; //是否超过限制 if (strlen($dumpsql) >= $this->b_filesize * 1024) { $p++; $sfile = $path . "/" . $btb[$t] . "_" . $p . ".php"; $dumpsql = "<?php\r\n" . $cpright . $dumpsql . "\r\n?>"; MakeFile($dumpsql, $sfile); //M()->free($sql);释放内存 echo "<meta http-equiv=\"refresh\" content=\"" . $this->waitbaktime . ";url=" . __URL__ . "/backup?e={$s}&p={$p}&t={$t}&savepath={$savepath}&alltotal={$num}&thenof={$noautof}&fieldnum={$fieldnum}&stime={$stime}&waitbaktime={$this->waitbaktime}&collation={$collation}\">成功备份{$btb[$t]}的第{$p}个分卷" . EchoBakSt($btb[$t], $count, $t, $num, $s); exit; } } //最后一个备份 if (empty($p) || $b == 1) { $p++; $sfile = $path . "/" . $btb[$t] . "_" . $p . ".php"; $dumpsql = "<?php\r\n" . $cpright . $dumpsql . "\r\n?>"; MakeFile($dumpsql, $sfile); } //ReFlashConfig($p,$btb[$t],$path); $t++; //M()->free($sql);释放内存 //进入下一个表 echo "<meta http-equiv=\"refresh\" content=\"" . $this->waitbaktime . ";url=" . __URL__ . "/backup?e=0&p=0&t={$t}&savepath={$savepath}&stime={$stime}&waitbaktime={$this->waitbaktime}\">成功备份" . $btb[$t - 1] . "表"; exit; }
public function _MyInit() { Mheader("gbk"); $this->updir = dirname(C("WEB_ROOT")) . "/AutoDo/"; }
public function edit() { $file = urldecode($_GET['file']); $fileinfo['filea'] = $file; $file = $this->baseDir . $file; $filesize = filesize($file); $filesize = sprintf("%.2f", $filesize / 1024); $filetime = filemtime($file); $filetime = date("Y-m-d H:i:s", $filetime); if (is_file($file)) { $fp = fopen($file, "r"); $content = fread($fp, filesize($file)); fclose($fp); $content = htmlspecialchars($content); } $contentView = "<textarea name='str' style='width:99%;height:450px;background:#ffffff;'>{$content}</textarea>\r\n"; $fileinfo['name'] = basename($file); $fileinfo['size'] = $filesize . "KB"; $fileinfo['time'] = $filetime; $this->assign("fileinfo", $fileinfo); //fetch的时候已经进行了模板的常量替换,所以特殊模板里的内容如果有常量就不要在fetch前赋值到模板,并且fetch以后得到的内容是对模板处理过的内容,所以不影响正常模板的编写,最后再把模板里的特殊内容用str_replace替换再用each输入即可实现模板和内容正常 $x = $this->fetch(); Mheader("utf-8"); echo str_replace("{#content}", $contentView, $x); }