Application/Install/Common/function.php
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
//测试文件夹是否可写
function sp_testwrite($d) {
$tfile = "_test.txt";
$fp = @fopen($d . "/" . $tfile, "w");
if (!$fp) {
return false;
}
fclose($fp);
$rs = @unlink($d . "/" . $tfile);
if ($rs) {
return true;
}
return false;
}
function sp_execute_sql($db,$tablepre){
$file = get_sql_file('./Data/');
//读取SQL文件
$sqlcon = file_get_contents('./Data/'.$file);
$sql = str_replace("\r", "\n", $sqlcon);
$sql = explode(";\n", $sql);
preg_match('/CREATE TABLE IF NOT EXISTS `([^ ]*)`/', $sqlcon, $matches);
if(empty($matches)){
preg_match('/CREATE TABLE `([^ ]*)`/', $sqlcon, $matches);
}
$pre_arr = explode('_',$matches[1]);
//替换表前缀
$default_tablepre = $pre_arr[0] . "_";
$sql = str_replace(" `{$default_tablepre}", " `{$tablepre}", $sql);
//开始安装
sp_show_msg('开始安装数据库...');
foreach ($sql as $item) {
$item = trim($item);
if(empty($item)) continue;
preg_match('/CREATE TABLE IF NOT EXISTS `([^ ]*)`/', $item, $matches);
if(empty($matches)){
preg_match('/CREATE TABLE `([^ ]*)`/', $item, $matches);
}
if($matches) {
$table_name = $matches[1];
$msg = "创建数据表{$table_name}";
if(false !== $db->execute($item)){
sp_show_msg($msg . ' 完成');
} else {
sp_show_msg($msg . ' 失败!', 'error');
}
} else {
$db->execute($item);
}
}
}
function sp_create_admin_account($db,$table_prefix){
$uname = I("post.manager");
$upass = I("post.manager_pwd");
$utime = time();
$sql = "INSERT INTO `{$table_prefix}sys_user`(uname,upass,utype,utime) VALUES ('{$uname}', '{$upass}',1,'{$utime}');" ;
后面还有 47 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。