本文整理汇总了PHP中UserAccount::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAccount::isValid方法的具体用法?PHP UserAccount::isValid怎么用?PHP UserAccount::isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAccount
的用法示例。
在下文中一共展示了UserAccount::isValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ConfigParser
new ConfigParser();
// Get the configuation details and store them as environment variables
$output = "<html><body>\r\n<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js' type='text/javascript'></script>";
function getLoginForm()
{
$output = "\r\n\t<script type='text/javascript'>\r\n\tfunction createUser()\r\n\t{\r\n\t\$.ajax( {\r\n\t\ttype :'GET',\r\n\t\turl :'UserAccountCreate.php',\r\n\t\tdata : 'userName='+document.login.userName.value+'&password='+document.login.password.value,\r\n\t\tdataType :'html',\r\n\t\tasync: false,\r\n cache: false,\r\n timeout: 30000,\r\n\t\tsuccess : function(res) {\r\n\t\tif(res=='success'){\r\n\t\tdocument.login.submit();\r\n\t\t}else {\r\n\t\talert(res);\r\n\t\t}},\r\n\t\terror: function(jqXHR, textStatus, errorThrown){\r\n\t\talert('Error: '+textStatus);\r\n\t\t}\r\n\t});\r\n\t}\r\n\t</script>";
$output .= "<form name='login' action='UserAccountLogin.php'>User Name: <input type='text' name='userName'> Password: <input type='password' name='password'><br><input type='submit' value='Login'><input type='button' value='Create' onClick='createUser();'></form>";
return $output;
}
if (isset($_REQUEST['userName']) && isset($_REQUEST['password'])) {
$DBConnection = new DBConnection(mysqlServerIP2, dbname, dbuser, dbpassword);
$results = $DBConnection->queryDB("Select id from users Where username='" . $_REQUEST['userName'] . "' AND password='" . $_REQUEST['password'] . "'");
$row = $results->fetch_assoc();
$userID = $row["id"];
$userAccount = new UserAccount($userID, $DBConnection);
if ($userAccount->isValid()) {
$output .= "\r\n\t\t<script type='text/javascript'>\r\n\t\tfunction update(){\r\n\t\tvar formData = 'save=1';\r\n\t\t// store form elements\r\n\t\t var elem = document.accountInfo.elements;\r\n for(var i = 0; i < elem.length; i++)\r\n {\r\n formData+='&'+elem[i].name+'='+elem[i].value; \r\n } \r\n //alert(formData);\r\n\t\t\$.ajax( {\r\n\t\ttype :'GET',\r\n\t\turl :'UserAccountUpdate.php',\r\n\t\tdata : formData,\r\n\t\tdataType :'html',\r\n\t\tasync: false,\r\n cache: false,\r\n timeout: 30000,\r\n\t\tsuccess : function(res) {\r\n\t\talert(res);\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown){\r\n\t\talert('Error: '+textStatus);\r\n\t\t}\r\n\t\t});\r\n\t\t}\r\n\t\t\r\n\t\tfunction passwordChange(){\r\n\t\t\t\$('input[class=\"pw\"]').each(function(index, element) {\r\n\t\t\t//\$('input[type=\"password\"]').each(function(index, element) {\r\n\t\t\t//\$(this).type='text';\r\n\t\t\tif(document.accountInfo.pwBox.checked)\r\n\t\t\t{\r\n\t\t\telement.type='text';\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\telement.type='password';\r\n\t\t\t}\r\n\t\t});\r\n\t\t}\r\n\t\t</script>\r\n\t\t<form name='accountInfo'>\r\n\t\t<input type='hidden' name='userName' value='" . $_REQUEST['userName'] . "'><input type='hidden' name='password' value='" . $_REQUEST['password'] . "'>\r\n\t\t<table border=0 width='50%' align='center'>\r\n\t\t";
$results = $DBConnection->queryDB("Select location, working, type from uploadsites order by type, location");
$videoTypeSwitch = false;
$articleTypeSwitch = false;
while ($row = $results->fetch_assoc()) {
$location = $row['location'];
$working = (bool) $row['working'];
$type = $row['type'];
if (strcasecmp("video", $type) === 0 && $videoTypeSwitch == false) {
$output .= "<tr><th colspan='3'><h1>Video</h1></th></tr>\r\n\t\t\t\t<tr><th>Location</th><th>Username</th><th>Password</th>";
$videoTypeSwitch = true;
} else {
if (strcasecmp("article", $type) === 0 && $articleTypeSwitch == false) {
$output .= "<tr><th colspan='3'><h1>Article</h1></th></tr>\r\n\t\t\t\t<tr><th>Location</th><th>Username</th><th>Password</th>";
$articleTypeSwitch = true;