本文整理汇总了PHP中zmf::delFCache方法的典型用法代码示例。如果您正苦于以下问题:PHP zmf::delFCache方法的具体用法?PHP zmf::delFCache怎么用?PHP zmf::delFCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zmf
的用法示例。
在下文中一共展示了zmf::delFCache方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionLogin
public function actionLogin()
{
$this->onlyOnPc();
$this->layout = 'common';
if (!Yii::app()->user->isGuest) {
$this->message(0, '您已登录,请勿重复操作');
}
$canLogin = true;
$ip = Yii::app()->request->getUserHostAddress();
$cacheKey = 'loginErrors-' . $ip;
$errorTimes = zmf::getFCache($cacheKey);
if ($errorTimes >= 5) {
$canLogin = false;
}
if ($canLogin) {
$model = new FrontLogin();
if (isset($_POST['FrontLogin'])) {
$model->attributes = $_POST['FrontLogin'];
if ($model->validate() && $model->login()) {
$arr = array('latestLoginTime' => zmf::now());
$uid = Yii::app()->user->id;
// User::model()->updateByPk($uid, $arr);
zmf::delCookie('checkWithCaptcha');
zmf::delFCache($cacheKey);
if ($this->referer) {
$this->redirect($this->referer);
} else {
$this->redirect(zmf::config('baseurl'));
}
} else {
zmf::updateFCacheCounter($cacheKey, 1, 3600);
zmf::setCookie('checkWithCaptcha', 1, 86400);
}
}
}
$this->pageTitle = '登录';
$this->render('login', array('model' => $model));
}
示例2: actionUpdate
public function actionUpdate($type)
{
if (!in_array($type, array('info', 'passwd', 'tags'))) {
$this->message(0, '您的操作有误');
}
if (isset($_POST) and !empty($_POST)) {
$model = new Users();
if ($type == 'info') {
$intoData['truename'] = zmf::filterInput($_POST['truename'], 't', 1);
if (!$intoData['truename']) {
$this->message(0, '用户名不能为空');
}
//如果用户修改了用户名,则判断是否被使用
if ($intoData['truename'] != $this->userInfo['truename']) {
$info = Users::getInfoByName($intoData['truename']);
if ($info) {
$this->message(0, '该用户名已被使用');
}
}
$intoData['sex'] = tools::val('sex');
$intoData['areaid'] = tools::val('areaid');
$intoData['content'] = zmf::filterInput($_POST['desc'], 't', 1);
} elseif ($type == 'passwd') {
$old = zmf::filterInput($_POST['old_password'], 't', 1);
$info = Users::model()->findByPk($this->uid);
if (!$old) {
$this->message(0, '请输入原始密码');
} elseif (md5($old) != $info['password']) {
$this->message(0, '原始密码不正确');
}
if (!$_POST['password']) {
$this->message(0, '请输入密码');
} elseif (strlen($_POST['password']) < 5) {
$this->message(0, '新密码过短,请重新输入');
}
$intoData['password'] = md5($_POST['password']);
} elseif ($type == 'tags') {
//相关标签
$tags = $_POST['tagnames'];
$tags = !empty($tags) ? array_unique(array_filter($tags)) : array();
$tagids = array();
if (!empty($tags)) {
foreach ($tags as $str) {
$_tmp = explode('-', $str);
if ($_tmp[1] > 0) {
//添加对应关系
if (Tags::addRelation($_tmp[1], $this->uid, 'user')) {
$tagids[] = $_tmp[1];
}
} else {
//查找是否有对应话题
$_tagid = Tags::findAndAdd($_tmp[0], 'user', $this->uid);
if ($_tagid) {
$tagids[] = $_tagid;
}
}
}
$tagids = !empty($tagids) ? array_unique(array_filter($tagids)) : array();
}
$tagStr = join(',', $tagids);
$intoData['tagids'] = $tagStr;
}
zmf::delFCache("userInfo-{$this->uid}");
if ($model->updateByPk($this->uid, $intoData)) {
$this->message(1, '修改成功', Yii::app()->createUrl('users/config'));
} else {
$this->message(1, '修改成功', Yii::app()->createUrl('users/config'));
}
}
$suggestTags = array();
if ($type == 'tags') {
//推荐的标签
$suggestTags = Tags::getTops('posts');
}
$data = array('info' => $this->userInfo, 'type' => $type, 'suggestTags' => $suggestTags);
$this->render('update', $data);
}
示例3: addAds
public static function addAds($uid)
{
if (!$uid) {
return false;
}
$model = new Ads();
$thekeyid = zmf::filterInput($_POST['Ads']['id']);
$attachid = zmf::filterInput($_POST['Ads']['attachid'], 't', 1);
$intoData = $_POST['Ads'];
$intoData['attachid'] = $attachid;
$intoData['status'] = 1;
$intoData['uid'] = $uid;
if (isset($intoData['start_time'])) {
$intoData['start_time'] = strtotime($intoData['start_time']);
}
if (isset($intoData['expired_time'])) {
$intoData['expired_time'] = strtotime($intoData['expired_time']);
}
$model->attributes = $intoData;
if ($model->validate()) {
if ($model->updateByPk($thekeyid, $intoData)) {
zmf::delFCache("notSaveAds{$uid}");
if ($attachid) {
Attachments::model()->updateAll(array('status' => Posts::STATUS_DELED), "logid={$thekeyid} AND uid={$uid} AND classify='ads'");
Attachments::model()->updateAll(array('status' => Posts::STATUS_PASSED), "id={$attachid}");
}
return true;
} else {
$info = $_POST['Ads'];
}
} else {
$info = $_POST['Ads'];
}
return $info;
}
示例4: actionDelUploadImg
public function actionDelUploadImg($_attachid = '')
{
if (!empty($_attachid)) {
$attachid = $_attachid;
} else {
$attachid = zmf::filterInput($_POST['attachid'], 't', 1);
}
//$attachid=tools::jieMi($attachid);
if (!Yii::app()->request->isAjaxRequest) {
$this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
}
if (Yii::app()->user->isGuest) {
$this->jsonOutPut(0, Yii::t('default', 'loginfirst'));
}
$info = Attachments::getOne($attachid);
if (!$info) {
$this->jsonOutPut(0, Yii::t('default', 'pagenotexists'));
}
if ($info['uid'] != Yii::app()->user->id and !$admin) {
$this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
}
if ($info['classify'] == 'coverimg') {
$model = new Posts();
} elseif ($info['classify'] == 'columns') {
$model = new Columns();
} elseif ($info['classify'] == 'ads') {
$model = new Ads();
}
$dirs = zmf::uploadDirs($info['logid'], 'app', $info['classify']);
if (empty($dirs)) {
$this->jsonOutPut(0, Yii::t('default', 'unkownerror'));
}
foreach ($dirs as $dir) {
$filePath = $dir . '/' . $info['filePath'];
//$this->delItem($attchid, $filePath);
@unlink($filePath);
}
if (Attachments::model()->deleteByPk($attachid)) {
zmf::delFCache("attach{$attachid}");
if (isset($model)) {
$model->updateAll(array('attachid' => 0), 'id=:id', array(':id' => $info['logid']));
}
if ($admin) {
$this->jsonOutPut(1, '操作成功!');
} else {
$this->jsonOutPut(1, '操作成功!');
}
} else {
$this->jsonOutPut(0, '操作失败');
}
}