本文整理汇总了PHP中mc_fields函数的典型用法代码示例。如果您正苦于以下问题:PHP mc_fields函数的具体用法?PHP mc_fields怎么用?PHP mc_fields使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mc_fields函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mc_update
function mc_update($uid, $fields)
{
global $_W;
if (empty($fields)) {
return false;
}
$uid_temp = $uid;
$uid = mc_openid2uid($uid);
$_W['weid'] && ($fields['weid'] = $_W['weid']);
$struct = array_keys(mc_fields());
$struct[] = 'birthyear';
$struct[] = 'birthmonth';
$struct[] = 'birthday';
$struct[] = 'resideprovince';
$struct[] = 'residecity';
$struct[] = 'residedist';
$struct[] = 'groupid';
if (isset($fields['birth'])) {
$fields['birthyear'] = $fields['birth']['year'];
$fields['birthmonth'] = $fields['birth']['month'];
$fields['birthday'] = $fields['birth']['day'];
}
if (isset($fields['reside'])) {
$fields['resideprovince'] = $fields['reside']['province'];
$fields['residecity'] = $fields['reside']['city'];
$fields['residedist'] = $fields['reside']['district'];
}
unset($fields['reside'], $fields['birth']);
foreach ($fields as $field => $value) {
if (!in_array($field, $struct)) {
unset($fields[$field]);
}
}
if (!empty($fields['avatar'])) {
if (strexists($fields['avatar'], 'attachment/images/global/avatars/avatar_')) {
$fields['avatar'] = str_replace($_W['attachurl'], '', $fields['avatar']);
}
}
$isexists = pdo_fetchcolumn("SELECT uid FROM " . tablename('mc_members') . " WHERE uid = :uid", array(':uid' => $uid));
$condition = '';
if (!empty($isexists)) {
$condition = ' AND uid != ' . $uid;
}
if (!empty($fields['email'])) {
$emailexists = pdo_fetchcolumn("SELECT email FROM " . tablename('mc_members') . " WHERE uniacid = :uniacid AND email = :email " . $condition, array(':uniacid' => $_W['uniacid'], ':email' => trim($fields['email'])));
if ($emailexists) {
unset($fields['email']);
}
}
if (!empty($fields['mobile'])) {
$mobilexists = pdo_fetchcolumn("SELECT mobile FROM " . tablename('mc_members') . " WHERE uniacid = :uniacid AND mobile = :mobile " . $condition, array(':uniacid' => $_W['uniacid'], ':mobile' => trim($fields['mobile'])));
if ($mobilexists) {
unset($fields['mobile']);
}
}
if (empty($isexists)) {
if (empty($fields['mobile']) && empty($fields['email'])) {
return false;
}
$fields['uniacid'] = $_W['uniacid'];
$fields['createtime'] = TIMESTAMP;
pdo_insert('mc_members', $fields);
$insert_id = pdo_insertid();
if (is_string($uid_temp)) {
pdo_update('mc_mapping_fans', array('uid' => $insert_id), array('uniacid' => $_W['uniacid'], 'openid' => trim($uid_temp)));
}
return $insert_id;
} else {
$result = pdo_update('mc_members', $fields, array('uid' => $uid));
return $result > 0;
}
}
示例2: fans_fields
function fans_fields()
{
load()->model('mc');
return mc_fields();
}
示例3: unset
$_GPC['birthyear'] = $_GPC['birth']['year'];
$_GPC['birthmonth'] = $_GPC['birth']['month'];
$_GPC['birthday'] = $_GPC['birth']['day'];
}
if (!empty($_GPC['reside'])) {
$_GPC['resideprovince'] = $_GPC['reside']['province'];
$_GPC['residecity'] = $_GPC['reside']['city'];
$_GPC['residedist'] = $_GPC['reside']['district'];
}
unset($_GPC['uid']);
if (!empty($_GPC['fanid'])) {
if (empty($_GPC['email']) && empty($_GPC['mobile'])) {
$_GPC['email'] = md5($_GPC['openid']) . '@012wz.com';
}
$fanid = intval($_GPC['fanid']);
$struct = array_keys(mc_fields());
$struct[] = 'birthyear';
$struct[] = 'birthmonth';
$struct[] = 'birthday';
$struct[] = 'resideprovince';
$struct[] = 'residecity';
$struct[] = 'residedist';
$struct[] = 'groupid';
unset($_GPC['reside'], $_GPC['birth']);
foreach ($_GPC as $field => $value) {
if (!in_array($field, $struct)) {
unset($_GPC[$field]);
}
}
if (!empty($_GPC['avatar'])) {
if (strexists($_GPC['avatar'], 'attachment/images/global/avatars/avatar_')) {
示例4: tablename
if ($do == 'display') {
if ($_W['ispost'] && $_W['isajax']) {
$sql = 'SELECT `uniacid` FROM ' . tablename('mc_card') . " WHERE `uniacid` = :uniacid";
$status = pdo_fetch($sql, array(':uniacid' => $_W['uniacid']));
if (empty($status)) {
$open = array('uniacid' => $_W['uniacid']);
pdo_insert('mc_card', $open);
}
$data['status'] = intval($_GPC['status']);
if (false === pdo_update('mc_card', $data, array('uniacid' => $_W['uniacid']))) {
exit('error');
}
exit('success');
}
$groups = $_W['account']['groups'];
$fields = mc_fields();
if (!empty($setting)) {
if (!empty($setting['color'])) {
$setting['color'] = iunserializer($setting['color']);
} else {
$setting['color'] = array();
}
$setting['background'] = (array) iunserializer($setting['background']);
$setting['fields'] = iunserializer($setting['fields']);
if (!empty($setting['fields'])) {
foreach ($setting['fields'] as $field) {
$re_fields[] = $field['bind'];
}
}
if (empty($setting['logo'])) {
$setting['logo'] = 'images/global/card/logo.png';
示例5: mc_require
function mc_require($uid, $fields, $pre = '')
{
global $_W, $_GPC;
if (empty($fields) || !is_array($fields)) {
return false;
}
$flipfields = array_flip($fields);
if (in_array('birth', $fields) || in_array('birthyear', $fields) || in_array('birthmonth', $fields) || in_array('birthday', $fields)) {
unset($flipfields['birthyear'], $flipfields['birthmonth'], $flipfields['birthday'], $flipfields['birth']);
$flipfields['birthyear'] = 'birthyear';
$flipfields['birthmonth'] = 'birthmonth';
$flipfields['birthday'] = 'birthday';
}
if (in_array('reside', $fields) || in_array('resideprovince', $fields) || in_array('residecity', $fields) || in_array('residedist', $fields)) {
unset($flipfields['residedist'], $flipfields['resideprovince'], $flipfields['residecity'], $flipfields['reside']);
$flipfields['resideprovince'] = 'resideprovince';
$flipfields['residecity'] = 'residecity';
$flipfields['residedist'] = 'residedist';
}
$fields = array_keys($flipfields);
if (!in_array('uniacid', $fields)) {
$fields[] = 'uniacid';
}
if (!empty($pre)) {
$pre .= '<br/>';
}
$profile = mc_fetch($uid, $fields);
$uniacid = $profile['uniacid'];
$titles = mc_fields();
$message = '';
$ks = array();
foreach ($profile as $k => $v) {
if (empty($v)) {
$ks[] = $k;
$message .= $titles[$k] . ', ';
}
}
if (!empty($message)) {
$title = '完善资料';
if (checksubmit('submit')) {
if (in_array('resideprovince', $fields)) {
$_GPC['resideprovince'] = $_GPC['reside']['province'];
$_GPC['residecity'] = $_GPC['reside']['city'];
$_GPC['residedist'] = $_GPC['reside']['district'];
}
if (in_array('birthyear', $fields)) {
$_GPC['birthyear'] = $_GPC['birth']['year'];
$_GPC['birthmonth'] = $_GPC['birth']['month'];
$_GPC['birthday'] = $_GPC['birth']['day'];
}
$record = array_elements($fields, $_GPC);
if (isset($record['uniacid'])) {
unset($record['uniacid']);
}
foreach ($record as $field => $value) {
if ($field == 'gender') {
continue;
}
if (empty($value)) {
message('请填写完整所有资料.', referer(), 'error');
}
}
$condition = " AND uid != {$uid} ";
if (in_array('email', $fields)) {
$emailexists = pdo_fetchcolumn("SELECT email FROM " . tablename('mc_members') . " WHERE uniacid = :uniacid AND email = :email " . $condition, array(':uniacid' => $_W['uniacid'], ':email' => trim($record['email'])));
if (!empty($emailexists)) {
message('抱歉,您填写的手机号已经被使用,请更新。', 'refresh', 'error');
}
}
if (in_array('mobile', $fields)) {
$mobilexists = pdo_fetchcolumn("SELECT mobile FROM " . tablename('mc_members') . " WHERE uniacid = :uniacid AND mobile = :mobile " . $condition, array(':uniacid' => $_W['uniacid'], ':mobile' => trim($record['mobile'])));
if (!empty($mobilexists)) {
message('抱歉,您填写的手机号已经被使用,请更新。', 'refresh', 'error');
}
}
mc_update($uid, $record);
message('资料完善成功.', 'refresh');
}
load()->func('tpl');
load()->model('activity');
$filter = array();
$filter['status'] = 1;
$coupons = activity_coupon_owned($_W['member']['uid'], $filter);
$tokens = activity_token_owned($_W['member']['uid'], $filter);
$setting = uni_setting($_W['uniacid'], array('creditnames', 'creditbehaviors', 'uc'));
$behavior = $setting['creditbehaviors'];
$creditnames = $setting['creditnames'];
$credits = mc_credit_fetch($_W['member']['uid'], '*');
include template('mc/require', TEMPLATE_INCLUDEPATH);
exit;
}
return $profile;
}
示例6: fans_fields
function fans_fields()
{
return mc_fields();
}