function addtext($text1, $len, $textadd = "") { $i = 0; $text2 = ""; if ($len % 2 == 1) { $len = $len + 1; } $len1 = StrLenW($text1); for ($i = 0; $i < $len1 / $len; $i++) { $text2 .= get_substr($text1, $I, $len) . $textadd; $text1 = get_substr($text1, $len, $len1 - $len); } return $text2; }
$sql = "SELECT s.content_id,s.content_body,s.posttime,s.type,s.status_id,s.status_uname,s.status_type,u.user_id,u.user_name,u.user_head,u.theme_bgcolor,u.theme_pictype,u.theme_text,u.theme_link,u.theme_sidebar,u.theme_sidebox,u.theme_bgurl,t.topic_id,t.topic_body,t.open FROM et_users AS u,et_content AS s left join et_topic AS t on s.topicid=t.topic_id && t.open=1 where s.user_id=u.user_id && s.content_id='{$viewid}'"; $query = $db->query($sql); $data = $db->fetch_array($query); $content_id = $data['content_id']; $content_uid = $data['user_id']; $content_uname = $data['user_name']; $content_uhead = $data['user_head'] ? "{$webaddr}/attachments/head/" . $data['user_head'] : "{$webaddr}/images/noavatar.jpg"; $content_body = ubb($data['content_body']); $posttime = $data['posttime']; $type = $data['type']; $statusid = $data['status_id']; $status_uname = $data['status_uname']; $status_type = $data['status_type']; $topic_body = $data['topic_body'] ? "<a href='{$webaddr}/op/topic&tid={$data['topic_id']}' style='text-decoration:none;'><font color='red'>[" . $data['topic_body'] . "]</font></a> " : ""; $user = array("user_id" => $data['user_id'], "theme_bgcolor" => $data['theme_bgcolor'], "theme_pictype" => $data['theme_pictype'], "theme_text" => $data['theme_text'], "theme_link" => $data['theme_link'], "theme_sidebar" => $data['theme_sidebar'], "theme_sidebox" => $data['theme_sidebox'], "theme_bgurl" => $data['theme_bgurl']); //不存在 if (!$content_uid) { echo "<script>alert(\"此TALK不存在,点击确定返回主页!\");window.location.href='{$webaddr}/home';</script>"; exit; } $wn2 = clean_html(preg_replace("/\\[(quote|b|u|i|s|colour=.*|url|url=.*|img|strike|size=.*)\\](\\S+?)\\[\\/(quote|b|u|i|s|colour|url|img|strike|size)\\]/i", "\$2", $data['content_body'])); $wn = get_substr($wn2, 0, 50); if ($wn != $wn2) { $wn = $wn . "..."; } //模板和Foot $web_name3 = $content_uname . ":" . $wn; $sqlnum = $db->querynum; $mtime = explode(' ', microtime()); $loadtime = $mtime[1] + $mtime[0] - $starttime; include $template->getfile('op_view.htm');
function get_substr($string, $start = '0', $length = '') { $start = (int) $start; $length = (int) $length; $i = 0; if (!$string) { return; } if ($start >= 0) { while ($i < $start) { if (ord($string[$i]) > 127) { $i = $i + 2; } else { $i++; } } $start = $i; if ($length == '') { return substr($string, $start); } elseif ($length > 0) { $end = $start + $length; while ($i < $end) { if (ord($string[$i]) > 127) { $i = $i + 2; } else { $i++; } } if ($end != $i - 1) { $end = $i; } else { $end--; } $length = $end - $start; return substr($string, $start, $length); } elseif ($length == 0) { return; } else { $length = strlen($string) - abs($length) - $start; return get_substr($string, $start, $length); } } else { $start = strlen($string) - abs($start); return get_substr($string, $start, $length); } }
<?php error_reporting(7); date_default_timezone_set("PRC"); define('IN_ET', TRUE); include '../include/etfunctions.func.php'; define('WAP_ROOT', dirname(__FILE__)); define('ET_ROOT', get_substr(WAP_ROOT, 0, -4)); include '../include/db_mysql.class.php'; include '../config.inc.php'; $db = new dbstuff(); $db->connect($server, $db_username, $db_password, $db_name, $pconnect, true, "GBK"); include '../include/cache.inc.php'; @mysql_query("set names gbk"); include 'include/global.func.php'; include 'include/chinese.class.php'; if (preg_match('/(mozilla|m3gate|winwap|openwave|Opera)/i', $_SERVER['HTTP_USER_AGENT']) && !preg_match('/(SymbianOS)/i', $_SERVER['HTTP_USER_AGENT'])) { header("Location: ../index.php"); } $op = $_GET['op'] ? $_GET['op'] : "index"; $addtime = time(); $action = $_POST['action']; $act = $_GET['act']; $page = $_GET['page'] ? $_GET['page'] : 1; $exp = authcode($_COOKIE["wapcookie"], 'DECODE'); $ulmtem = explode("\t", $exp); if ($ulmtem) { $query = $db->query("SELECT user_id,user_name FROM et_users where user_id='{$ulmtem['0']}' && password='******'1']}'"); $data = $db->fetch_array($query); $user_id = $data['user_id']; $user_name = $data['user_name'];
if (!defined('IN_ET')) { exit('Access Denied'); } tologin(); if ($action == "upload") { $syshead = daddslashes($_POST["syshead"]); $sysphoto = array("{$webaddr}/attachments/head/syshead/01.jpg", "{$webaddr}/attachments/head/syshead/02.jpg", "{$webaddr}/attachments/head/syshead/03.jpg", "{$webaddr}/attachments/head/syshead/04.jpg", "{$webaddr}/attachments/head/syshead/05.jpg", "{$webaddr}/attachments/head/syshead/06.jpg", "{$webaddr}/attachments/head/syshead/07.jpg", "{$webaddr}/attachments/head/syshead/08.jpg", "{$webaddr}/attachments/head/syshead/09.jpg", "{$webaddr}/attachments/head/syshead/10.jpg"); if ($_FILES['picture']['name']) { $refer = $webaddr . "/op/setting"; include ET_ROOT . "/include/uploadpic.func.php"; $upname = UploadImage("picture", 1, 96, 96, ET_ROOT . "/attachments/head/", ET_ROOT . "/attachments/head/", $my['user_id']); $db->query("UPDATE et_users SET user_head = '{$upname}' WHERE user_id='{$my['user_id']}'"); } if (in_array($syshead, $sysphoto) && !$_FILES['picture']['name']) { $user_syshead = get_substr($syshead, -14, 0); $db->query("UPDATE et_users SET user_head = '{$user_syshead}' WHERE user_id='{$my['user_id']}'"); } echo "<script>location.href='{$webaddr}/op/setting&tip=30'</script>"; exit; } if ($action == "setting") { $gender = $_POST["gender"]; $musicaddr = daddslashes(trim($_POST["musicaddr"])); $homesf = $_POST["homesf"]; $homecity = $_POST["homecity"]; $livesf = $_POST["livesf"]; $livecity = $_POST["livecity"]; $homeprovince = "{$homesf} {$homecity}"; $liveprovince = "{$livesf} {$livecity}"; $birthyear = $_POST["birthyear"];
include 'common.inc.php'; $uid = isset($_GET['uid']) ? $_GET['uid'] : $my[user_id]; $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $hm = $_GET['hm']; $tplhm = "template \"hm_" . $hm . ".htm\""; if (!$uid) { header("Location: {$webaddr}/op/login"); } $sql = "select * from et_users where user_id='{$uid}'"; $query = $db->query($sql); $user = $db->fetch_array($query); $tem1 = explode(" ", $user['home_city']); $tem2 = explode(" ", $user['live_city']); $tem3 = explode(" ", $user['msn']); $user['user_head'] = $user['user_head'] ? "{$webaddr}/attachments/head/" . $user['user_head'] : "{$webaddr}/images/noavatar.jpg"; $user['old'] = date(Y) - get_substr($user['birthday'], 0, 4); if ($user['home_city'] == "选择省份 选择城市" || $user['home_city'] == "" || $user['home_city'] == " ") { $user['home_city'] = ""; } else { $user['home_city'] = "<a href='{$webaddr}/op?op=finder&&sname=&act=search&homesf=" . $tem1[0] . "&homecity=" . $tem1[1] . "'>" . $user['home_city'] . "</a>"; } if ($user['live_city'] == "选择省份 选择城市" || $user['live_city'] == "" || $user['live_city'] == " ") { $user['live_city'] = ""; } else { $user['live_city'] = "<a href='{$webaddr}/op?op=finder&sname=&act=search&livesf=" . $tem2[0] . "&livecity=" . $tem2[1] . "'>" . $user['live_city'] . "</a>"; } if (count($tem3) == 2) { $user['msn'] = $tem3[0]; $user['msnyz'] = $tem3[1]; } else { $user['msnyz'] = "";
if ($temid) { //模板信息 $sql = "select * from et_templates where temp_id='{$temid}'"; $query = $db->query($sql); $data = $db->fetch_array($query); $temp_name = $data['temp_name']; $temp_dir = $data['temp_dir']; $temp_isused = $data['temp_isused']; //模板变量 $sql2 = "select varid,varname,varbody from et_templatevars where temp_id='{$temid}'"; $query2 = $db->query($sql2); while ($data2 = $db->fetch_array($query2)) { $varid = $data2['varid']; $varname = $data2['varname']; $varbody = $data2['varbody']; if (get_substr($varname, 0, 4) == "def_") { $defvar[] = array("varid" => $varid, "varname" => $varname, "varbody" => $varbody); } $vars[$varname] = $varbody; } } if (!$action && !$act) { $sql = "select * from et_templates order by temp_id"; $query = $db->query($sql); while ($data = $db->fetch_array($query)) { $temp_id = $data['temp_id']; $temp_name = $data['temp_name']; $temp_dir = $data['temp_dir']; $temp_isused = $data['temp_isused'] == 1 ? "是" : "否"; $templ[] = array("temp_id" => $temp_id, "temp_name" => $temp_name, "temp_dir" => $temp_dir, "temp_isused" => $temp_isused); }