query ('' . 'select * from ' . $tbl_config); while ($msql->next_record ()) { $variable = $msql->f ('variable'); $value = $msql->f ('value'); $CONF[$variable] = $value; } } function menuinfo ($menuid) { global $msql; global $tbl_menu; $msql->query ('' . 'select * from ' . $tbl_menu . ' where menuid=\'' . $menuid . '\''); if ($msql->next_record ()) { $MenuInfo['menu'] = $msql->f ('menu'); $MenuInfo['fold'] = $msql->f ('fold'); $MenuInfo['secure'] = $msql->f ('secure'); $MenuInfo['skin'] = $msql->f ('skin'); $MenuInfo['pid'] = $msql->f ('pid'); $MenuInfo['coltype'] = $msql->f ('coltype'); } return $MenuInfo; } function menufold ($menuid) { global $tsql; global $tbl_menu; $tsql->query ('' . 'select * from ' . $tbl_menu . ' where menuid=\'' . $menuid . '\''); if ($tsql->next_record ()) { $fold = $tsql->f ('fold'); } return $fold; } function pageset ($coltype, $pagename) { global $msql; global $tbl_pageset; global $PSET; global $NowMenuid; if (($NowMenuid != '' AND $NowMenuid != '0')) { $addsql = '' . ' and menuid=\'' . $NowMenuid . '\' '; } $msql->query ('' . 'select * from ' . $tbl_pageset . ' where coltype=\'' . $coltype . '\' and pagename=\'' . $pagename . '\' ' . $addsql); while ($msql->next_record ()) { $PSET['pagetitle'] = $msql->f ('pagetitle'); $PSET['metakey'] = $msql->f ('metakey'); $PSET['metacon'] = $msql->f ('metacon'); $PSET['tempfile'] = $msql->f ('tempfile'); } } function pagedef ($diy, $set) { if (($set != '' AND $set != '0')) { return $set; } else { return $diy; } } function loadtemp ($pg) { global $strTempNotexists; global $MenuInfo; if (file_exists ($pg)) { $fd = fopen ($pg, r); $p = fread ($fd, 300000); fclose ($fd); $p = str_replace ('images/', ROOTPATH . 'templates/' . $MenuInfo['skin'] . '/images/', $p); return $p; } else { $str = $strTempNotexists . '(' . $pg . ')'; return $str; } } function showtemp ($EditCon) { global $msql; global $fsql; global $tsql; global $reload; global $CatchOpen; global $NowNewsId; global $NowCatid; global $NowCatPath; global $ModNo; chklic (); include ROOTPATH . 'includes/SysGlobal.php'; $array = explode ('{#', $EditCon); $EditCon = $array[0]; for ($t = 1; $t < sizeof ($array); $t++) { $arrayx = explode ('#}', $array[$t]); if (substr ($arrayx[0], 0, 3) == 'mod') { $ModArr = explode ('-', substr ($arrayx[0], 3)); $ModFile = $ModArr[0] . '.php'; $ModNo = $ModArr[1]; if ((file_exists (ROOTPATH . 'module/' . $ModFile) AND !strstr ($ModFile, '/'))) { include_once ROOTPATH . 'module/' . $ModFile; $func = $ModArr[0]; if (function_exists ($func)) { $CodeString = $func (); } else { $CodeString = 'module function not exists'; } } else { $CodeString = 'module not exist'; } } else { if (substr ($arrayx[0], 0, 4) == 'Advs') { $CodeString = advspage ($arrayx[0]); } else { if (substr ($arrayx[0], 0, 4) == 'Vote') { $CodeString = showvote ($arrayx[0]); } else { if (substr ($arrayx[0], 0, 2) == 'RP') { $CodeString = ROOTPATH; } else { if (isset ($GLOBALS[$arrayx[0]])) { $CodeString = $GLOBALS[$arrayx[0]]; } else { $CodeString = ''; } } } } } $EditCon .= $CodeString; $EditCon .= $arrayx[1]; } //$EditCon = str_replace ('RP/pic/gif/', ROOTPATH . 'pic/gif/', $EditCon); //$EditCon = str_replace ('RP/pic/swf/', ROOTPATH . 'pic/swf/', $EditCon); $EditCon = str_replace ('RP/pic/', ROOTPATH . 'pic/', $EditCon); $all = showactive ($EditCon); return $all; } function showactive ($EditCon) { $array = explode ('{#', $EditCon); $EditCon = $array[0]; for ($t = 1; $t < sizeof ($array); $t++) { $arrayx = explode ('#}', $array[$t]); if (isset ($GLOBALS[$arrayx[0]])) { $CodeString = $GLOBALS[$arrayx[0]]; } else { $CodeString = ''; } $EditCon .= $CodeString; $EditCon .= $arrayx[1]; } return $EditCon; } function showtpltemp ($EditCon, $var) { $array = explode ('{#', $EditCon); $EditCon = $array[0]; for ($t = 1; $t < sizeof ($array); $t++) { $arrayx = explode ('#}', $array[$t]); if (isset ($var[$arrayx[0]])) { $CodeString = $var[$arrayx[0]]; } else { $CodeString = '{#' . $arrayx[0] . '#}'; } $EditCon .= $CodeString; $EditCon .= $arrayx[1]; } return $EditCon; } function splittbltemp ($Temp) { $arr = explode ('', $Temp); $TempArr['start'] = $arr[1]; $arr = explode ('', $Temp); $TempArr['rowstart'] = $arr[1]; $arr = explode ('', $Temp); $tmenu = $arr[1]; $TempArr['menu'] = str_replace ('', '', $tmenu); $arr = explode ('', $Temp); $TempArr['menunow'] = $arr[1]; $arr = explode ('', $Temp); $TempArr['secondmenu'] = $arr[1]; $arr = explode ('', $Temp); $TempArr['input'] = $arr[1]; $arr = explode ('', $Temp); $TempArr['textarea'] = $arr[1]; $arr = explode ('', $Temp); $TempArr['menudivide'] = $arr[1]; $arr = explode ('', $Temp); $TempArr['blankdivide'] = $arr[1]; $arr = explode ('', $Temp); $TempArr['rowend'] = $arr[1]; $arr = explode ('', $Temp); $TempArr['end'] = $arr[1]; $arr = explode ('', $Temp); $TempArr['list'] = $arr[1]; $arr = explode ('', $Temp); $TempArr['more'] = $arr[1]; $TempArr['blank'] = showblank ($tmenu); return $TempArr; } function showblank ($EditCon) { $array = explode ('', $EditCon); $EditCon = $array[0] . $array[2]; return $EditCon; } function seld ($t, $z) { if ($t == $z) { $ret = ' selected'; } else { $ret = ' '; } return $ret; } function readtemp ($tempfile, $path) { $fname = $path . $tempfile; $fd = fopen ($fname, 'r'); $con = fread ($fd, filesize ($fname)); fclose ($fd); echo $con; } function buildhtml ($i, $PageAll) { global $CatchOpen; global $Secure; global $MenuSecure; if ((0 < $Secure OR 0 < $MenuSecure)) { if ($i == index) { $str = ''; } else { $str = ''; } $fd = fopen ('./' . $i . '.html', w); fwrite ($fd, $str, 300000); fclose ($fd); return true; } if (file_exists (ROOTPATH . 'catch/_html')) { sleep (10); } $vertime = time (); $reload = ''; if ($CatchOpen == '1') { $PageAll = str_replace ('', $reload, $PageAll); if (!is_writable ('./')) { echo 'Error: Fold (./) is not writable'; exit (); } $fd = fopen ('./' . $i . '.html', w); fwrite ($fd, $PageAll, 300000); fclose ($fd); } else { if ($i == index) { $str = ''; } else { $str = ''; } $fd = fopen ('./' . $i . '.html', w); fwrite ($fd, $str, 300000); fclose ($fd); } } function listfold ($imagefold, $fp) { if (file_exists ($imagefold)) { $handle = opendir ($imagefold); while ($image_file = readdir ($handle)) { $nowfile = $imagefold . '/' . $image_file; if (($image_file != '.' AND $image_file != '..')) { if (!is_dir ($nowfile)) { echo $nowfile . '
'; } else { listfold ($nowfile, $fp); } } } closedir ($handle); } } function delfold ($imagefold) { if (file_exists ($imagefold)) { $handle = opendir ($imagefold); while ($image_file = readdir ($handle)) { $nowfile = '' . $imagefold . '/' . $image_file; if (($image_file != '.' AND $image_file != '..')) { if (!is_dir ($nowfile)) { unlink ($nowfile); } else { delfold ($nowfile); } } } closedir ($handle); rmdir ($imagefold); } } function fmpath ($catid) { if (strlen ($catid) == 1) { $pathid = '000' . $catid; } else { if (strlen ($catid) == 2) { $pathid = '00' . $catid; } else { if (strlen ($catid) == 3) { $pathid = '0' . $catid; } else { if (4 <= strlen ($catid)) { $pathid = $catid; } } } } return $pathid; } function tblcount ($tbl, $id, $scl) { global $fsql; $fsql->query ('select count(' . $id . ('' . ') from ' . $tbl . ' where ' . $scl)); if ($fsql->next_record ()) { $totalnums = $fsql->f ('count(' . $id . ')'); } return $totalnums; } function csubstr ($str, $start, $len, $charset) { if ($charset == 'utf-8') { $tmpstr = utf8_substr ($str, $start, $len); return $tmpstr; } else { $len = $len - 1; $strlen = strlen ($str); if ($strlen <= $start) { return $str; } $clen = 0; for ($i = 0; $i < $strlen; $i++, $clen++) { if (160 < ord (substr ($str, $i, 1))) { if ($start <= $clen) { $tmpstr .= substr ($str, $i, 2); } $i++; } else { if ($start <= $clen) { $tmpstr .= substr ($str, $i, 1); } } if ($start + $len <= $clen) { break; } } return $tmpstr; } } function utf8_substr ($str, $start) { preg_match_all ('/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]/', $str, $ar); if (3 <= func_num_args ()) { $end = func_get_arg (2); return join ('', array_slice ($ar[0], $start, $end)); } else { return join ('', array_slice ($ar[0], $start)); } } function plusset ($pluslable) { global $PAGEINFO; global $tbl_plus; global $msql; global $ModNo; global $NowMenuid; $plustype = $PAGEINFO['coltype']; $pluslocat = $PAGEINFO['pagename']; if ((!isset ($ModNo) OR $ModNo == '')) { $ModNo = 0; } if (($NowMenuid != '' AND $NowMenuid != '0')) { $addsql = '' . ' and menuid=\'' . $NowMenuid . '\' '; } $scl = '' . ' pluslable=\'' . $pluslable . '\' and pluslocat=\'' . $pluslocat . '\' and plustype=\'' . $plustype . '\' and modno=\'' . $ModNo . '\' ' . $addsql; $msql->query ('' . 'select * from ' . $tbl_plus . ' where ' . $scl . ' '); if ($msql->next_record ()) { $showmore = $msql->f ('showmore'); $showmenuid = $msql->f ('showmenuid'); $tempname = $msql->f ('tempname'); $hangnums = $msql->f ('hangnums'); $shownums = $msql->f ('shownums'); $smallw = $msql->f ('smallw'); $smallh = $msql->f ('smallh'); $ord = $msql->f ('ord'); $sc = $msql->f ('sc'); $showtime = $msql->f ('showtime'); $onlytj = $msql->f ('onlytj'); $cutword = $msql->f ('cutword'); $target = $msql->f ('target'); $body = $msql->f ('body'); $catid = $msql->f ('catid'); } $PSET = array ('showmore' => $showmore, 'showmenuid' => $showmenuid, 'tempname' => $tempname, 'hangnums' => $hangnums, 'shownums' => $shownums, 'smallw' => $smallw, 'smallh' => $smallh, 'ord' => $ord, 'sc' => $sc, 'showtime' => $showtime, 'onlytj' => $onlytj, 'cutword' => $cutword, 'target' => $target, 'body' => $body, 'catid' => $catid); return $PSET; } function creatpage ($pagefile, $str) { $fd = fopen ($pagefile, 'w'); fwrite ($fd, $str, strlen ($str)); fclose ($fd); } function plusdef ($var, $def) { if (((!isset ($var) OR $var == '') OR $var == '0')) { return $def; } else { return $var; } } function menudef ($coltype, $menuid) { global $PAGEINFO; if ((($PAGEINFO['coltype'] == $coltype AND $menuid != '0') AND $menuid != '')) { return $menuid; } else { return 0; } } function showtypeimage ($src, $type, $width, $height, $border) { if (($width != '' AND $width != '0')) { $wstr = ' width=' . $width . ' '; } if (($height != '' AND $height != '0')) { $hstr = ' height=' . $height . ' '; } if ($type == 'swf') { $ImageStr = ''; } else { $ImageStr = ''; } return $ImageStr; } function showmixedimage ($src, $type, $width, $height, $border, $align, $vspace, $hspace, $bordercolor) { if (($width != '' AND $width != '0')) { $wstr = ' width=' . $width . ' '; } if (($height != '' AND $height != '0')) { $hstr = ' height=' . $height . ' '; } if ($type == 'swf') { $ImageStr = ''); } else { $ImageStr = ''); } return $ImageStr; } function securecheck ($need) { global $msql; global $fsql; if (0 < $need) { if ($_SERVER['QUERY_STRING'] != '') { $FMTO = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']; } else { $FMTO = $_SERVER['PHP_SELF']; } setcookie ('FMTO', $FMTO, time () + 7200, '/'); if ((((!isset ($_COOKIE['MUSER']) OR !isset ($_COOKIE['ZC'])) OR $_COOKIE['MUSER'] == '') OR $_COOKIE['ZC'] == '')) { echo ''; exit (); } else { $md5 = md5 ($_COOKIE['MUSER'] . '76|01|14' . $_COOKIE['MEMBERID'] . $_COOKIE['MEMBERTYPE'] . $_COOKIE['SE'] . $_COOKIE['SM']); if ($_COOKIE['ZC'] == $md5) { if ($_COOKIE['SE'] < $need) { echo ''; exit (); } } else { echo ''; exit (); } } } } function menusecurecheck ($need) { global $msql; global $fsql; if (0 < $need) { if ($_SERVER['QUERY_STRING'] != '') { $FMTO = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']; } else { $FMTO = $_SERVER['PHP_SELF']; } setcookie ('FMTO', $FMTO, time () + 7200, '/'); if ((((!isset ($_COOKIE['MUSER']) OR !isset ($_COOKIE['ZC'])) OR $_COOKIE['MUSER'] == '') OR $_COOKIE['ZC'] == '')) { echo ''; exit (); } else { $md5 = md5 ($_COOKIE['MUSER'] . '76|01|14' . $_COOKIE['MEMBERID'] . $_COOKIE['MEMBERTYPE'] . $_COOKIE['SE'] . $_COOKIE['SM']); if ($_COOKIE['ZC'] == $md5) { if ($_COOKIE['SM'] < $need) { echo ''; exit (); } } else { echo ''; exit (); } } } } function saytemp ($say, $link, $url, $Temp) { $Temp = str_replace ('{#url#}', $url, $Temp); $Temp = str_replace ('{#link#}', $link, $Temp); $Temp = str_replace ('{#say#}', $say, $Temp); return $Temp; } function err ($say, $url, $link) { global $strBack; global $MenuInfo; if ($url == '') { $url = 'Javascript:history.back();'; } if ($link == '') { $link = $strBack; } $string = loadtemp (ROOTPATH . 'templates/' . $MenuInfo['skin'] . '/tpl_err.htm'); $string = saytemp ($say, $link, $url, $string); return $string; } function sayok ($say, $url, $link) { global $strBack; global $MenuInfo; if ($url == '') { $url = 'Javascript:history.back();'; } if ($link == '') { $link = $strBack; } $string = loadtemp (ROOTPATH . 'templates/' . $MenuInfo['skin'] . '/tpl_ok.htm'); $string = saytemp ($say, $link, $url, $string); return $string; } function norights ($say, $url, $link) { global $MenuInfo; if ($url == '') { $url = 'Javascript:history.back();'; } if ($link == '') { $link = $strBack; } $string = loadtemp (ROOTPATH . 'templates/' . $MenuInfo['skin'] . '/tpl_norights.htm'); $string = saytemp ($say, $link, $url, $string); return $string; } function chklic () { if (MEDIPRO_TYPE == 'oem') { global $ServerPath; if (file_exists ($ServerPath . '/license.dat')) { $arr = @file ($ServerPath . '/license.dat'); $str = trim ($arr[0]); $str1 = trim ($arr[1]); } else { echo 'ERROR:004'; exit (); } $md5str = 'EHTAZIYT' . $ServerPath . $_SERVER['SERVER_ADDR'] . $_SERVER['LOCAL_ADDR'] . '22.90h7^aaz0(!skZnmLa03#nVAc_f(h-a!)wsx~9dlP1%uXJnB8.65E3zYYwa'; $md5 = md5 ($md5str); if (($str != $md5 AND $str1 != $md5)) { echo 'ERROR:003'; exit (); } $ifex = 0; if ($ifex != 1) { echo 'ERROR:004'; exit (); } $md5 = md5 ($lic_exp . $lic_stat . $lic_dsk . 'aS09(1!)0xzW3^zxMlaKiuy*89z~sdkjl'); } else { $ifex = 0; $HTTP_HOST = $_SERVER['HTTP_HOST']; $str = $lic_4 . $lic_1 . $lic_2 . $lic_3 . '{MxzMediPro~5gBas7ZLkaC(7)^DS3!tYuV(*)~6DXX657HjaLP06}'; $sev = base64_encode ($str); $sev = strrev ($sev); $sev = md5 ($sev); $use_server = $lic_4; $use_start = $lic_1; $use_end = $lic_2; $use_type = $lic_3; $now_time = time (); $cha_time = $use_end - $now_time; $cha_day = $cha_time / 60 / 60 / 24; $cha_day = number_format ($cha_day); $www_use_server = 'www.' . $use_server; } } function advspage ($str) { global $msql; global $tbl_advs_page; global $strAdvsId; $arr = explode ('[', $str); $arrx = explode (']', $arr[1]); $arry = explode (']', $arr[2]); $id = $arrx[0]; $arrwh = explode ('*', $arry[0]); $width = $arrwh[0]; $height = $arrwh[1]; $msql->query ('' . 'select * from ' . $tbl_advs_page . ' where id=\'' . $id . '\''); if ($msql->next_record ()) { $title = $msql->f ('title'); $type = $msql->f ('type'); $url = $msql->f ('url'); $target = $msql->f ('target'); $src = $msql->f ('src'); $border = $msql->f ('border'); if ($src != '') { $src = ROOTPATH . $src; $avdstr = '' . showtypeimage ($src, $type, $width, $height, $border) . ''; } else { $avdstr = '' . showtypeimage ('false', 'gif', $width, $height, $border) . ''; } } else { $avdstr = '' . showtypeimage ('false', 'gif', $width, $height, $border) . ''; } return $avdstr; } function showvote ($str) { global $fsql; global $tbl_poll_index; global $tbl_poll_data; global $tbl_poll_config; global $MenuInfo; $arr = explode ('[', $str); $arrx = explode (']', $arr[1]); $poll_id = $arrx[0]; if (($poll_id == '' OR $poll_id == '0')) { return ''; } $Temp = loadtemp (ROOTPATH . 'templates/' . $MenuInfo['skin'] . '/tpl_vote.htm'); $TempArr = splittbltemp ($Temp); $fsql->query ('' . ' SELECT * FROM ' . $tbl_poll_index . ' WHERE poll_id = \'' . $poll_id . '\' and status = \'1\' '); if ($fsql->next_record ()) { $ipoll_id = $fsql->f ('poll_id'); $question = $fsql->f ('question'); } $vstr = $TempArr['start']; $p = 0; $fsql->query ('' . ' SELECT * FROM ' . $tbl_poll_data . ' WHERE poll_id = \'' . $ipoll_id . '\' order by option_id'); while ($fsql->next_record ()) { $option_id = $fsql->f ('option_id'); $option_text = $fsql->f ('option_text'); $votes = $fsql->f ('votes'); $tempstr = str_replace ('{#option_id#}', $option_id, $TempArr['list']); $tempstr = str_replace ('{#option_text#}', $option_text, $tempstr); if ($p == 0) { $tempstr = str_replace ('{#checked#}', 'checked', $tempstr); } $vstr .= $tempstr; $p++; } $vstr .= $TempArr['end']; $vstr = str_replace ('{#question#}', $question, $vstr); $vstr = str_replace ('{#ipoll_id#}', $ipoll_id, $vstr); $vstr = str_replace ('{#RP#}', ROOTPATH, $vstr); return $vstr; } function passport_encrypt ($txt, $key) { srand ((double)microtime () * 1000000); $encrypt_key = md5 (rand (0, 32000)); $ctr = 0; $tmp = ''; for ($i = 0; $i < strlen ($txt); $i++) { $ctr = ($ctr == strlen ($encrypt_key) ? 0 : $ctr); $tmp .= $encrypt_key[$ctr] . ($txt[$i] ^ $encrypt_key[$ctr++]); } return base64_encode (passport_key ($tmp, $key)); } function passport_decrypt ($txt, $key) { $txt = passport_key (base64_decode ($txt), $key); $tmp = ''; for ($i = 0; $i < strlen ($txt); $i++) { $tmp .= $txt[$i] ^ $txt[++$i]; } return $tmp; } function passport_key ($txt, $encrypt_key) { $encrypt_key = md5 ($encrypt_key); $ctr = 0; $tmp = ''; for ($i = 0; $i < strlen ($txt); $i++) { $ctr = ($ctr == strlen ($encrypt_key) ? 0 : $ctr); $tmp .= $txt[$i] ^ $encrypt_key[$ctr++]; } return $tmp; } function passport_encode ($array) { $arrayenc = array (); foreach ($array as $key => $val) { $arrayenc[] = $key . '=' . urlencode ($val); } return implode ('&', $arrayenc); } error_reporting (E_ERROR | E_WARNING | E_PARSE); set_magic_quotes_runtime (0); ?>