我有一个注册表单,我在用户和身份表中创建一个记录(用户有很多身份)
表格看起来像这样
<?php echo $this->Form->create('User');?>
<fieldset>
<legend><?php __('Register'); ?></legend>
<?php
echo $this->Form->input('Identity.name');
echo $this->Form->input('Identity.surname');
echo $this->Form->input('User.username');
echo $this->Form->input('User.pass');
echo $this->Form->input('User.pass_confirm', array('type' => 'password'));
echo $this->Form->input('Identity.email');
?>
</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
Run Code Online (Sandbox Code Playgroud)
我收到了User.*字段的所有验证错误消息,但显示的Identity.*字段没有消息.
验证规则:
身份:
var $validate = array(
'name' => array(
'notempty' => array(
'rule' => 'notempty',
'required' => true,
'message' => 'Your name is required.'
)
),
'surname' => array(
'notempty' => array(
'rule' => 'notempty',
'required' => true,
'message' => 'Your surname is …Run Code Online (Sandbox Code Playgroud) 我有一个messenger bot,为用户提供指向网页的链接.有没有办法检测用户何时关闭webview并因此返回到bot对话?
这个问题仅适用于手机上的Messenger应用程序,桌面很好.
window.onbeforeunload不受支持,window.pagehide仅适用于重新加载,但不适用于关闭webview以及window.unload.
我在PHP中有一个应用程序,每个用户都有自己的相关事件.
我想做的是以类似于facebook上的事件的方式公开他的事件,这些事件以格式提供网址webcal://www.facebook.com/ical/b.php?uid=123456789&key=ASD123ASD123ASD,每当有新事件时,它会自动传播到我添加到谷歌日历中的日历.
我想要做的是在一个网址上公开这个日历http://whatever.org/someLongUniquePerUserIdentifier.ics.
我尝试使用同一网址的简单文件模拟事件生成脚本.这是一个由谷歌消费的ics文件,事件已被添加,但当我更改文件内容(删除一个事件)=更改资源,应该订阅谷歌日历,更改根本没有通过到gcal.
由于我无法找到任何可靠的文档来源,我尝试使用不同的关键字进行谷歌搜索,我只被引导到像DAVical,sabredav等webdav服务器.
我已经在我的服务器上安装了DAVical,只是为了进入我已正确安装服务器的状态,但不知道如何在我想要的URL上公开我的MySQL数据库中的事件,这是客户订阅的.
与sabredav相同,除了事实,我没有尝试让它工作,因为我看不到任何记录的方式使用任何dav服务器将我的事件发送到世界.
我基本上被困在一个我在PHP中工作ics导出的地方,没有被日历客户端请求更新,以及一个正在运行的CalDAV服务器,可能会被客户端要求更新,但没有数据要返回.
有什么想法吗?
编辑问题:
实现即时单向日历同步的正确方法是什么?
当我尝试登录时,请求被Security组件分开.我怎样才能让它正常工作?
我有一个简单的登录表单
<div class="container container-login">
<h2><?php echo __('Login'); ?></h2>
<div class="wrap-form-signin">
<?php
echo $this->Form->create('User', array('action' => 'login', 'class' => 'form-signin'));
echo $this->Form->input('username', array('label' => '', 'placeholder' => __('Email')));
echo $this->Form->input('password', array('label' => '', 'placeholder' => __('Password')));
echo $this->Form->submit(__('Login'));
echo $this->Form->end();
?>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
控制器动作如下:
public function login() {
if ($this->request->is('post')) {
if ($this->Auth->login()) {
return $this->redirect($this->Auth->redirectUrl());
} else {
$this->Session->setFlash(__('Username or password is incorrect'), 'default', array(), 'auth');
}
}
}
Run Code Online (Sandbox Code Playgroud)
该Security组件包含在内AppController
public $components = array('Security', …Run Code Online (Sandbox Code Playgroud) 我想检查一下,登录时是否激活了用户的帐户,但是蛋糕的Auth组件以我不知道如何控制的方式处理登录.Cake基本上使用空白登录功能,我不知道如何检查User.active的值.
提前致谢
我正在使用wamp2.0 - PHP 5.3,apache 2.2.11,但我的会话不存储数据.
我有一个页面接受一个参数,我想在会话中存储(简化版本),所以当我来
http://www.example.com/home.php?sessid=db_session_id
Run Code Online (Sandbox Code Playgroud)
该脚本如下所示:
session_start();
$sessid = @$_GET['sessid'];
if ($sessid) {
$_SESSION['sessid'] = $sessid;
}
var_dump($_SESSION);
Run Code Online (Sandbox Code Playgroud)
和输出:
array(1) { [0]=> string(13) "db_session_id" }
Run Code Online (Sandbox Code Playgroud)
这很好,但是当我去链接(没有sessid参数)时,$_SESSION数组是空的.我的事件试图$_SESSION['sessid'] = $sessid;在没有参数的情况下进入页面之前评论该行,但它仍然无法正常工作.
我检查了session_id()输出,会话ID保持不变.
phpinfo()的会话设置
Session Support enabled
Registered save handlers files user
Registered serializer handlers php php_binary wddx
Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 On On
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly …Run Code Online (Sandbox Code Playgroud) 我想测试登录功能,如果它正常工作,只允许有效和活跃的用户.
我的用户夹具包含:
array(
'password' => '*emptyPasswordHash*', // empty password
'username' => 'Lorem',
'balance' => 0,
'currency' => 'USD',
'id' => 1,
'user_group_id' => 3, //Customer
'active' => 1,
'hash' => 'LoremHash'
),
Run Code Online (Sandbox Code Playgroud)
我的测试函数如下所示:
function testLogin() {
//test valid login
$result = $this->testAction('/users/login', array(
'data' => array(
'User' => array(
'username' => 'Lorem',
'pass' => '',
'remember' => true
)),
'method' => 'post',
'return' => 'view'
));
debug($result);
Run Code Online (Sandbox Code Playgroud)
}
登录表单具有3个输入:username,password和remember
我已经设置$this->Auth->autoRedirect = false;了UsersController::beforeFilter …
我有一个看似简单的问题,但我无法找到答案.与存储在表中的文章不同,表jos_content中的类别jos_categories缺少任何已命名的列ordering或任何其他可存储所需信息的列.我也尝试在jos_assets表中找到类似的东西,但它也没有帮助.
我正在黑客攻击内容组件,我需要在调用时按顺序排序我的子类别,$parent->getChildren()或者只是找到ordering列,这样我就可以创建自己的查询,即使它不干净,我只需要尽快使用它.
那么我在哪里可以找到类别排序或如何强制getChildren方法返回有序结果?
在此先感谢Elwhis
即使我在$ COMPOSER_HOME中具有auth.json并已加载,作曲家仍然需要我在安装/更新时键入凭据。
这是composer update -vvv确认auth.json已加载的输出
Reading ./composer.json
Loading config file /home/user/.config/composer/config.json
Loading config file /home/user/.config/composer/auth.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/var/www/html/api): git branch --no-color --no-abbrev -v
Failed to initialize global composer: Composer could not find the config file: /home/user/.config/composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /var/www/html/api/vendor/composer/installed.json
Loading plugin PackageVersions\Installer
Running 1.6.3 (2018-01-31 16:28:17) with PHP 7.2.10-0ubuntu0.18.04.1 on Linux / 4.15.0-38-generic …Run Code Online (Sandbox Code Playgroud) php ×6
cakephp ×3
cakephp-1.3 ×3
login ×2
mysql ×2
cakephp-2.3 ×1
calendar ×1
composer-php ×1
iframe ×1
joomla ×1
joomla1.6 ×1
mobile ×1
model ×1
regex ×1
security ×1
session ×1
simpletest ×1
validation ×1
wamp ×1
webcal ×1
webdav ×1
webview ×1