function get_state_html_by_id($id) { $mid = intval(app_config('mid')); $html = NULL; $votes = array(); $state = app_config('model_state'); $keys = array(); if ($state) { $app = explode('|', $state); $i = 0; foreach ($app as $v) { $v = trim($v); if ($v) { $keys[] = " `text` = '{$v}' "; } } } if ($keys) { $first = trim($app[0]); $data = lazy_get_data("select `text` , count(*) as c from `u2_vote` where(" . join('or', $keys) . ") and `tid` = '{$id}' and `mid` = '{$mid}' group by `text` "); if ($data) { $html .= '<h5 class="w2">谁' . $first . '这' . app_config('model_name') . '</h5><br/>'; foreach ($data as $v) { if ($v['text'] == $first) { $uids = lazy_get_vars("select `uid` from `u2_vote` where `text` = '{$first}' and `tid` = '{$id}' and `mid` = '{$mid}' limit 3 "); $names = get_name_by_uids($uids); foreach ($uids as $v) { $html .= '<div class="app_user_div"><center><a href="/user/space/' . $v . '" target="_blank"><img src="' . show_user_icon('normal', $v) . '" class="icon" /><br/>' . $names[$v]['u2_nickname'] . '</a></center></div>'; } $html .= '<br clear="all"/>'; if ($v['c'] > 3) { $html .= '<a href="/app/native/' . $GLOBALS['app'] . '/votepeople/' . $id . '/' . urlencode($first) . '"> > 还有' . ($v['c'] - 3) . '人' . $first . '</a><br/>'; } } else { $html .= '<a href="/app/native/' . $GLOBALS['app'] . '/votepeople/' . $id . '/' . urlencode($v['text']) . '"> > ' . $v['c'] . '人' . $v['text'] . '</a><br/>'; } } } } return $html; }
$CI =& get_instance(); $CI->load->model('Invite_model', 'invite', TRUE); $CI->invite->buy($limit); $invites = lazy_get_data("select id , u2_invite_code from u2_invite where u2_uid = '" . format_uid() . "' and u2_is_use = '0' and u2_is_copied = '0' "); } else { die('你还差' . $limit . '个邀请码来进行此操作,请购买邀请码后操作'); } } $title = _sess('u2_nickname') . '(' . _sess('u2_email') . ')邀请您加入 - ' . c('site_name'); $i = 0; foreach ($emails as $v) { $icode = $invites[$i]['u2_invite_code']; $copyid[] = $invites[$i]['id']; $message = '<TABLE> <TR> <TD valign="top" style="padding:10px;"><img src="http://' . $_SERVER['HTTP_HOST'] . show_user_icon('big') . '" style="border:1px solid #c8c8c8;padding:1px;"></TD> <TD valign="top" style="padding:10px;"> <p><strong>亲爱的朋友,我是' . _sess('u2_nickname') . '~</strong></p> 最近我加入了 ' . c('site_name') . ' ,每天在这里种仙豆养宠物,感觉还不错哦.你也来和我一起玩,顺便帮我挣点银币吧,呵呵.<br/> <br/>点下边的链接就可以了,我会仔细的给你做向导的哦~<br/><br/> <a href="http://' . $_SERVER['HTTP_HOST'] . '/gate/index/' . $icode . '">http://' . $_SERVER['HTTP_HOST'] . '/gate/index/' . $icode . '</a> <p>如果点击无效,你可以复制上边的链接,粘贴到地址栏,再按回车就行了</p><br/> <p>邀请函我好不容易才弄到的呢,如果你没兴趣的话,就转发给你的朋友吧~</p> </TD> </TR> </TABLE>'; /* $message = '<TABLE><TR><TD valign="top"><img src="http://'.$_SERVER['HTTP_HOST'].show_user_icon('big').'" style="border:1px solid #c8c8c8;padding:1px;"></TD><TD valign="top" style="padding:10px;"><b>你好我是'._sess('u2_nickname').'我在'.c('site_name').'上建立了个人主页,请你也加入并成为我的好友。</b><br/><br/>请点击以下链接,接受好友邀请:<br/><a href="http://'.$_SERVER['HTTP_HOST'].'/gate/index/'.$icode.'">http://'.$_SERVER['HTTP_HOST'].'/gate/index/'.$icode.'</a></TD></TR></TABLE>';*/
function uploadpic($action = NULL) { $this->login_check(); $data = NULL; if ($action == 'save') { if (isset($_FILES['picfile']['size']) && $_FILES['picfile']['size'] > 0) { make_user_icon_dir(); $this->load->library('icon'); $this->icon->path = $_FILES['picfile']['tmp_name']; $this->icon->size = 16; $this->icon->dest = get_user_icon_path('small'); $this->icon->createIcon(); $this->icon->size = 48; $this->icon->dest = get_user_icon_path(); $this->icon->createIcon(); $this->icon->size = 100; $this->icon->dest = get_user_icon_path('big'); $this->icon->createIcon(); $time = time(); $source_image = ROOT . 'static/data/hash/user_icon/' . myhash() . $time . '.gif'; copy(get_user_icon_path('small'), ROOT . 'static/data/hash/user_icon/' . myhash() . $time . '_small.gif'); copy(get_user_icon_path(), ROOT . 'static/data/hash/user_icon/' . myhash() . $time . '_normal.gif'); copy(get_user_icon_path('big'), ROOT . 'static/data/hash/user_icon/' . myhash() . $time . '_big.gif'); move_uploaded_file($_FILES['picfile']['tmp_name'], $source_image); $this->user->add_user_upload_pic($time); $title = '<a href="/user/space/' . format_uid() . '">' . _sess('u2_nickname') . '</a>更换了新头像'; send_to_feed(format_uid(), 'system_user', $title, NULL, show_user_icon()); info_page('<a href="/user/space">' . _text('user_uploadpic_success') . '</a>'); return; } info_page(_text('user_error_uploadpic')); return; } $data['pics'] = $this->user->load_user_photos_by_uid(); $this->view('uploadpic', $data); }
function register() { $nickname = z(v('nickname')); $email = z(v('email')); $psw1 = z(v('psw1')); $psw2 = z(v('psw2')); $icode = z(v('icode')); if (!$nickname || !$email || !$psw1) { die('<center style="font-size:12px;">用户名,E-mail,密码不能为空</center>'); } if ($psw1 != $psw2) { die('<center style="font-size:12px;">2次密码输入不一致</center>'); } $psw = $psw1; $this->load->model('User_model', 'user', TRUE); $invite = $this->user->check_invite_code($icode); if (!$invite) { die('<center style="font-size:12px;">邀请函防伪码已经使用过了</center>'); } if (!$this->user->register_save($email, $nickname, $psw)) { die('<center style="font-size:12px;">用户名或者email已被占用</center>'); } $this->user->marked_invite_code($invite['id']); $user_info = $this->user->get_user_by_email($email); $title = '<a href="/user/space/' . $user_info['id'] . '">' . $user_info['u2_nickname'] . '</a>加入了' . c('site_name'); send_to_feed($user_info['id'], 'system_user', $title); $invuid = $invite['u2_uid']; if ($invuid && ($olduser = $this->user->load_user_information_by_uid($invuid))) { $this->user->add_friend($invuid, $user_info['id']); $title = '<a href="/user/space/' . $user_info['id'] . '">' . $user_info['u2_nickname'] . '</a>和<a href="/user/space/' . $olduser['id'] . '">' . $olduser['u2_nickname'] . '</a>成为好友了'; send_to_feed($user_info['id'], 'system_user', $title); } $new_one = array(); $new_one['u2_first_time'] = 1; $new_one['u2_inviter_uid'] = $olduser['id']; $new_one['u2_inviter_nickname'] = $olduser['u2_nickname']; $this->user->login_confirm($email, $psw, $new_one); if (isset($_FILES['picfile']['size']) && $_FILES['picfile']['size'] > 0) { make_user_icon_dir(); $this->load->library('icon'); $this->icon->path = $_FILES['picfile']['tmp_name']; $this->icon->size = 16; $this->icon->dest = get_user_icon_path('small'); $this->icon->createIcon(); $this->icon->size = 48; $this->icon->dest = get_user_icon_path(); $this->icon->createIcon(); $this->icon->size = 100; $this->icon->dest = get_user_icon_path('big'); $this->icon->createIcon(); $time = time(); $source_image = ROOT . 'static/data/hash/user_icon/' . myhash() . $time . '.gif'; copy(get_user_icon_path('small'), ROOT . 'static/data/hash/user_icon/' . myhash() . $time . '_small.gif'); copy(get_user_icon_path(), ROOT . 'static/data/hash/user_icon/' . myhash() . $time . '_normal.gif'); copy(get_user_icon_path('big'), ROOT . 'static/data/hash/user_icon/' . myhash() . $time . '_big.gif'); move_uploaded_file($_FILES['picfile']['tmp_name'], $source_image); $this->user->add_user_upload_pic($time); $title = '<a href="/user/space/' . format_uid() . '">' . _sess('u2_nickname') . '</a>更换了新头像'; send_to_feed(format_uid(), 'system_user', $title, NULL, show_user_icon()); } $uid = $user_info['id']; $place = $uid + 10000; // add the inviter's info //set_cookie( 'x123' , 'er' ); // add money to user bank account // add money $sql = "INSERT INTO `app_ibank_account` ( `uid` , `g_count` , `gold_count` ) VALUES ( '" . $uid . "' , '" . intval(c('user_init_silver')) . "' , '" . intval(c('user_init_gold')) . "' ) "; lazy_run_sql($sql); // add cloth $sql = "INSERT INTO `app_ihome_shop` ( `uid` , `item_id` ) VALUES ( '" . $uid . "' , '844' ) , ( '" . $uid . "' , '879' )"; lazy_run_sql($sql); // add money to inviter $sql = "UPDATE `app_ibank_account` SET `g_count` = `g_count` + " . intval(c('user_invite_g')) . " WHERE `uid` = '" . intval($olduser['id']) . "' LIMIT 1 "; lazy_run_sql($sql); // header("Content-type: text/xml; charset=$charset"); header("Content-type: text/html;charset=utf-8"); echo '<SCRIPT LANGUAGE="JavaScript">window.parent.$("id_icon").setHTML(\'<img src="' . show_user_icon('', $user_info['id']) . '" class="icon"/><br/>' . $nickname . '\');window.parent.$("id_info").setHTML(\'NO. ' . $uid . '<br/>仙豆王国居民东区' . $place . '#\');</SCRIPT>'; echo '<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body><center style="font-size:12px;"><a href="/user/miniblog/" target="_parent">申请成功,赶快到你的小屋去看看吧</a></center></body></html>'; }