当前位置: 首页>>代码示例>>PHP>>正文


PHP mc_option函数代码示例

本文整理汇总了PHP中mc_option函数的典型用法代码示例。如果您正苦于以下问题:PHP mc_option函数的具体用法?PHP mc_option怎么用?PHP mc_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mc_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: submit

 public function submit()
 {
     $ip_false = M('option')->where("meta_key='ip_false' AND type='user'")->getField('meta_value', true);
     if ($ip_false && in_array(mc_user_ip(), $ip_false)) {
         $this->error('您的IP被永久禁止登陆!');
     } else {
         $user_name = mc_magic_in(mc_remove_html($_POST['user_name'], 'all'));
         if ($user_name == '') {
             $this->error('账号必须填写!');
         } else {
             $user_login = M('meta')->where("meta_key='user_name' AND type ='user'")->getField('meta_value', true);
             if (in_array(strip_tags($_POST['user_name']), $user_login)) {
                 $this->error('账号已存在!');
             }
         }
         $user_email = mc_magic_in(mc_remove_html($_POST['user_email'], 'all'));
         if (empty($user_email)) {
             $this->error('邮箱必须填写!');
         } else {
             $user_email = M('meta')->where("meta_key='user_email' AND type ='user'")->getField('meta_value', true);
             if (in_array(strip_tags($_POST['user_email']), $user_email)) {
                 $this->error('邮箱已存在!');
             }
         }
         if (empty($_POST['user_pass'])) {
             $this->error('密码必须填写!');
         }
         if ($_POST['user_pass'] != $_POST['user_pass2']) {
             $this->error('两次密码必须一致!');
         }
         $user['title'] = I('param.user_name');
         $user['content'] = '';
         $user['type'] = 'user';
         $user['date'] = strtotime("now");
         $result = M("page")->data($user)->add();
         if ($result) {
             mc_add_meta($result, 'user_name', $user_name, 'user');
             $user_pass = md5(I('param.user_pass') . mc_option('site_key'));
             mc_add_meta($result, 'user_pass', $user_pass, 'user');
             mc_add_meta($result, 'user_email', $user_email, 'user');
             mc_add_meta($result, 'user_level', '1', 'user');
             cookie('user_name', I('param.user_name'), 36000000000);
             cookie('user_pass', $user_pass, 36000000000);
             $ip_array = M('action')->where("page_id='" . mc_user_id() . "' AND action_key='ip'")->getField('action_value', true);
             if ($ip_array && in_array(mc_user_ip(), $ip_array)) {
             } else {
                 if (!mc_is_admin()) {
                     mc_add_action(mc_user_id(), 'ip', mc_user_ip());
                 }
             }
             if ($_POST['comefrom']) {
                 $this->success('注册成功', $_POST['comefrom']);
             } else {
                 $this->success('注册成功', U('user/index/edit?id=' . mc_user_id()));
             }
         } else {
             $this->error('注册失败');
         }
     }
 }
开发者ID:xiaowei521,项目名称:vamshop,代码行数:60,代码来源:RegisterController.class.php

示例2: mc_mail

function mc_mail($to, $subject, $body)
{
    $mail = new PHPMailer();
    // 设置PHPMailer使用SMTP服务器发送Email
    $mail->IsSMTP();
    // 设置邮件的字符编码,若不指定,则为'UTF-8'
    $mail->CharSet = 'UTF-8';
    /*--------------- 邮件函数 ---------------*/
    // 添加收件人地址,可以多次使用来添加多个收件人
    $mail->AddAddress($to);
    // 设置邮件标题
    $mail->Subject = $subject;
    // 设置邮件正文
    $mail->Body = $body;
    /*--------------- 邮件函数 ---------------*/
    /*--------------- 设置 ---------------*/
    // 这部分必须和你的实际账号相同,否则会验证出错。
    $mail->From = mc_option('stmp_from');
    // 设置发件人名字
    $mail->FromName = mc_option('stmp_name');
    // 设置SMTP服务器。这里使用网易的SMTP服务器。
    $mail->Host = mc_option('stmp_host');
    // 设置SMTP服务器端口。
    $mail->SMTP_PORT = mc_option('stmp_port');
    // 设置为“需要验证”
    $mail->SMTPAuth = true;
    // 设置用户名和密码,即SMTP服务的用户名和密码。
    $mail->Username = mc_option('stmp_username');
    $mail->Password = mc_option('stmp_password');
    /*--------------- 设置 ---------------*/
    // 发送邮件。
    $mail->Send();
}
开发者ID:dalinhuang,项目名称:shouzhangmall,代码行数:33,代码来源:formail.php

示例3: submit

 public function submit()
 {
     $ip_false = M('option')->where("meta_key='ip_false' AND type='user'")->getField('meta_value', true);
     if ($ip_false && in_array(mc_user_ip(), $ip_false)) {
         $this->error('您的IP被永久禁止登陆!');
     } else {
         $page_id = M('meta')->where("meta_key='user_name' AND meta_value='" . mc_magic_in(I('param.user_name')) . "' AND type='user'")->getField('page_id');
         $user_pass_true = mc_get_meta($page_id, 'user_pass', true, 'user');
         if ($_POST['user_name'] && $_POST['user_pass'] && md5($_POST['user_pass'] . mc_option('site_key')) == $user_pass_true) {
             $user_pass = md5(I('param.user_pass') . mc_option('site_key'));
             cookie('user_name', I('param.user_name'), 36000000000);
             cookie('user_pass', $user_pass, 36000000000);
             $ip_array = M('action')->where("page_id='" . mc_user_id() . "' AND action_key='ip'")->getField('action_value', true);
             if ($ip_array && in_array(mc_user_ip(), $ip_array)) {
             } else {
                 if (!mc_is_admin()) {
                     mc_add_action(mc_user_id(), 'ip', mc_user_ip());
                 }
             }
             if ($_POST['comefrom']) {
                 $this->success('登陆成功', $_POST['comefrom']);
             } else {
                 if (mc_is_mobile()) {
                     $this->success('登陆成功', U('user/index/pro?id=' . mc_user_id()));
                 } else {
                     $this->success('登陆成功', U('user/index/index?id=' . mc_user_id()));
                 }
             }
         } else {
             $this->error('用户名与密码不符!');
         }
     }
 }
开发者ID:xiaowei521,项目名称:vamshop,代码行数:33,代码来源:LoginController.class.php

示例4: add_post

 public function add_post($id = false, $number = false)
 {
     if (mc_user_id()) {
         if ($_GET['wish'] == 1) {
             if (is_numeric($id) && is_numeric($number) && $number > 0) {
                 if (mc_get_meta($id, 'kucun') <= 0) {
                     $this->error('商品库存不足!');
                 } else {
                     if ($_POST['parameter']) {
                         $this->assign('parameter', $_POST['parameter']);
                         $this->assign('cart', $number);
                     } else {
                         //本商品不存在多种型号
                         $this->assign('cart', $number);
                     }
                 }
             } else {
                 $this->error('参数错误!');
             }
         }
         $this->theme(mc_option('theme'))->display('Publish/add_post');
     } else {
         $this->success('请先登陆', U('User/login/index'));
     }
 }
开发者ID:xiaowei521,项目名称:vamshop,代码行数:25,代码来源:IndexController.class.php

示例5: submit

 public function submit($user_email)
 {
     $page_id = M('meta')->where("meta_key='user_email' AND meta_value='" . I('param.user_email') . "' AND type='user'")->getField('page_id');
     $pass = rand(100000, 999999);
     mc_update_meta($page_id, 'user_pass', md5($pass . mc_option('site_key')), 'user');
     $body = '您的新密码为:' . $pass . ',请尽快修改密码!';
     mc_mail($user_email, '找回密码', $body);
     $this->success('找回密码成功', U('user/login/index'), 10);
 }
开发者ID:dalinhuang,项目名称:shouzhangmall,代码行数:9,代码来源:LostpassController.class.php

示例6: index

 public function index($page = 1)
 {
     if (mc_site_url()) {
         $site_url = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER['PHP_SELF'];
         $site_url = preg_replace("/\\/[a-z0-9]+\\.php.*/is", "", $site_url);
         if ($site_url != mc_site_url()) {
             $url = mc_site_url();
             Header("Location:{$url}");
         } else {
             if (is_numeric($page)) {
                 if ($_GET['keyword']) {
                     if ($_GET['stype'] == 'article') {
                         $condition['type'] = 'article';
                     } elseif ($_GET['stype'] == 'publish') {
                         $condition['type'] = 'publish';
                     } else {
                         $condition['type'] = 'pro';
                     }
                     $where['content'] = array('like', "%{$_GET['keyword']}%");
                     $where['title'] = array('like', "%{$_GET['keyword']}%");
                     $where['_logic'] = 'or';
                     $condition['_complex'] = $where;
                     $this->page = M('page')->where($condition)->order('id desc')->page($page, mc_option('page_size'))->select();
                     $count = M('page')->where($condition)->count();
                     $this->assign('count', $count);
                     $this->assign('page_now', $page);
                     if ($_GET['stype'] == 'article') {
                         $this->theme(mc_option('theme'))->display('Article/search');
                     } elseif ($_GET['stype'] == 'publish') {
                         $this->theme(mc_option('theme'))->display('Post/search');
                     } else {
                         $this->theme(mc_option('theme'))->display('Pro/search');
                     }
                 } else {
                     if (is_numeric($_GET['ref'])) {
                         session('mc_reffer', $_GET['ref']);
                         if (mc_user_id() && mc_user_id() != session('mc_reffer') && session('mc_reffer')) {
                             $user_id = mc_user_id();
                             $ref_a = mc_get_meta($user_id, 'ref', true, 'user');
                             if (!is_numeric($ref_a)) {
                                 mc_add_meta($user_id, 'ref', session('mc_reffer'), 'user');
                             }
                         }
                     }
                     $this->theme(mc_option('theme'))->display('Home/index');
                 }
             } else {
                 $this->error('参数错误!');
             }
         }
     } else {
         $site_url = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER['PHP_SELF'];
         $site_url = preg_replace("/\\/[a-z0-9]+\\.php.*/is", "", $site_url);
         $url = $site_url . '/install.php';
         Header("Location:{$url}");
     }
 }
开发者ID:xiaowei521,项目名称:vamshop,代码行数:57,代码来源:IndexController.class.php

示例7: single

 public function single($id = 1)
 {
     if (is_numeric($id)) {
         mc_set_views($id);
         $this->page = M('page')->field('id,title,content,type,date')->where("id='{$id}'")->select();
         $this->theme(mc_option('theme'))->display('Pro/single');
     } else {
         $this->error('参数错误');
     }
 }
开发者ID:xiaowei521,项目名称:vamshop,代码行数:10,代码来源:IndexController.class.php

示例8: index

 public function index()
 {
     $Model = M();
     $db_prefix = C('DB_PREFIX');
     $table[] = "CREATE TABLE IF NOT EXISTS " . $db_prefix . "page (\r\n\t        \tid bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,\r\n\t        \tPRIMARY KEY(id),\r\n\t        \ttitle text,\r\n\t        \tcontent longtext,\r\n\t        \ttype varchar(20),\r\n\t        \tdate int\r\n\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8";
     $table[] = "CREATE TABLE IF NOT EXISTS " . $db_prefix . "meta (\r\n\t        \tid bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,\r\n\t        \tPRIMARY KEY(id),\r\n\t        \tpage_id bigint(20) UNSIGNED,\r\n\t        \tmeta_key varchar(20),\r\n\t        \tmeta_value varchar(255),\r\n\t        \ttype varchar(20)\r\n\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8";
     $table[] = "CREATE TABLE IF NOT EXISTS " . $db_prefix . "action (\r\n\t        \tid bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,\r\n\t        \tPRIMARY KEY(id),\r\n\t        \tpage_id bigint(20) UNSIGNED,\r\n\t        \tuser_id bigint(20) UNSIGNED,\r\n\t        \taction_key varchar(20),\r\n\t        \taction_value varchar(255),\r\n\t        \tdate int\r\n\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8";
     $table[] = "CREATE TABLE IF NOT EXISTS " . $db_prefix . "option (\r\n\t        \tid bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,\r\n\t        \tPRIMARY KEY(id),\r\n\t        \tmeta_key varchar(20),\r\n\t        \tmeta_value varchar(255),\r\n\t        \ttype varchar(20)\r\n\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8";
     $table[] = "CREATE TABLE IF NOT EXISTS " . $db_prefix . "attached (\r\n\t        \tid bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,\r\n\t        \tPRIMARY KEY(id),\r\n\t        \tsrc varchar(255),\r\n\t        \ttype varchar(20)\r\n\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8";
     foreach ($table as $query) {
         $Model->query($query);
     }
     $site_url = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER['PHP_SELF'];
     $site_url = preg_replace("/\\/[a-z0-9]+\\.php.*/is", "", $site_url);
     $Data = M('option');
     $site['meta_key'] = 'site_url';
     $site['meta_value'] = $site_url;
     $site['type'] = 'public';
     $result = $Data->data($site)->add();
     $site1['meta_key'] = 'site_name';
     $site1['meta_value'] = 'Mao10CMS';
     $site1['type'] = 'public';
     $result1 = $Data->data($site1)->add();
     $site2['meta_key'] = 'site_key';
     $site2['meta_value'] = rand(1000000000, 9999999999);
     $site2['type'] = 'public';
     $result2 = $Data->data($site2)->add();
     $site3['meta_key'] = 'theme';
     $site3['meta_value'] = 'default';
     $site3['type'] = 'public';
     $result3 = $Data->data($site3)->add();
     $site4['meta_key'] = 'page_size';
     $site4['meta_value'] = '10';
     $site4['type'] = 'public';
     $result4 = $Data->data($site4)->add();
     $user['title'] = C('ADMIN_LOGIN');
     $user['content'] = '';
     $user['type'] = 'user';
     $user['date'] = strtotime("now");
     $result5 = M("page")->data($user)->add();
     if ($result && $result1 && $result2 && $result3 && $result4 && $result5) {
         mc_add_meta($result5, 'user_name', C('ADMIN_LOGIN'), 'user');
         $user_pass = md5(C('ADMIN_PASS') . mc_option('site_key'));
         mc_add_meta($result5, 'user_pass', $user_pass, 'user');
         mc_add_meta($result5, 'user_email', '', 'user');
         mc_add_meta($result5, 'user_level', '10', 'user');
         session('user_name', C('ADMIN_LOGIN'));
         session('user_pass', $user_pass);
         unlink('InstallController.class.php');
         $this->success('数据库建立成功!', U('home/index/index'));
     } else {
         $this->error('写入数据库失败');
     }
 }
开发者ID:dalinhuang,项目名称:shouzhangmall,代码行数:54,代码来源:InstallController.class.php

示例9: checkout

 public function checkout($id, $price)
 {
     if (mc_user_id()) {
         if (is_numeric($price)) {
             $this->theme(mc_option('theme'))->display('Post/checkout');
         } else {
             $this->error('价格必须为数字!');
         }
     } else {
         $this->success('请先登陆!', U('User/login/index'));
     }
 }
开发者ID:xiaowei521,项目名称:vamshop,代码行数:12,代码来源:IndexController.class.php

示例10: index

 public function index($id)
 {
     if (is_numeric($id)) {
         if ($_GET['comment'] == 'all') {
             $this->comment = M('action')->where("page_id='{$id}' AND action_key='comment'")->order('id desc')->select();
         } else {
             $this->comment = M('action')->where("page_id='{$id}' AND action_key='comment'")->order('id desc')->page(1, 10)->select();
         }
         $this->assign('page_id', $id);
         $this->theme(mc_option('theme'))->display("Public:comment");
     }
 }
开发者ID:xiaowei521,项目名称:vamshop,代码行数:12,代码来源:CommentWidget.class.php

示例11: single

 public function single($id = 1)
 {
     if (is_numeric($id)) {
         mc_set_views($id);
         if (mc_option('paixu') != 2) {
             mc_update_page($id, strtotime("now"), 'date');
         }
         $this->page = M('page')->field('id,title,content,type,date')->where("id='{$id}'")->select();
         $this->theme(mc_option('theme'))->display('Post/index');
     } else {
         $this->error('参数错误!');
     }
 }
开发者ID:dalinhuang,项目名称:shouzhangmall,代码行数:13,代码来源:IndexController.class.php

示例12: submit

 public function submit()
 {
     if ($_POST['user_email'] && $_POST['user_pass']) {
         $page_id = M('meta')->where("meta_key='user_email' AND meta_value='" . mc_magic_in($_POST['user_email']) . "' AND type='user'")->getField('page_id');
         $pass = md5($_POST['user_pass'] . mc_option('site_key'));
         mc_update_meta($page_id, 'user_pass_lost', $pass, 'user');
         $link = mc_option('site_url') . '?m=user&c=lostpass&a=clink&id=' . $page_id . '&pass=' . $pass;
         $body = '请访问 ' . $link . ' 重置您的密码!';
         mc_mail($user_email, '重置密码', $body);
         $this->success('请登陆您的邮箱重置密码', U('user/login/index'), 10);
     } else {
         $this->error('必须填写完整的信息!');
     }
 }
开发者ID:xiaowei521,项目名称:vamshop,代码行数:14,代码来源:LostpassController.class.php

示例13: single

 public function single($id, $page = 1)
 {
     if (is_numeric($id) && is_numeric($page)) {
         $condition['type'] = 'publish';
         $args_id = M('meta')->where("meta_key='group' AND meta_value='{$id}'")->getField('page_id', true);
         $condition['id'] = array('in', $args_id);
         $this->page = M('page')->where($condition)->order('date desc')->page($page, mc_option('page_size'))->select();
         $count = M('page')->where($condition)->count();
         $this->assign('id', $id);
         $this->assign('count', $count);
         $this->assign('page_now', $page);
         $this->theme(mc_option('theme'))->display('Post/group');
     } else {
         $this->error('参数错误!');
     }
 }
开发者ID:dalinhuang,项目名称:shouzhangmall,代码行数:16,代码来源:GroupController.class.php

示例14: tag

 public function tag($tag, $page = 1)
 {
     if (is_numeric($page)) {
         $condition['type'] = 'article';
         $date = strtotime("now");
         $args_id = M('meta')->where("meta_key='tag' AND meta_value='{$tag}' AND type='basic'")->getField('page_id', true);
         $condition['id'] = array('in', $args_id);
         $this->page = M('page')->where($condition)->order('date desc')->page($page, mc_option('page_size'))->select();
         $count = M('page')->where($condition)->count();
         $this->assign('id', $id);
         $this->assign('count', $count);
         $this->assign('page_now', $page);
         $this->theme(mc_option('theme'))->display('article/term');
     } else {
         $this->error('参数错误!');
     }
 }
开发者ID:dalinhuang,项目名称:shouzhangmall,代码行数:17,代码来源:IndexController.class.php

示例15: index

 public function index($id, $page = 1)
 {
     if (is_numeric($id)) {
         if (mc_user_id() == $id) {
             $args_id = M('meta')->where("meta_key='ref' AND meta_value='{$id}'")->getField('page_id', true);
             $condition['id'] = array('in', $args_id);
             $this->page = M('page')->where($condition)->order('id desc')->page($page, mc_option('page_size'))->select();
             $count = M('page')->where($condition)->count();
             $this->assign('id', $id);
             $this->assign('count', $count);
             $this->assign('page_now', $page);
             $this->theme(mc_option('theme'))->display('User/reffer');
         } else {
             $this->error('您无权查看其他人的推荐记录!');
         }
     } else {
         $this->error('参数错误!');
     }
 }
开发者ID:dalinhuang,项目名称:shouzhangmall,代码行数:19,代码来源:RefferController.class.php


注:本文中的mc_option函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。