bax 发表于 2013-2-11 09:44:11

貝殼 发表于 2013-2-10 21:31 static/image/common/back.gif
嗨,我们的开发理念就是简单易用,教程的部分可能需要依赖其他朋友。

以下提供一些资源供参考,包含了官 ...

這個下載了,但是得到的似乎是json,對json有興趣,但是不怎麽會用...能不能給個註冊會員的控制器跟視圖參考?

貝殼 发表于 2013-2-11 16:33:29

bax 发表于 2013-2-11 09:44 static/image/common/back.gif
這個下載了,但是得到的似乎是json,對json有興趣,但是不怎麽會用...能不能給個註冊會員的控制器跟視圖 ...
JSON是非常简单的,底下按照要求提供会员注册的控制器丶视图以及SDK类库。

https://github.com/a20968/UDSync_CI_SDK/blob/master/application/libraries/Udsync.php


               protected $APP_ID = '' ; //Here's your APP_ID
        protected $APP_KEY = '' ; //Your APP_KEY
        protected $UDSync_Server = 'http://yourserver/index.php/api/' ; //HTTP Link to your UDSync application(Add /index.php/api)

        protected static function curl_get_content( $url )
        {
                $ch = curl_init();   
                curl_setopt($ch, CURLOPT_URL, $url); //Set access url adress
                curl_setopt($ch, CURLOPT_TIMEOUT, 5); //Set timeout
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Ser return value
                $r = curl_exec($ch); //Set $r
                curl_close($ch); //Close curl function
                return $r; //Return data
        }
      public function user_create ( $id , $email , $password )
      {
                $json = json_decode(self::curl_get_content( $this->UDSync_Server .'user/user_create/'.$id.'/'.urlencode($email).'/'.$password.'/'.$this->APP_ID.'/'.$this->APP_KEY ));
                if ( $json->status == 0 )
                {
                        return 1;
                } else {
                        return 0;
                }
      }



https://github.com/a20968/UDSync ... xample/register.php

      function post_register()
      {
                $this->load->library('form_validation');
                $this->form_validation->set_rules('username', 'Username', 'required');
                $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
                  $this->form_validation->set_rules('password', 'Password', 'required');
                  if ($this->form_validation->run() == FALSE)
                  {
                        $this->load->helper('form');
                        $this->load->view('register_form');
                  } else {
                        if ( $this->udsync->user_create( $this->input->post('username',TRUE) , $this->input->post('email',TRUE) , $this->input->post('password',TRUE) , md5($this->input->ip_address()) , md5($this->input->user_agent())) == 1 )
                        {
                                  echo 'Register Success! <a href="/index.php/example/login">Get to Login</a>.';
                        } else {
                                  echo 'Register Faild! <a href="/index.php/example/register">Try again?</a>';
                        }
                  }
      }

https://github.com/a20968/UDSync ... s/register_form.php

<html>
<?php echo form_open('/example/register/post_register'); ?>
<?php echo validation_errors(); ?>
<h5>Username</h5>
<input type="text" name="username" value="" size="50" />
<h5>Email</h5>
<input type="email" name="email" value="" size="50" />
<h5>Password</h5>
<input type="password" name="password" value="" size="50" />
<div><input type="submit" value="Submit" /></div>
</form>
</html>

大概就是这样,JSON数据的部分可以参考这里。

https://github.com/a20968/UDSync ... A%E5%90%AB%E6%84%8F

emric 发表于 2013-2-11 17:05:34

卡饭?

bax 发表于 2013-2-18 10:07:51

貝殼 发表于 2013-2-11 16:33 static/image/common/back.gif
JSON是非常简单的,底下按照要求提供会员注册的控制器丶视图以及SDK类库。

https://github.com/a20968/UD ...

我要參考的就是這個,謝謝你...

jeongee 发表于 2013-2-18 10:37:41

给个建议啊,http://udsync.my.phpcloud.com/ 这里的几句英语重写一下吧。嘿嘿

貝殼 发表于 2013-2-18 18:37:48

jeongee 发表于 2013-2-18 10:37 static/image/common/back.gif
给个建议啊,http://udsync.my.phpcloud.com/ 这里的几句英语重写一下吧。嘿嘿

嗨,往後版本会体现出来的。

Rzoro 发表于 2013-3-3 18:29:24

路过看看

kylinlee 发表于 2013-6-16 21:01:10

强烈支持

kinwyb 发表于 2013-7-10 15:55:48

有人使用过么?效果咋样

新年 发表于 2013-7-22 21:11:45

感觉始终没说清楚是干什么的,虽然自己很清楚,但是没有讲清楚,那个wiki里面写的也非常笼统
页: 1 2 3 [4] 5 6
查看完整版本: 基于CodeIgniter,优秀的开源用户项目 -- UDSync