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


PHP Config::IP方法代码示例

本文整理汇总了PHP中core\Config::IP方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::IP方法的具体用法?PHP Config::IP怎么用?PHP Config::IP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core\Config的用法示例。


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

示例1: acceptCredentials

 public function acceptCredentials($key, $token)
 {
     $q = $this->db->prepare('SELECT id from credentials WHERE api_key = :key AND api_token = :token');
     $q->execute(array('key' => $key, 'token' => $token));
     $data = $q->fetch();
     $q->closeCursor();
     if ($data !== false) {
         $q = $this->db->prepare('UPDATE credentials SET last_timestamp = :now, last_ip = :ip, count = count + 1 WHERE id = :id');
         $q->execute(array('id' => $data['id'], 'now' => time(), 'ip' => Config::IP()));
         $q->closeCursor();
     }
     return (bool) $data;
 }
开发者ID:Devenet,项目名称:MoodPicker,代码行数:13,代码来源:apidatabase.php

示例2: registerLogin

 public function registerLogin()
 {
     if ($this->exists()) {
         $q = $this->db->prepare('UPDATE users SET last_login = :last_login, last_ip = :last_ip WHERE id = :id');
         $row_updated = $q->execute(array('last_login' => time(), 'last_ip' => Config::IP(), 'id' => $this->id));
         $q->closeCursor();
         return $row_updated == 1;
     }
 }
开发者ID:Devenet,项目名称:MoodPicker,代码行数:9,代码来源:user.php

示例3: Mood

distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Code source hosted on https://github.com/Devenet/MoodPicker
*/
use Utils\Cookie;
use Utils\Session;
use Picker\Mood;
use Picker\MoodLevel;
use Core\Config;
if (isset($_POST['mood']) && $this->acceptToken()) {
    $_POST['mood'] = $_POST['mood'] + 0;
    if (!MoodLevel::isValidValue($_POST['mood'])) {
        $this->errorPage('Invalid value', 'The given value for your current mood is unknow.');
    }
    if (!Cookie::Exists('voted') && !Session::Exists('voted')) {
        $m = new Mood($_POST['mood'], time(), Config::IP());
        $m->save();
        Cookie::add('voted', true, Cookie::HOUR * 2);
        Session::add('voted', true);
        header('Location: ./review');
        exit;
    }
    $this->errorPage('Already voted', 'An entry has already been enregistred from your computer. <br />You have to wait some times before submitting an other mood.');
} else {
    $this->getToken();
    $this->assign('good', MoodLevel::GOOD);
    $this->assign('bad', MoodLevel::BAD);
}
开发者ID:Devenet,项目名称:MoodPicker,代码行数:31,代码来源:index.php

示例4: submit

 public function submit($data)
 {
     if (empty($data)) {
         $this->error(400);
     }
     try {
         $data = json_decode($data, true);
         $this->checkToken($data);
         if (!isset($data[self::P_MOOD]) || empty($data[self::P_MOOD])) {
             $this->error(422, self::E_EMPTY_MOOD);
         }
         if (!MoodLevel::isValidValue($data[self::P_MOOD] + 0)) {
             $this->error(422, self::E_FORMAT_MOOD);
         }
         $m = new Mood($data[self::P_MOOD], time(), Config::IP());
         $m->save();
         $this->data['mood'] = $m->getMood();
         $this->data['timestamp'] = $m->getTime();
         $this->send();
     } catch (\Exception $ex) {
         $this->error(400);
     }
 }
开发者ID:Devenet,项目名称:MoodPicker,代码行数:23,代码来源:api.php


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