Example #1
0
 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);
 }
Example #2
0
 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>';
 }