function FilledArc(&$im, $CenterX, $CenterY, $DiameterX, $DiameterY, $Start, $End, $line_color, $fill_color = 'none') { if (gd_version() >= 2.0) { if ($fill_color != 'none') { // fill ImageFilledArc($im, $CenterX, $CenterY, $DiameterX, $DiameterY, $Start, $End, $fill_color, IMG_ARC_PIE); } // outline ImageFilledArc($im, $CenterX, $CenterY, $DiameterX, $DiameterY, $Start, $End, $line_color, IMG_ARC_EDGED | IMG_ARC_NOFILL | IMG_ARC_PIE); } else { // cbriou@orange-art.fr // To draw the arc ImageArc($im, $CenterX, $CenterY, $DiameterX, $DiameterY, $Start, $End, $line_color); // To close the arc with 2 lines between the center and the 2 limits of the arc $x = $CenterX + cos(deg2rad($Start)) * ($DiameterX / 2); $y = $CenterY + sin(deg2rad($Start)) * ($DiameterY / 2); ImageLine($im, $x, $y, $CenterX, $CenterY, $line_color); $x = $CenterX + cos(deg2rad($End)) * ($DiameterX / 2); $y = $CenterY + sin(deg2rad($End)) * ($DiameterY / 2); ImageLine($im, $x, $y, $CenterX, $CenterY, $line_color); if ($fill_color != 'none') { if ($End - $Start > 0.5) { // ImageFillToBorder() will flood the wrong parts of the image if the slice is too small // thanks Jami Lowery <*****@*****.**> for pointing out the problem // To fill the arc, the starting point is a point in the middle of the closed space $x = $CenterX + cos(deg2rad(($Start + $End) / 2)) * ($DiameterX / 4); $y = $CenterY + sin(deg2rad(($Start + $End) / 2)) * ($DiameterY / 4); ImageFillToBorder($im, $x, $y, $line_color, $fill_color); } } } }
public function welcome() { /* 系统信息 */ $conn = mysql_connect(C('DB_HOST'), C('DB_USER'), C('DB_PWD')); $gd = gd_version(); $sys_info['os'] = PHP_OS; $sys_info['ip'] = $_SERVER['SERVER_ADDR']; $sys_info['web_server'] = $_SERVER['SERVER_SOFTWARE']; $sys_info['php_ver'] = PHP_VERSION; $sys_info['mysql_ver'] = mysql_get_server_info($conn); $sys_info['zlib'] = function_exists('gzclose') ? L('yes') : L('no'); $sys_info['safe_mode'] = (boolean) ini_get('safe_mode') ? L('yes') : L('no'); $sys_info['safe_mode_gid'] = (boolean) ini_get('safe_mode_gid') ? L('yes') : L('no'); $sys_info['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : L('no_timezone'); $sys_info['socket'] = function_exists('fsockopen') ? L('yes') : L('no'); if ($gd == 0) { $sys_info['gd'] = 'N/A'; } else { if ($gd == 1) { $sys_info['gd'] = 'GD1'; } else { $sys_info['gd'] = 'GD2'; } $sys_info['gd'] .= ' ('; /* 检查系统支持的图片类型 */ if ($gd && (imagetypes() & IMG_JPG) > 0) { $sys_info['gd'] .= ' JPEG'; } if ($gd && (imagetypes() & IMG_GIF) > 0) { $sys_info['gd'] .= ' GIF'; } if ($gd && (imagetypes() & IMG_PNG) > 0) { $sys_info['gd'] .= ' PNG'; } $sys_info['gd'] .= ')'; } /* IP库版本 */ $sys_info['ip_version'] = ecs_geoip('255.255.255.0'); /* 允许上传的最大文件大小 */ $sys_info['max_filesize'] = ini_get('upload_max_filesize'); $this->assign('sys_info', $sys_info); $this->assign('ecs_version', VERSION); $this->assign('ecs_release', RELEASE); $this->assign('ecs_charset', strtoupper(EC_CHARSET)); $this->assign('install_date', local_date(C('date_format'), C('install_date'))); // 检测是否授权 $data = array('appid' => ECTOUCH_AUTH_KEY); $empower = $this->cloud->data($data)->act('get.license'); $this->assign('empower', $empower); $this->display('welcome'); }
function watermark_install() { global $settingInfo; //检查有无GD支持 $gdVersion = gd_version(); if ($gdVersion == "0") { $ActionMessage = "你的服务器不支持GD,不能使用此插件!请联系你的服务器供应商!"; } else { $arrPlugin['Name'] = "watermark"; //Plugin name $arrPlugin['Desc'] = "水印"; //Plugin title $arrPlugin['Type'] = "Func"; //Plugin type $arrPlugin['Code'] = ''; //Plugin htmlcode $arrPlugin['Path'] = ""; //Plugin Path $arrPlugin['DefaultField'] = array("wm_position", "wm_image", "wm_text", "wm_font", "wm_color", "wm_transparence", "wm_width", "wm_height"); //Default Filed $arrPlugin['DefaultValue'] = array("6", "plugins/watermark/watermark.png", $settingInfo['blogUrl'], "5", "#FF0000", "85", "200", "200"); //Default value $ActionMessage = install_plugins($arrPlugin); } return $ActionMessage; }
function nfo_install() { global $settingInfo; //检查有无GD支持 $gdVersion = gd_version(); if ($gdVersion == "0") { $ActionMessage = "你的服务器不支持GD,不能使用此插件!请联系你的服务器供应商!"; } else { $arrPlugin['Name'] = "nfo"; //Plugin name $arrPlugin['Desc'] = "NFO to Image"; //Plugin title $arrPlugin['Type'] = "Func"; //Plugin type $arrPlugin['Code'] = ''; //Plugin htmlcode $arrPlugin['Path'] = ""; //Plugin Path $arrPlugin['DefaultField'] = array("bgcolor", "txtcolor", "imgtype"); //Default Filed $arrPlugin['DefaultValue'] = array("#FFFFFF", "#000000", "png"); //Default value $ActionMessage = install_plugins($arrPlugin); } return $ActionMessage; }
/** * Constructor of class. Initializes the barebore graph. * * @return Graph */ public function __construct() { // Setup initial graph layout // Check for GD >= 2, create base image if (gd_version() >= 2) { $this->im = imagecreatetruecolor($this->img_width, $this->img_height); } else { $this->im = imagecreate($this->img_width, $this->img_height); } // No GD support, die. if (!$this->im) { return false; } if (function_exists("imageantialias")) { imageantialias($this->im, true); } // Fill the background imagefill($this->im, 0, 0, $this->color(239, 239, 239)); // Create our internal working graph box $inside_end_x = $this->inside_x + $this->inside_width; $inside_end_y = $this->inside_y + $this->inside_height; $this->image_create_rectangle($this->inside_x, $this->inside_y, $inside_end_x, $inside_end_y, 4, $this->color(254, 254, 254)); // Draw our three lines inside our internal working graph area for ($i = 1; $i < 4; ++$i) { $y_value = $this->inside_y + $this->inside_height / 4 * $i; imageline($this->im, $this->inside_x, $y_value, $inside_end_x, $y_value, $this->color(185, 185, 185)); } }
function action_login() { // 全局变量 // $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); if (intval($_CFG['captcha']) & CAPTCHA_ADMIN && gd_version() > 0) { $smarty->assign('gd_version', gd_version()); $smarty->assign('random', mt_rand()); } $smarty->display('login.htm'); }
/** * 调用会员信息 */ function smarty_function_member_info($params, $template) { $need_cache = $template->caching; $template->caching = false; if ($_SESSION['user_id'] > 0) { $template->assign('user_info', get_user_info()); } else { if (!empty($_COOKIE['ECS']['username'])) { $template->assign('ecs_username', stripslashes($_COOKIE['ECS']['username'])); } $captcha = intval($GLOBALS['_CFG']['captcha']); if ($captcha & CAPTCHA_LOGIN && (!($captcha & CAPTCHA_LOGIN_FAIL) || $captcha & CAPTCHA_LOGIN_FAIL && $_SESSION['login_fail'] > 2) && gd_version() > 0) { $template->assign('enabled_captcha', 1); $template->assign('rand', mt_rand()); } } $output = $template->fetch('member_info.html'); $template->caching = $need_cache; return $output; }
public function register () { global $ecs,$db,$_CFG; require_once(ROOT_PATH . 'languages/' .$_CFG['lang']. '/user.php'); if (!isset($back_act) && isset($GLOBALS['_SERVER']['HTTP_REFERER'])) { $back_act = strpos($GLOBALS['_SERVER']['HTTP_REFERER'], 'user.php') ? './index.php' : $GLOBALS['_SERVER']['HTTP_REFERER']; } /* 取出注册扩展字段 */ $sql = 'SELECT * FROM ' . $ecs->table('reg_fields') . ' WHERE type < 2 AND display = 1 ORDER BY dis_order, id'; $extend_info_list = $db->getAll($sql); $captcha = array('enabled'=>0); /* 验证码相关设置 */ if ((intval($_CFG['captcha']) & CAPTCHA_REGISTER) && gd_version() > 0) { $captcha['enabled'] = 1; $captcha['path'] = 'captcha.php'; $captcha['param'] = 'is_login'; } $result = array('extend_info_list'=>$extend_info_list,'passwd_questions'=>$_LANG['passwd_questions'],'captcha'=>$captcha); jsonExit($result); }
function is_gd_version_min_20() { if (gd_version() >= 2) { return "true"; } else { return "false"; } }
* ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: captcha_manage.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require dirname(__FILE__) . '/includes/init.php'; /* 检查权限 */ admin_priv('shop_config'); /*------------------------------------------------------ */ //-- 验证码设置 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'main') { if (gd_version() == 0) { sys_msg($_LANG['captcha_note'], 1); } assign_query_info(); $captcha = intval($_CFG['captcha']); $captcha_check = array(); if ($captcha & CAPTCHA_REGISTER) { $captcha_check['register'] = 'checked="checked"'; } if ($captcha & CAPTCHA_LOGIN) { $captcha_check['login'] = '******'; } if ($captcha & CAPTCHA_COMMENT) { $captcha_check['comment'] = 'checked="checked"'; } if ($captcha & CAPTCHA_ADMIN) {
function action_check_answer() { // 获取全局变量 $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $_SESSION['user_id']; $captcha = intval($_CFG['captcha']); if ($captcha & CAPTCHA_LOGIN && (!($captcha & CAPTCHA_LOGIN_FAIL) || $captcha & CAPTCHA_LOGIN_FAIL && $_SESSION['login_fail'] > 2) && gd_version() > 0) { if (empty($_POST['captcha'])) { show_message($_LANG['invalid_captcha'], $_LANG['back_retry_answer'], 'user.php?act=qpassword_name', 'error'); } /* 检查验证码 */ include_once 'includes/cls_captcha.php'; $validator = new captcha(); $validator->session_word = 'captcha_login'; if (!$validator->check_word($_POST['captcha'])) { show_message($_LANG['invalid_captcha'], $_LANG['back_retry_answer'], 'user.php?act=qpassword_name', 'error'); } } if (empty($_POST['passwd_answer']) || $_POST['passwd_answer'] != $_SESSION['passwd_answer']) { show_message($_LANG['wrong_passwd_answer'], $_LANG['back_retry_answer'], 'user.php?act=qpassword_name', 'info'); } else { $_SESSION['user_id'] = $_SESSION['temp_user']; $_SESSION['user_name'] = $_SESSION['temp_user_name']; unset($_SESSION['temp_user']); unset($_SESSION['temp_user_name']); $smarty->assign('uid', $_SESSION['user_id']); $smarty->assign('action', 'reset_password'); $smarty->display('user_passport.dwt'); } }
$cmt = new stdClass(); $cmt->id = !empty($_GET['id']) ? intval($_GET['id']) : 0; $cmt->type = !empty($_GET['type']) ? intval($_GET['type']) : 0; $cmt->page = isset($_GET['page']) && intval($_GET['page']) > 0 ? intval($_GET['page']) : 1; } if ($result['error'] == 0) { $comments = assign_comment($cmt->id, $cmt->type, $cmt->page); $smarty->assign('comment_type', $cmt->type); $smarty->assign('id', $cmt->id); $smarty->assign('username', $_SESSION['user_name']); $smarty->assign('email', $_SESSION['email']); $smarty->assign('comments', $comments['comments']); $smarty->assign('comment_percent', $comments['comment_percent']); $smarty->assign('pager', $comments['pager']); /* 验证码相关设置 */ if (intval($_CFG['captcha']) & CAPTCHA_COMMENT && gd_version() > 0) { $smarty->assign('enabled_captcha', 1); $smarty->assign('rand', mt_rand()); } $result['message'] = $_CFG['comment_check'] ? $_LANG['cmt_submit_wait'] : $_LANG['cmt_submit_done']; $result['content'] = $smarty->fetch("library/comments_list.lbi"); } echo $json->encode($result); /*------------------------------------------------------ */ //-- PRIVATE FUNCTION /*------------------------------------------------------ */ /** * 添加评论内容 * * @access public * @param object $cmt
$user_rank_list[$k]['def_rank_start_num'] = $rank_goods_start_num[$k]['rank_goods_start_num'] ? 0 : $user_rank_list[$k]['rank_start_num']; $user_rank_list[$k]['rank_start_num'] = $rank_goods_start_num[$k]['rank_goods_start_num']; } } } } $smarty->assign('user_rank_list', $user_rank_list); if (!$is_add) { $smarty->assign('member_price_list', get_member_price_list($_REQUEST['goods_id'])); } $smarty->assign('link_goods_list', $link_goods_list); $smarty->assign('group_goods_list', $group_goods_list); $smarty->assign('goods_article_list', $goods_article_list); $smarty->assign('img_list', img_list($img_list)); $smarty->assign('goods_type_list', goods_type_list($goods['goods_type'])); $smarty->assign('gd', gd_version()); $smarty->assign('thumb_width', $_CFG['thumb_width']); $smarty->assign('thumb_height', $_CFG['thumb_height']); $smarty->assign('goods_attr_html', build_attr_html($goods['goods_type'], $goods['goods_id'])); $volume_price_list = ''; if (isset($_REQUEST['goods_id'])) { $volume_price_list = get_volume_price_list($_REQUEST['goods_id']); } if (empty($volume_price_list)) { $volume_price_list = array('0' => array('number' => '', 'price' => '')); } $smarty->assign('volume_price_list', $volume_price_list); /* 显示商品信息页面 */ assign_query_info(); $smarty->display('goods_info.htm'); } elseif ($_REQUEST['act'] == 'insert' || $_REQUEST['act'] == 'update' || $_REQUEST['act'] == 'special_update') {
ifchecked($settings['sitemap'], 'sitemap'); ifchecked($settings['watermark'], 'watermark'); ifchecked($settings['wap_enable'], 'wap_enable'); ifchecked($settings['banip_enable'], 'banip_enable'); ifchecked($settings['spam_enable'], 'spam_enable'); ifchecked($settings['rss_enable'], 'rss_enable'); ifchecked($settings['use_html'], 'use_html'); ifchecked($settings['permalink'], 'permalink'); ifchecked($settings['jumpwww'], 'jumpwww'); ifchecked($settings['comment_email_reply'], 'comment_email_reply'); ifchecked($settings['seccode'], 'seccode'); ifchecked($settings['seccode_adulterate'], 'seccode_adulterate'); ifchecked($settings['seccode_ttf'], 'seccode_ttf'); ifchecked($settings['seccode_angle'], 'seccode_angle'); ifchecked($settings['seccode_color'], 'seccode_color'); ifchecked($settings['seccode_size'], 'seccode_size'); ifchecked($settings['seccode_shadow'], 'seccode_shadow'); ifchecked($settings['dateconvert'], 'dateconvert'); $waterpos = $tb_spam_level = array(); $settings['server_timezone'] < 0 ? ${'zone_0' . str_replace('.', '_', abs($settings['server_timezone']))} = 'checked' : (${'zone_' . str_replace('.', '_', $settings['server_timezone'])} = 'selected'); $waterpos[$settings['waterpos']] = 'checked'; $tb_spam_level[$settings['tb_spam_level']] = 'checked'; $avatar_level[$settings['avatar_level']] = 'checked'; $gd_version = gd_version(); $gd_version = $gd_version ? '服务器GD版本:' . $gd_version : '服务器不支持GD,因此该功能无法正常使用.'; if (in_array($action, array_flip($settingsmenu))) { $subnav = $settingsmenu[$action]; } $navlink_L = $subnav ? ' » <span>' . $subnav . '</span>' : ''; cpheader($subnav); include template('configurate');
/** * 注册会员的处理 */ function action_register() { // 获取全局变量 $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $err = $GLOBALS['err']; include_once 'includes/cls_json.php'; $json = new JSON(); $res = array('err_msg' => '', 'result' => ''); /* 增加是否关闭注册 */ if ($_CFG['shop_reg_closed']) { $smarty->assign('action', 'register'); $smarty->assign('shop_reg_closed', $_CFG['shop_reg_closed']); $smarty->display('user_passport.dwt'); } else { include_once ROOT_PATH . 'includes/lib_passport.php'; $username = isset($_POST['username']) ? trim($_POST['username']) : ''; $password = isset($_POST['password']) ? trim($_POST['password']) : ''; $email = isset($_POST['email']) ? trim($_POST['email']) : ''; $other['msn'] = isset($_POST['extend_field1']) ? $_POST['extend_field1'] : ''; $other['qq'] = isset($_POST['extend_field2']) ? $_POST['extend_field2'] : ''; $other['office_phone'] = isset($_POST['extend_field3']) ? $_POST['extend_field3'] : ''; $other['home_phone'] = isset($_POST['extend_field4']) ? $_POST['extend_field4'] : ''; $other['mobile_phone'] = isset($_POST['extend_field5']) ? $_POST['extend_field5'] : ''; $sel_question = empty($_POST['sel_question']) ? '' : compile_str($_POST['sel_question']); $passwd_answer = isset($_POST['passwd_answer']) ? compile_str(trim($_POST['passwd_answer'])) : ''; // 注册类型:email、mobile $register_type = isset($_POST['register_type']) ? trim($_POST['register_type']) : ''; $back_act = isset($_POST['back_act']) ? trim($_POST['back_act']) : ''; if (empty($_POST['agreement'])) { $res['err_msg'] = $_LANG['passport_js']['agreement']; $res['err_no'] = 1; die($json->encode($res)); } if (strlen($username) < 3) { $res['err_msg'] = $_LANG['passport_js']['username_shorter']; $res['err_no'] = 1; die($json->encode($res)); } if (strlen($password) < 6) { $res['err_msg'] = $_LANG['passport_js']['password_shorter']; $res['err_no'] = 1; die($json->encode($res)); } if (strpos($password, ' ') > 0) { $res['err_msg'] = $_LANG['passwd_balnk']; $res['err_no'] = 1; die($json->encode($res)); } /* 验证码检查 */ if (intval($_CFG['captcha']) & CAPTCHA_REGISTER && gd_version() > 0) { if (empty($_POST['captcha'])) { $res['err_msg'] = $_LANG['invalid_captcha']; $res['err_no'] = 1; die($json->encode($res)); } /* 检查验证码 */ include_once 'includes/cls_captcha.php'; $validator = new captcha(); if (!$validator->check_word($_POST['captcha'])) { $res['err_msg'] = $_LANG['invalid_captcha']; $res['err_no'] = 1; die($json->encode($res)); } } if (register($username, $password, $email, $other) !== false) { /*把新注册用户的扩展信息插入数据库*/ $sql = 'SELECT id FROM ' . $ecs->table('reg_fields') . ' WHERE type = 0 AND display = 1 ORDER BY dis_order, id'; //读出所有自定义扩展字段的id $fields_arr = $db->getAll($sql); $extend_field_str = ''; //生成扩展字段的内容字符串 foreach ($fields_arr as $val) { $extend_field_index = 'extend_field' . $val['id']; if (!empty($_POST[$extend_field_index])) { $temp_field_content = strlen($_POST[$extend_field_index]) > 100 ? mb_substr($_POST[$extend_field_index], 0, 99) : $_POST[$extend_field_index]; $extend_field_str .= " ('" . $_SESSION['user_id'] . "', '" . $val['id'] . "', '" . compile_str($temp_field_content) . "'),"; } } $extend_field_str = substr($extend_field_str, 0, -1); if ($extend_field_str) { $sql = 'INSERT INTO ' . $ecs->table('reg_extend_info') . ' (`user_id`, `reg_field_id`, `content`) VALUES' . $extend_field_str; $db->query($sql); } /* 写入密码提示问题和答案 */ if (!empty($passwd_answer) && !empty($sel_question)) { $sql = 'UPDATE ' . $ecs->table('users') . " SET `passwd_question`='{$sel_question}', `passwd_answer`='{$passwd_answer}' WHERE `user_id`='" . $_SESSION['user_id'] . "'"; $db->query($sql); } /* 判断是否需要自动发送注册邮件 */ if ($GLOBALS['_CFG']['member_email_validate'] && $GLOBALS['_CFG']['send_verify_email']) { send_regiter_hash($_SESSION['user_id']); } $ucdata = empty($user->ucdata) ? "" : $user->ucdata; if (empty($back_act)) { $back_act = 'index.php'; } $res['err_no'] = 0; $res['back_act'] = $back_act; $res['err_msg'] = ''; die($json->encode($res)); } else { $message['content'] = ''; foreach ($err->_message as $msg) { $message['content'] .= '' . htmlspecialchars($msg) . "\n"; } $res['err_msg'] = $message['content']; $res['err_no'] = 1; die($json->encode($res)); } } }
/** * 调用评论信息 * * @access public * @return string */ function insert_comments($arr) { $need_cache = ECTouch::view()->caching; $need_compile = ECTouch::view()->force_compile; ECTouch::view()->caching = false; ECTouch::view()->force_compile = true; /* 验证码相关设置 */ if (intval(C('captcha')) & CAPTCHA_COMMENT && gd_version() > 0) { ECTouch::view()->assign('enabled_captcha', 1); ECTouch::view()->assign('rand', mt_rand()); } ECTouch::view()->assign('username', stripslashes($_SESSION['user_name'])); ECTouch::view()->assign('email', $_SESSION['email']); ECTouch::view()->assign('comment_type', $arr['type']); ECTouch::view()->assign('id', $arr['id']); $comments = model('Comment')->get_comment_info($arr['id'], 0); ECTouch::view()->assign('comments_info', $comments); //全部评论 $cmt = model('Comment')->assign_comment($arr['id'], $arr['type']); ECTouch::view()->assign('comment_list', $cmt['comments']); ECTouch::view()->assign('pager', $cmt['pager']); //好评 $cmt_fav = model('Comment')->assign_comment($arr['id'], $arr['type'], '1'); ECTouch::view()->assign('comment_fav', $cmt_fav['comments']); ECTouch::view()->assign('pager_fav', $cmt_fav['pager']); //中评 $cmt_med = model('Comment')->assign_comment($arr['id'], $arr['type'], '2'); ECTouch::view()->assign('comment_med', $cmt_med['comments']); ECTouch::view()->assign('pager_med', $cmt_med['pager']); //差评 $cmt_bad = model('Comment')->assign_comment($arr['id'], $arr['type'], '3'); ECTouch::view()->assign('comment_bad', $cmt_bad['comments']); ECTouch::view()->assign('pager_bad', $cmt_bad['pager']); $val = ECTouch::view()->fetch('library/comments_list.lbi'); ECTouch::view()->caching = $need_cache; ECTouch::view()->force_compile = $need_compile; return $val; }
show_message($_LANG['signin_failed'], '', 'flow.php?step=login'); } } elseif (!empty($_POST['act']) && $_POST['act'] == 'signup') { //注册类型 by carson start $enabled_sms = intval($_POST['enabled_sms']); if ($enabled_sms) { $username = $other['mobile_phone'] = isset($_POST['mobile']) ? trim($_POST['mobile']) : ''; $password = isset($_POST['password']) ? trim($_POST['password']) : ''; $email = $username . '@qq.com'; } else { $username = isset($_POST['username']) ? trim($_POST['username']) : ''; $password = isset($_POST['password']) ? trim($_POST['password']) : ''; $email = isset($_POST['email']) ? trim($_POST['email']) : ''; } //注册类型 by carson end if (intval($_CFG['captcha']) & CAPTCHA_REGISTER && gd_version() > 0 && $enabled_sms <= 0) { if (empty($_POST['captcha'])) { show_message($_LANG['invalid_captcha']); } /* 检查验证码 */ include_once 'include/cls_captcha.php'; $validator = new captcha(); if (!$validator->check_word($_POST['captcha'])) { show_message($_LANG['invalid_captcha']); } } if (register($username, $password, $email)) { /* 用户注册成功 */ ecs_header("Location: flow.php?step=consignee\n"); exit; } else {
/** * 注册会员的处理 */ function action_register() { // 获取全局变量 $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; /* 增加是否关闭注册 */ if ($_CFG['shop_reg_closed']) { $smarty->assign('action', 'register'); $smarty->assign('shop_reg_closed', $_CFG['shop_reg_closed']); $smarty->display('user_passport.dwt'); } else { include_once ROOT_PATH . 'includes/lib_passport.php'; $username = isset($_POST['username']) ? trim($_POST['username']) : ''; $password = isset($_POST['password']) ? trim($_POST['password']) : ''; $email = isset($_POST['email']) ? trim($_POST['email']) : ''; $other['msn'] = isset($_POST['extend_field1']) ? $_POST['extend_field1'] : ''; $other['qq'] = isset($_POST['extend_field2']) ? $_POST['extend_field2'] : ''; $other['office_phone'] = isset($_POST['extend_field3']) ? $_POST['extend_field3'] : ''; $other['home_phone'] = isset($_POST['extend_field4']) ? $_POST['extend_field4'] : ''; //$other['mobile_phone'] = isset($_POST['extend_field5']) ? $_POST['extend_field5'] : ''; $sel_question = empty($_POST['sel_question']) ? '' : compile_str($_POST['sel_question']); $passwd_answer = isset($_POST['passwd_answer']) ? compile_str(trim($_POST['passwd_answer'])) : ''; // 注册类型:email、mobile $register_type = isset($_POST['register_type']) ? trim($_POST['register_type']) : ''; $back_act = isset($_POST['back_act']) ? trim($_POST['back_act']) : ''; // if(empty($_POST['agreement'])) // { // show_message($_LANG['passport_js']['agreement']); // } // 注册类型不能为空 if (empty($register_type)) { show_message($_LANG['passport_js']['msg_register_type_blank']); } // 用户名将自动生成 if (strlen($username) < 3) { // show_message($_LANG['passport_js']['username_shorter']); } if (strlen($password) < 6) { show_message($_LANG['passport_js']['password_shorter']); } if (strpos($password, ' ') > 0) { show_message($_LANG['passwd_balnk']); } /* 验证码检查 */ if (intval($_CFG['captcha']) & CAPTCHA_REGISTER && gd_version() > 0) { if (empty($_POST['captcha'])) { show_message($_LANG['invalid_captcha'], $_LANG['sign_up'], 'register.php', 'error'); } /* 检查验证码 */ include_once 'includes/cls_captcha.php'; $captcha = new captcha(); if (!$captcha->check_word(trim($_POST['captcha']))) { show_message($_LANG['invalid_captcha'], $_LANG['sign_up'], 'register.php', 'error'); } } if ($register_type == "email") { /* 邮箱验证码检查 */ require_once ROOT_PATH . 'includes/lib_validate_record.php'; if (empty($email)) { show_message($_LANG['msg_email_blank'], $_LANG['sign_up'], 'register.php', 'error'); } $record = get_validate_record($email); $session_email = $_SESSION[VT_EMAIL_REGISTER]; $email_code = !empty($_POST['email_code']) ? trim($_POST['email_code']) : ''; if (empty($email_code)) { show_message($_LANG['msg_email_code_blank'], $_LANG['sign_up'], 'register.php', 'error'); } else { if ($session_email != $email) { show_message($_LANG['email_changed'], $_LANG['sign_up'], 'register.php', 'error'); } else { if ($email_code != $record['record_code']) { show_message($_LANG['invalid_email_code'], $_LANG['sign_up'], 'register.php', 'error'); } } } /* 邮箱注册时 */ $username = generate_username(); /* 邮箱注册 */ $result = register_by_email($username, $password, $email, $other); if ($result) { /* 删除注册的验证记录 */ remove_validate_record($email); } } else { if ($register_type == "mobile") { require_once ROOT_PATH . 'includes/lib_validate_record.php'; $mobile_phone = !empty($_POST['mobile_phone']) ? trim($_POST['mobile_phone']) : ''; $mobile_code = !empty($_POST['mobile_code']) ? trim($_POST['mobile_code']) : ''; $record = get_validate_record($mobile_phone); $session_mobile_phone = $_SESSION[VT_MOBILE_REGISTER]; /* 手机验证码检查 */ if (empty($mobile_code)) { show_message($_LANG['msg_mobile_phone_blank'], $_LANG['sign_up'], 'register.php', 'error'); } else { if ($session_mobile_phone != $mobile_phone) { show_message($_LANG['mobile_phone_changed'], $_LANG['sign_up'], 'register.php', 'error'); } else { if ($record['record_code'] != $mobile_code) { show_message($_LANG['invalid_mobile_phone_code'], $_LANG['sign_up'], 'register.php', 'error'); } else { if ($record['expired_time'] < time()) { show_message($_LANG['invalid_mobile_phone_code'], $_LANG['sign_up'], 'register.php', 'error'); } } } } /* 手机注册时,用户名默认为u+手机号 */ $username = generate_username_by_mobile($mobile_phone); /* 手机注册 */ $result = register_by_mobile($username, $password, $mobile_phone, $other); if ($result) { /* 删除注册的验证记录 */ remove_validate_record($mobile_phone); } } else { /* 无效的注册类型 */ show_message($_LANG['register_type_invalid'], $_LANG['sign_up'], 'register.php', 'error'); } } /* 随进生成用户名 */ // $username = generate_username(); if ($result) { /* 把新注册用户的扩展信息插入数据库 */ $sql = 'SELECT id FROM ' . $ecs->table('reg_fields') . ' WHERE type = 0 AND display = 1 ORDER BY dis_order, id'; // 读出所有自定义扩展字段的id $fields_arr = $db->getAll($sql); $extend_field_str = ''; // 生成扩展字段的内容字符串 foreach ($fields_arr as $val) { $extend_field_index = 'extend_field' . $val['id']; if (!empty($_POST[$extend_field_index])) { $temp_field_content = strlen($_POST[$extend_field_index]) > 100 ? mb_substr($_POST[$extend_field_index], 0, 99) : $_POST[$extend_field_index]; $extend_field_str .= " ('" . $_SESSION['user_id'] . "', '" . $val['id'] . "', '" . compile_str($temp_field_content) . "'),"; } } $extend_field_str = substr($extend_field_str, 0, -1); if ($extend_field_str) { $sql = 'INSERT INTO ' . $ecs->table('reg_extend_info') . ' (`user_id`, `reg_field_id`, `content`) VALUES' . $extend_field_str; $db->query($sql); } /* 代码增加2014-12-23 by www.68ecshop.com _star */ // if($_SESSION['tag'] > 0) // { // $sql = "update " . $GLOBALS['ecs']->table('users') . " set // is_validated = 1 where user_id = '" . $_SESSION['user_id'] . "'"; // $GLOBALS['db']->query($sql); // } // if($other['mobile_phone'] != '') // { // if($_CFG['sms_register'] == 1) // { // $sql = "update " . $GLOBALS['ecs']->table('users') . " set // validated = 1 where user_id = '" . $_SESSION['user_id'] . "'"; // $GLOBALS['db']->query($sql); // } // } /* 代码增加2014-12-23 by www.68ecshop.com _end */ /* * 代码增加_start By www.68ecshop.com * include_once(ROOT_PATH . '/includes/cls_image.php'); * $image = new cls_image($_CFG['bgcolor']); * $headimg_original = * $GLOBALS['image']->upload_image($_FILES['headimg'], 'headimg/'. * date('Ym')); * * $thumb_path=DATA_DIR. '/headimg/' . date('Ym').'/' ; * $headimg_thumb = $GLOBALS['image']->make_thumb($headimg_original, * '80', '50', $thumb_path); * $headimg_thumb = $headimg_thumb ? $headimg_thumb : * $headimg_original; * if ($headimg_thumb) * { * $sql = 'UPDATE ' . $ecs->table('users') . " SET * `headimg`='$headimg_thumb' WHERE `user_id`='" . * $_SESSION['user_id'] . "'"; * $db->query($sql); * } * 代码增加_end By www.68ecshop.com */ /* 写入密码提示问题和答案 */ if (!empty($passwd_answer) && !empty($sel_question)) { $sql = 'UPDATE ' . $ecs->table('users') . " SET `passwd_question`='{$sel_question}', `passwd_answer`='{$passwd_answer}' WHERE `user_id`='" . $_SESSION['user_id'] . "'"; $db->query($sql); } /* 代码增加_start By www.68ecshop.com */ $now = gmtime(); if ($_CFG['bonus_reg_rand']) { $sql_bonus_ext = " order by rand() limit 0,1"; } $sql_b = "SELECT type_id FROM " . $ecs->table("bonus_type") . " WHERE send_type='" . SEND_BY_REGISTER . "' AND send_start_date<=" . $now . " AND send_end_date>=" . $now . $sql_bonus_ext; $res_bonus = $db->query($sql_b); $kkk_bonus = 0; while ($row_bonus = $db->fetchRow($res_bonus)) { $sql = "INSERT INTO " . $ecs->table('user_bonus') . "(bonus_type_id, bonus_sn, user_id, used_time, order_id, emailed)" . " VALUES('" . $row_bonus['type_id'] . "', 0, '" . $_SESSION['user_id'] . "', 0, 0, 0)"; $db->query($sql); $kkk_bonus = $kkk_bonus + 1; } if ($kkk_bonus) { $_LANG['register_success'] = '用户名 %s 注册成功,并获得官方赠送的红包礼品'; } /* 代码增加_end By www.68ecshop.com */ /* 判断是否需要自动发送注册邮件 */ if ($GLOBALS['_CFG']['member_email_validate'] && $GLOBALS['_CFG']['send_verify_email']) { send_regiter_hash($_SESSION['user_id']); } $ucdata = empty($user->ucdata) ? "" : $user->ucdata; show_message(sprintf($_LANG['register_success'], $username . $ucdata), array($_LANG['back_up_page'], $_LANG['profile_lnk']), array($back_act, 'user.php'), 'info'); } else { $GLOBALS['err']->show($_LANG['sign_up'], 'register.php'); } } /* 代码增加2014-12-23 by www.68ecshop.com _star */ }
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liubo $ * $Id: message.php 17217 2011-01-19 06:29:08Z liubo $ */ define('IN_ECTOUCH', true); require dirname(__FILE__) . '/include/init.php'; if (empty($_CFG['message_board'])) { show_message($_LANG['message_board_close']); } $action = isset($_REQUEST['act']) ? trim($_REQUEST['act']) : 'default'; if ($action == 'act_add_message') { include_once ROOT_PATH . 'include/lib_clips.php'; /* 验证码防止灌水刷屏 */ if (intval($_CFG['captcha']) & CAPTCHA_MESSAGE && gd_version() > 0) { include_once 'include/cls_captcha.php'; $validator = new captcha(); if (!$validator->check_word($_POST['captcha'])) { show_message($_LANG['invalid_captcha']); } } else { /* 没有验证码时,用时间来限制机器人发帖或恶意发评论 */ if (!isset($_SESSION['send_time'])) { $_SESSION['send_time'] = 0; } $cur_time = gmtime(); if ($cur_time - $_SESSION['send_time'] < 30) { show_message($_LANG['cmt_spam_warning']); } }
/** * 保存某商品的相册图片 * @param int $goods_id * @param array $image_files * @param array $image_descs * @return void */ function handle_gallery_image($goods_id, $image_files, $image_descs, $image_urls) { /* 是否处理缩略图 */ $proc_thumb = isset($GLOBALS['shop_id']) && $GLOBALS['shop_id'] > 0 ? false : true; foreach ($image_descs as $key => $img_desc) { /* 是否成功上传 */ $flag = false; if (isset($image_files['error'])) { if ($image_files['error'][$key] == 0) { $flag = true; } } else { if ($image_files['tmp_name'][$key] != 'none') { $flag = true; } } if ($flag) { // 生成缩略图 if ($proc_thumb) { $thumb_url = $GLOBALS['image']->make_thumb($image_files['tmp_name'][$key], $GLOBALS['_CFG']['thumb_width'], $GLOBALS['_CFG']['thumb_height']); $thumb_url = is_string($thumb_url) ? $thumb_url : ''; } $upload = array('name' => $image_files['name'][$key], 'type' => $image_files['type'][$key], 'tmp_name' => $image_files['tmp_name'][$key], 'size' => $image_files['size'][$key]); if (isset($image_files['error'])) { $upload['error'] = $image_files['error'][$key]; } $img_original = $GLOBALS['image']->upload_image($upload); if ($img_original === false) { sys_msg($GLOBALS['image']->error_msg(), 1, array(), false); } $img_url = $img_original; if (!$proc_thumb) { $thumb_url = $img_original; } // 如果服务器支持GD 则添加水印 if ($proc_thumb && gd_version() > 0) { $pos = strpos(basename($img_original), '.'); $newname = dirname($img_original) . '/' . $GLOBALS['image']->random_filename() . substr(basename($img_original), $pos); copy('../' . $img_original, '../' . $newname); $img_url = $newname; $GLOBALS['image']->add_watermark('../' . $img_url, '', $GLOBALS['_CFG']['watermark'], $GLOBALS['_CFG']['watermark_place'], $GLOBALS['_CFG']['watermark_alpha']); } /* 重新格式化图片名称 */ $img_original = reformat_image_name('gallery', $goods_id, $img_original, 'source'); $img_url = reformat_image_name('gallery', $goods_id, $img_url, 'goods'); $thumb_url = reformat_image_name('gallery_thumb', $goods_id, $thumb_url, 'thumb'); $sql = "INSERT INTO " . $GLOBALS['ecs']->table('goods_gallery') . " (goods_id, img_url, img_desc, thumb_url, img_original) " . "VALUES ('{$goods_id}', '{$img_url}', '{$img_desc}', '{$thumb_url}', '{$img_original}')"; $GLOBALS['db']->query($sql); /* 不保留商品原图的时候删除原图 */ if ($proc_thumb && !$GLOBALS['_CFG']['retain_original_img'] && !empty($img_original)) { $GLOBALS['db']->query("UPDATE " . $GLOBALS['ecs']->table('goods_gallery') . " SET img_original='' WHERE `goods_id`='{$goods_id}'"); @unlink('../' . $img_original); } } elseif (!empty($image_urls[$key]) && $image_urls[$key] != $GLOBALS['_LANG']['img_file'] && $image_urls[$key] != 'http://' && copy(trim($image_urls[$key]), ROOT_PATH . 'temp/' . basename($image_urls[$key]))) { $image_url = trim($image_urls[$key]); //定义原图路径 $down_img = ROOT_PATH . 'temp/' . basename($image_url); // 生成缩略图 if ($proc_thumb) { $thumb_url = $GLOBALS['image']->make_thumb($down_img, $GLOBALS['_CFG']['thumb_width'], $GLOBALS['_CFG']['thumb_height']); $thumb_url = is_string($thumb_url) ? $thumb_url : ''; $thumb_url = reformat_image_name('gallery_thumb', $goods_id, $thumb_url, 'thumb'); } if (!$proc_thumb) { $thumb_url = htmlspecialchars($image_url); } /* 重新格式化图片名称 */ $img_url = $img_original = htmlspecialchars($image_url); $sql = "INSERT INTO " . $GLOBALS['ecs']->table('goods_gallery') . " (goods_id, img_url, img_desc, thumb_url, img_original) " . "VALUES ('{$goods_id}', '{$img_url}', '{$img_desc}', '{$thumb_url}', '{$img_original}')"; $GLOBALS['db']->query($sql); @unlink($down_img); } } }
recalculate_price(); // 重新计算购物车中的商品价格 /* 检查购物车中是否有商品 没有商品则跳转到首页 */ $sql = "SELECT COUNT(*) FROM " . $ecs->table('cart') . " WHERE session_id = '" . SESS_ID . "' "; if ($db->getOne($sql) > 0) { ecs_header("Location: flow.php?step=checkout\n"); } else { ecs_header("Location:index.php\n"); } exit; } else { $_SESSION['login_fail']++; show_message($_LANG['signin_failed'], '', 'flow.php?step=login'); } } elseif (!empty($_POST['act']) && $_POST['act'] == 'signup') { if (intval($_CFG['captcha']) & CAPTCHA_REGISTER && gd_version() > 0) { if (empty($_POST['captcha'])) { show_message($_LANG['invalid_captcha']); } /* 检查验证码 */ include_once 'includes/cls_captcha.php'; $validator = new captcha(); if (!$validator->check_word($_POST['captcha'])) { show_message($_LANG['invalid_captcha']); } } if (register(trim($_POST['username']), trim($_POST['password']), trim($_POST['email']))) { /* 用户注册成功 */ ecs_header("Location: flow.php?step=consignee\n"); exit; } else {
/** * 调用评论信息 * * @access public * @return string */ function insert_question($arr) { $need_cache = $GLOBALS['smarty']->caching; $need_compile = $GLOBALS['smarty']->force_compile; $GLOBALS['smarty']->caching = false; $GLOBALS['smarty']->force_compile = true; /* 验证码相关设置 */ if (intval($GLOBALS['_CFG']['captcha']) & CAPTCHA_QUESTION && gd_version() > 0) { $GLOBALS['smarty']->assign('enabled_captcha_question', 1); $GLOBALS['smarty']->assign('rand', mt_rand()); } $GLOBALS['smarty']->assign('username', stripslashes($_SESSION['user_name'])); $GLOBALS['smarty']->assign('email', $_SESSION['email']); $GLOBALS['smarty']->assign('id', $arr['id']); $cmt = assign_question($arr['id']); $GLOBALS['smarty']->assign('question_list', $cmt['comments']); $GLOBALS['smarty']->assign('pager', $cmt['pager']); $val = $GLOBALS['smarty']->fetch('library/question_list.lbi'); $GLOBALS['smarty']->caching = $need_cache; $GLOBALS['smarty']->force_compile = $need_compile; return $val; }
/** * 调用评论信息 * * @access public * @return string */ function insert_comments($arr) { $need_cache = $GLOBALS['smarty']->caching; $need_compile = $GLOBALS['smarty']->force_compile; $GLOBALS['smarty']->caching = false; $GLOBALS['smarty']->force_compile = true; /* 验证码相关设置 */ if (intval(C('captcha')) & CAPTCHA_COMMENT && gd_version() > 0) { $GLOBALS['smarty']->assign('enabled_captcha', 1); $GLOBALS['smarty']->assign('rand', mt_rand()); } $GLOBALS['smarty']->assign('username', stripslashes($_SESSION['user_name'])); $GLOBALS['smarty']->assign('email', $_SESSION['email']); $GLOBALS['smarty']->assign('comment_type', $arr['type']); $GLOBALS['smarty']->assign('id', $arr['id']); $cmt = assign_comment($arr['id'], $arr['type']); $GLOBALS['smarty']->assign('comments', $cmt['comments']); $GLOBALS['smarty']->assign('pager', $cmt['pager']); $val = $GLOBALS['smarty']->fetch('library/comments_list.lbi'); $GLOBALS['smarty']->caching = $need_cache; $GLOBALS['smarty']->force_compile = $need_compile; return $val; }
/** * 找回密码第一步:验证用户名/邮箱/已验证手机号 */ function action_check_username() { //获取全局变量 $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $username = empty($_POST['u_name']) ? '' : $_POST['u_name']; $user_id = null; if (empty($username)) { show_message('请输入用户名/邮箱/已验证的手机号!', '返回', 'findPwd.php?act=index', 'info'); } // 处理验证码 $captcha = intval($_CFG['captcha']); if ($captcha & CAPTCHA_LOGIN && (!($captcha & CAPTCHA_LOGIN_FAIL) || $captcha & CAPTCHA_LOGIN_FAIL && $_SESSION['login_fail'] > 2) && gd_version() > 0) { if (empty($_POST['captcha'])) { show_message($_LANG['invalid_captcha'], $_LANG['relogin_lnk'], 'findPwd.php', 'error'); } /* 检查验证码 */ include_once 'includes/cls_captcha.php'; $validator = new captcha(); $validator->session_word = 'captcha_login'; if (!$validator->check_word($_POST['captcha'])) { show_message($_LANG['invalid_captcha'], $_LANG['relogin_lnk'], 'findPwd.php', 'error'); } } $username_exist = false; $sql = "select user_id from " . $ecs->table('users') . " where user_name = '" . $username . "'"; $user_id = $db->getOne($sql); if ($user_id) { // 用户名存在 $username_exist = true; } // 判断是否诶邮箱 if (is_email($username) && !$username_exist) { $sql = "select user_id from " . $ecs->table('users') . " where email='" . $username . "' "; $user_id = $db->getOne($sql); if ($user_id) { // 用户名存在 $username_exist = true; } } // 判断是否为手机号 if (is_mobile_phone($username) && !$username_exist) { $sql = "select user_id from " . $ecs->table('users') . " where mobile_phone='" . $username . "'"; $rows = $db->query($sql); $index = 0; while ($row = $db->fetchRow($rows)) { $user_id = $row['user_id']; $index = $index + 1; } if ($index > 1) { show_message('本网站有多个会员ID绑定了和您相同的手机号,请使用其他登录方式,如:邮箱或用户名。', $_LANG['relogin_lnk'], 'findPwd.php', 'error'); } else { if ($index == 1) { if ($user_id) { // 用户名存在 $username_exist = true; } } } } // 检查用户名是否存在 if (!$username_exist) { show_message('您输入的账户名不存在,请核对后重新输入。', $_LANG['relogin_lnk'], 'findPwd.php', 'error'); } // 获取用户信息,判断用户是否验证了手机、邮箱 $sql = "select user_id, user_name, email, mobile_phone from " . $ecs->table('users') . " where user_id = '" . $user_id . "'"; $row = $db->getRow($sql); if ($row == false) { show_message('您输入的账户名不存在,请核对后重新输入。', $_LANG['relogin_lnk'], 'findPwd.php', 'error'); } $validate_types = array(); if (isset($row['mobile_phone']) && !empty($row['mobile_phone'])) { // 处理手机号,不让前台显示 $mobile_phone = $row['mobile_phone']; $mobile_phone = substr($mobile_phone, 0, 3) . '*****' . substr($mobile_phone, -3); $validate_types[] = array('type' => 'mobile_phone', 'name' => '已验证的手机号码', 'value' => $mobile_phone); } if (isset($row['email']) && !empty($row['email'])) { $email = $row['email']; // 处理手机号,不让前台显示 $email_head = substr($email, 0, strpos($email, '@')); $email_domain = substr($email, strpos($email, '@')); if (strlen($email_head) == 1) { $email = substr($email_head, 0, 1) . '*****' . $email_domain; } else { if (strlen($email_head) <= 4) { $email = substr($email_head, 0, 1) . '*****' . substr($email_head, -1) . $email_domain; } else { if (strlen($email_head) <= 7) { $email = substr($email_head, 0, 2) . '*****' . substr($email_head, -2) . $email_domain; } else { $email = substr($email_head, 0, 3) . '*****' . substr($email_head, -3) . $email_domain; } } } $validate_types[] = array('type' => 'email', 'name' => '邮箱', 'value' => $email); } $_SESSION['find_password'] = array('user_id' => $row['user_id'], 'user_name' => $row['user_name'], 'email' => $row['email'], 'mobile_phone' => $row['mobile_phone']); //用于validate.php获取数据 $_SESSION[VT_MOBILE_VALIDATE] = $row['mobile_phone']; $_SESSION[VT_EMAIL_VALIDATE] = $row['email']; $smarty->assign("validate_types", $validate_types); $smarty->assign("action", "step_2"); $smarty->display('user_findPwd.dwt'); }
function insert_get_adv_child($arr) { $need_cache = $GLOBALS['smarty']->caching; $need_compile = $GLOBALS['smarty']->force_compile; $GLOBALS['smarty']->caching = false; $GLOBALS['smarty']->force_compile = true; /* 验证码相关设置 */ if (intval($GLOBALS['_CFG']['captcha']) & CAPTCHA_COMMENT && gd_version() > 0) { $GLOBALS['smarty']->assign('enabled_captcha', 1); $GLOBALS['smarty']->assign('rand', mt_rand()); } $id_name = '_' . $arr['id'] . "',"; $str_ad = str_replace(',', $id_name, $arr['ad_arr']); $in_ad_arr = substr($str_ad, 0, strlen($str_ad) - 1); $GLOBALS['smarty']->assign('id', $arr['id']); //zhouhuan if (!empty($arr['ad_key'])) { $in_ad_arr = "'c" . $arr['ad_key'] . '_' . $arr['id'] . "'"; } $GLOBALS['smarty']->assign('ad_title', $arr['ad_title']); $GLOBALS['smarty']->assign('ad_child', get_ad_posti_child($in_ad_arr)); $val = $GLOBALS['smarty']->fetch('library/position_get_adv_small.lbi'); $GLOBALS['smarty']->caching = $need_cache; $GLOBALS['smarty']->force_compile = $need_compile; return $val; }
public function actionControl_panel() { global $gd_exist, $zip_support; is_admin(); $current_tab = 'overview'; $tabs_array = array('overview', 'siteset', 'message', 'ban_ip'); $tabs_name_array = array(t('ACP_OVERVIEW'), t('ACP_CONFSET'), t('ACP_MANAGE_POST'), t('ACP_MANAGE_IP')); if (isset($_GET['subtab'])) { if (in_array($_GET['subtab'], $tabs_array)) { $current_tab = $_GET['subtab']; } } $themes = get_all_themes(); $data = get_all_data(TRUE, false, TRUE, TRUE, false); $reply_data = $this->_model->queryAll(parse_tbprefix("SELECT * FROM <reply>")); $ban_ip_info = $this->_model->queryAll(parse_tbprefix("SELECT * FROM <badip>")); $nums = count($data); $reply_num = count($reply_data); if ($gd_exist) { $gd_info = gd_version(); $gd_version = $gd_info ? $gd_info : '<font color="red">' . t('UNKNOWN') . '</font>'; } else { $gd_version = '<font color="red">GD' . t('NOT_SUPPORT') . '</font>'; } $register_globals = ini_get("register_globals") ? 'On' : 'Off'; $magic_quotes_gpc = ini_get("magic_quotes_gpc") ? 'On' : 'Off'; $languages = get_all_langs(); $timezone_array = get_all_timezone(); $this->render('admin', array('tabs_array' => $tabs_array, 'current_tab' => $current_tab, 'tabs_name_array' => $tabs_name_array, 'nums' => $nums, 'reply_num' => $reply_num, 'gd_version' => $gd_version, 'register_globals' => $register_globals, 'magic_quotes_gpc' => $magic_quotes_gpc, 'zip_support' => $zip_support, 'themes' => $themes, 'timezone_array' => $timezone_array, 'languages' => $languages, 'data' => $data, 'ban_ip_info' => $ban_ip_info)); }
$smarty->assign('help_lang', $_CFG['lang']); $smarty->assign('charset', EC_CHARSET); $smarty->assign('admin_id', $_SESSION['admin_id']); $smarty->display('menu.htm'); } elseif ($_REQUEST['act'] == 'clear_cache') { clear_all_files(); sys_msg($_LANG['caches_cleared']); } elseif ($_REQUEST['act'] == 'main') { //开店向导第一步 if (isset($_SESSION['shop_guide']) && $_SESSION['shop_guide'] === true) { unset($_SESSION['shop_guide']); //销毁session ecs_header("Location: ./index.php?act=first\n"); exit; } $gd = gd_version(); /* 检查文件目录属性 */ $warning = array(); if ($_CFG['shop_closed']) { $warning[] = $_LANG['shop_closed_tips']; } if (file_exists('../install')) { $warning[] = $_LANG['remove_install']; } if (file_exists('../upgrade')) { $warning[] = $_LANG['remove_upgrade']; } $open_basedir = ini_get('open_basedir'); if (!empty($open_basedir)) { /* 如果 open_basedir 不为空,则检查是否包含了 upload_tmp_dir */ $open_basedir = str_replace(array("\\", "\\\\"), array("/", "/"), $open_basedir);
/** * 登录信息 */ public function login() { //用户登录注册 if ($_SERVER['REQUEST_METHOD'] == 'GET') { $this->assign('anonymous_buy', C('anonymous_buy')); /* 检查是否有赠品,如果有提示登录后重新选择赠品 */ $count = $this->model->table('cart')->field('count(*)')->where("session_id = '" . SESS_ID . "' AND is_gift > 0")->getOne(); if ($count > 0) { $this->assign('need_rechoose_gift', 1); } /* 检查是否需要注册码 */ $captcha = intval(C('captcha')); if ($captcha & CAPTCHA_LOGIN && (!($captcha & CAPTCHA_LOGIN_FAIL) || $captcha & CAPTCHA_LOGIN_FAIL && $_SESSION['login_fail'] > 2) && gd_version() > 0) { $this->assign('enabled_login_captcha', 1); $this->assign('rand', mt_rand()); } if ($captcha & CAPTCHA_REGISTER) { $this->assign('enabled_register_captcha', 1); $this->assign('rand', mt_rand()); } } else { $act = in($_POST['act']); $username = in($_POST['username']); $password = in($_POST['password']); $remember = in($_POST['remember']); $email = in($_POST['email']); $post_captcha = in($_POST['captcha']); if ($act == 'signin') { $captcha = intval(C('captcha')); if ($captcha & CAPTCHA_LOGIN && (!($captcha & CAPTCHA_LOGIN_FAIL) || $captcha & CAPTCHA_LOGIN_FAIL && $_SESSION['login_fail'] > 2) && gd_version() > 0) { if (empty($post_captcha)) { show_message(L('invalid_captcha')); } if ($_SESSION['ectouch_verify'] !== $_POST['captcha']) { show_message(L('invalid_captcha')); } } if (self::$user->login($username, $password, isset($remember))) { model('Users')->update_user_info(); // 更新用户信息 model('Users')->recalculate_price(); // 重新计算购物车中的商品价格 /* 检查购物车中是否有商品 没有商品则跳转到首页 */ $count = $this->model->table('cart')->field('count(*)')->where("session_id = '" . SESS_ID . "'")->getOne(); if ($count > 0) { ecs_header("Location: " . url('flow/checkout') . "\n"); } else { ecs_header("Location:index.php\n"); } } else { $_SESSION['login_fail']++; show_message(L('signin_failed'), '', url('flow/index', array('step' => 'login'))); } } elseif ($act == 'signup') { if (intval(C('captcha')) & CAPTCHA_REGISTER && gd_version() > 0) { if (empty($post_captcha)) { show_message(L('invalid_captcha')); } if ($_SESSION['ectouch_verify'] !== $_POST['captcha']) { show_message(L('invalid_captcha')); } } if (model('Users')->register(trim($username), trim($password), trim($email))) { /* 用户注册成功 */ ecs_header("Location: " . url('flow/consignee') . "\n"); } else { ECTouch::err()->show(); } } else { // TODO: 非法访问的处理 } } $this->assign('currency_format', C('currency_format')); $this->assign('integral_scale', C('integral_scale')); $this->assign('step', ACTION_NAME); $this->assign('action', 'login'); /* 验证码相关设置 */ if (intval(C('captcha')) & CAPTCHA_REGISTER && gd_version() > 0) { $this->assign('enabled_captcha', 1); $this->assign('rand', mt_rand()); } $this->display('flow.dwt'); }
recalculate_price(); $ucdata = isset($user->ucdata) ? $user->ucdata : ''; show_message($_LANG['login_success'] . $ucdata, array($_LANG['back_up_page'], $_LANG['profile_lnk']), array($back_act, 'user.php'), 'info'); } else { $_SESSION['login_fail']++; show_message($_LANG['login_failure'], $_LANG['relogin_lnk'], 'user.php', 'error'); } } elseif ($action == 'signin') { include_once 'includes/cls_json.php'; $json = new JSON(); $username = !empty($_POST['username']) ? json_str_iconv(trim($_POST['username'])) : ''; $password = !empty($_POST['password']) ? trim($_POST['password']) : ''; $captcha = !empty($_POST['captcha']) ? json_str_iconv(trim($_POST['captcha'])) : ''; $result = array('error' => 0, 'content' => ''); $captcha = intval($_CFG['captcha']); if ($captcha & CAPTCHA_LOGIN && (!($captcha & CAPTCHA_LOGIN_FAIL) || $captcha & CAPTCHA_LOGIN_FAIL && $_SESSION['login_fail'] > 2) && gd_version() > 0) { if (empty($captcha)) { $result['error'] = 1; $result['content'] = $_LANG['invalid_captcha']; die($json->encode($result)); } /* 检查验证码 */ include_once 'includes/cls_captcha.php'; $validator = new captcha(); $validator->session_word = 'captcha_login'; if (!$validator->check_word($_POST['captcha'])) { $result['error'] = 1; $result['content'] = $_LANG['invalid_captcha']; die($json->encode($result)); } }
/** * Writes text to the image. * * @param resource $im The image. * @param string $string The string to be written * * @return bool False if string is empty, true otherwise */ function draw_string(&$im, $string) { global $use_ttf, $min_size, $max_size, $min_angle, $max_angle, $ttf_fonts, $img_height, $img_width; if (empty($string)) { return false; } $spacing = $img_width / my_strlen($string); $string_length = my_strlen($string); for ($i = 0; $i < $string_length; ++$i) { // Using TTF fonts if ($use_ttf) { // Select a random font size $font_size = my_rand($min_size, $max_size); // Select a random font $font = array_rand($ttf_fonts); $font = $ttf_fonts[$font]; // Select a random rotation $rotation = my_rand($min_angle, $max_angle); // Set the colour $r = my_rand(0, 200); $g = my_rand(0, 200); $b = my_rand(0, 200); $color = imagecolorallocate($im, $r, $g, $b); // Fetch the dimensions of the character being added $dimensions = imageftbbox($font_size, $rotation, $font, $string[$i], array()); $string_width = $dimensions[2] - $dimensions[0]; $string_height = $dimensions[3] - $dimensions[5]; // Calculate character offsets //$pos_x = $pos_x + $string_width + ($string_width/4); $pos_x = $spacing / 4 + $i * $spacing; $pos_y = ceil($img_height - $string_height / 2); // Draw a shadow $shadow_x = my_rand(-3, 3) + $pos_x; $shadow_y = my_rand(-3, 3) + $pos_y; $shadow_color = imagecolorallocate($im, $r + 20, $g + 20, $b + 20); imagefttext($im, $font_size, $rotation, $shadow_x, $shadow_y, $shadow_color, $font, $string[$i], array()); // Write the character to the image imagefttext($im, $font_size, $rotation, $pos_x, $pos_y, $color, $font, $string[$i], array()); } else { // Get width/height of the character $string_width = imagefontwidth(5); $string_height = imagefontheight(5); // Calculate character offsets $pos_x = $spacing / 4 + $i * $spacing; $pos_y = $img_height / 2 - $string_height - 10 + my_rand(-3, 3); // Create a temporary image for this character if (gd_version() >= 2) { $temp_im = imagecreatetruecolor(15, 20); } else { $temp_im = imagecreate(15, 20); } $bg_color = imagecolorallocate($temp_im, 255, 255, 255); imagefill($temp_im, 0, 0, $bg_color); imagecolortransparent($temp_im, $bg_color); // Set the colour $r = my_rand(0, 200); $g = my_rand(0, 200); $b = my_rand(0, 200); $color = imagecolorallocate($temp_im, $r, $g, $b); // Draw a shadow $shadow_x = my_rand(-1, 1); $shadow_y = my_rand(-1, 1); $shadow_color = imagecolorallocate($temp_im, $r + 50, $g + 50, $b + 50); imagestring($temp_im, 5, 1 + $shadow_x, 1 + $shadow_y, $string[$i], $shadow_color); imagestring($temp_im, 5, 1, 1, $string[$i], $color); // Copy to main image imagecopyresized($im, $temp_im, $pos_x, $pos_y, 0, 0, 40, 55, 15, 20); imagedestroy($temp_im); } } return true; }