我有一个Profile继承自的表格sfGuardRegisterForm
我有这些领域:
$this->useFields(
array('first_name',
'last_name',
'email_address',
'country',
'language',
'current_password',
'new_password',
'password_again',
)
);
Run Code Online (Sandbox Code Playgroud)
必填字段是:
email_address,country和language
条件是:
email_address与电流不相等,email_address
则检查它是否唯一然后保存current_password是用户的实际密码,然后验证,如果new_password和password_again是平等的,并确认new_password不等于用户的实际密码我只是无法弄清楚如何实现这一点
编辑
谢谢1ed您的示例有效,但问题是我加载用户配置文件并填写字段:'first_name', 'last_name', 'email_address', 'country', 'language'使用实际登录的用户,因此该email_address字段将显示电子邮件地址:
//...
$this->widgetSchema['email_address']->setDefault($this->_user->getEmailAddress());
//...
Run Code Online (Sandbox Code Playgroud)
如果用户不更改电子邮件,它将始终显示此消息:
已存在具有相同"email_address"的对象.
我只想跳过那个
这$this->getObject()->checkPassword()也不起作用,总是显示此消息:
当前密码不正确.
我用:
$ this - > _ user = sfContext :: getInstance() - > getUser() - > getGuardUser();
获取实际的用户个人资料 …
只是寻找一种快速的方法,使用PHP检查一个字符串是否所有数字和10个数字长.
例如:
4343434345 - 这将被接受(10个字符所有数字)
343434344 - 这不会(9个字符)
sdfefsefsdf - 这不会.
谢谢
基本上我觉得问题很简单.但无法找到任何解决方案.
在登录表单中,我使用php来查询我的数据库,通过从数据库表中选择具有该2个值的任何行来检查传递的用户名和密码.
什么似乎是问题是当我登录前.
用户:mm
传球:oo
这样可行.这是正确的,因为它们在db表上.
但现在,如果我使用
用户:MM
传球:oo
仍然有效?哪个不应该.由于我的数据库只有'mm'而不是'MM'.我需要它来区分上部和下部,因为在其他行中我混合了上部和下部字母
我无法想象从一个struct数组中删除duplicates条目
我有这个结构:
public struct stAppInfo
{
public string sTitle;
public string sRelativePath;
public string sCmdLine;
public bool bFindInstalled;
public string sFindTitle;
public string sFindVersion;
public bool bChecked;
}
Run Code Online (Sandbox Code Playgroud)
我已经改变了stAppInfo结构类在这里感谢乔恩斯基特
代码是这样的:(简短版)
stAppInfo[] appInfo = new stAppInfo[listView1.Items.Count];
int i = 0;
foreach (ListViewItem item in listView1.Items)
{
appInfo[i].sTitle = item.Text;
appInfo[i].sRelativePath = item.SubItems[1].Text;
appInfo[i].sCmdLine = item.SubItems[2].Text;
appInfo[i].bFindInstalled = (item.SubItems[3].Text.Equals("Sí")) ? true : false;
appInfo[i].sFindTitle = item.SubItems[4].Text;
appInfo[i].sFindVersion = item.SubItems[5].Text;
appInfo[i].bChecked = (item.SubItems[6].Text.Equals("Sí")) ? true : false;
i++;
}
Run Code Online (Sandbox Code Playgroud)
我需要 …
为什么不能range()在这里分配变量?
class foo
{
//
// Error
public static $bar = range(1, 10);
//
// Error
public $bar = range(1, 10);
//
// Works
public static $zoo = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
Run Code Online (Sandbox Code Playgroud)