本文整理汇总了PHP中Admin::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Admin::update方法的具体用法?PHP Admin::update怎么用?PHP Admin::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin
的用法示例。
在下文中一共展示了Admin::update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
if (!isset($_SESSION['ITCLoggedInAdmin']) || !isset($_SESSION["ITCadminEmail"])) {
$json = array("status" => 0, "msg" => "You are not logged in.");
header('Content-type: application/json');
echo json_encode($json);
} else {
if (filter_input(INPUT_POST, "updateThisAdmin") != NULL) {
$postVars = array('id', 'name', 'email', 'userName', 'role');
// Form fields names
//Validate the POST variables and add up to error message if empty
foreach ($postVars as $postVar) {
switch ($postVar) {
default:
$adminObj->{$postVar} = filter_input(INPUT_POST, $postVar) ? mysqli_real_escape_string($dbObj->connection, filter_input(INPUT_POST, $postVar)) : '';
if ($adminObj->{$postVar} === "") {
array_push($errorArr, "Please enter {$postVar} ");
}
break;
}
}
//If validated and not empty submit it to database
if (count($errorArr) < 1) {
echo $adminObj->update();
} else {
$json = array("status" => 0, "msg" => $errorArr);
$dbObj->close();
//Close Database Connection
header('Content-type: application/json');
echo json_encode($json);
}
}
}
示例2: sqlInjection
<?php
session_start();
require "../includes/checkPermission.php";
require "../../deny/connector.php";
require "class/class.Admin.php";
require "../includes/injection.php";
$fullname = sqlInjection($_POST['Afullname']);
$email = sqlInjection($_POST['AEmail']);
$phone = sqlInjection($_POST['APhone']);
$adm = new Admin();
$adm->update($_SESSION['ADMIN'], $email, $fullname, $phone);
echo "<meta http-equiv='refresh' content='0;url=../admincp.php'>";
//header("location: ../admincp.php");
//exit();
示例3: finish_installation
function finish_installation()
{
require_once LIB_PATH . 'osclass/helpers/hSecurity.php';
require_once LIB_PATH . 'osclass/model/Admin.php';
require_once LIB_PATH . 'osclass/model/Preference.php';
require_once LIB_PATH . 'osclass/model/Category.php';
require_once LIB_PATH . 'osclass/model/Item.php';
require_once LIB_PATH . 'osclass/core/Params.php';
require_once LIB_PATH . 'osclass/compatibility.php';
require_once LIB_PATH . 'osclass/utils.php';
$data = array();
$password = osc_genRandomPassword();
$mAdmin = new Admin();
$admin_user = 'admin';
$admin = $mAdmin->update(array('s_password' => sha1($password)), array('s_username' => $admin_user));
$mPreference = Preference::newInstance();
$mPreference->insert(array('s_section' => 'osclass', 's_name' => 'osclass_installed', 's_value' => '1', 'e_type' => 'BOOLEAN'));
// update categories
$mCategories = new Category();
if (Params::getParam('submit') != '') {
$categories = Params::getParam('categories');
if (is_array($categories)) {
foreach ($categories as $category_id) {
$mCategories->update(array('b_enabled' => '1'), array('pk_i_id' => $category_id));
}
}
}
$aCategoriesToDelete = $mCategories->listWhere("a.b_enabled = 0");
foreach ($aCategoriesToDelete as $aCategory) {
$mCategories->deleteByPrimaryKey($aCategory['pk_i_id']);
}
$admin = $mAdmin->findByPrimaryKey(1);
$data['s_email'] = $admin['s_email'];
$data['admin_user'] = $admin_user;
$data['password'] = $password;
$body = 'Welcome ' . $mPreference->get('pageTitle') . ',<br/><br/>';
$body .= 'Your OSClass installation at ' . WEB_PATH . ' is up and running. You can access to the administration panel with this data access:<br/>';
$body .= '<ul>';
$body .= '<li>username: ' . $admin_user . '</li>';
$body .= '<li>password: ' . $password . '</li>';
$body .= '</ul>';
$body .= 'Regards,<br/>';
$body .= 'The <a href=\'http://osclass.org/\'>OSClass</a> team';
$sitename = strtolower($_SERVER['SERVER_NAME']);
if (substr($sitename, 0, 4) == 'www.') {
$sitename = substr($sitename, 4);
}
require_once LIB_PATH . 'phpmailer/class.phpmailer.php';
$mail = new PHPMailer();
$mail->CharSet = "utf-8";
$mail->Host = "localhost";
$mail->From = 'osclass@' . $sitename;
$mail->FromName = 'OSClass';
$mail->Subject = 'OSClass successfully installed!';
$mail->AddAddress($admin['s_email'], 'OSClass administrator');
$mail->Body = $body;
$mail->AltBody = $body;
if (!$mail->Send()) {
echo $mail->ErrorInfo;
}
return $data;
}
示例4: Admin
<?php
include_once $CFG->dirroot . "/lib/classes/application/Admin.Class.php5";
$adminObj = new Admin();
$vFromIP = $_SERVER['REMOTE_ADDR'];
$iAdminId = $_POST['iAdminId'];
$adminObj->select($iAdminId);
$GeneralObj->getRequestVars();
$adminObj->setAllVar();
$redirect_file = "index.php?file=a-adminadd";
$GeneralObj->checkDuplicate('iAdminId', 'admin', array('vUserName'), $redirect_file, USER_ALREADY_EXISTS, $iAdminId);
$GeneralObj->checkDuplicate('iAdminId', 'admin', array('vEmail'), $redirect_fshowile, EMAIL_ALLREADY_EXIST, $iAdminId);
#print_R($_POST); exit;
$iAdminId = $_POST['iAdminId'];
$dAddedDate = date('Y-m-d H:i:s');
$adminObj->setdRegDate($dAddedDate);
$adminObj->setvFromIP($vFromIP);
$adminObj->update($iAdminId);
$msg = MSG_UPDATE;
$url = 'index.php?file=a-adminadd&var_msg=' . $msg;
header("Location:" . $url);
exit;
示例5: Admin
<?php
session_name('IDSESSION');
session_start();
$_SESSION['display'] = "displayComs();";
require_once '../../php/connexion.class.php';
require_once 'admin.class.php';
$comments = new Admin();
$comments->update();
?>
<h3> Galleries updated.</h3>
<script>setTimeout(function() { location.reload(); }, 2000);</script>
示例6: testBeforeSaveOnUpdate
public function testBeforeSaveOnUpdate()
{
$connection = m::mock('juicyORM\\Database\\DbConnection');
$connection->shouldReceive('query')->with('SELECT * FROM "admin" WHERE "admin_id" = ? LIMIT 0, 1', array('5'))->once()->andReturn(array(array("admin_id" => 5, "username" => "Steve", "email" => "derek@example.com")));
$connection->shouldReceive('query')->with('UPDATE "admin" SET "username" = ?, "email" = ? WHERE "admin_id" = ?', array('Steve5', 'derek@example.com', 5), false)->once()->andReturn(true);
$connection->shouldReceive('query')->with('SELECT * FROM "admin" WHERE "admin_id" = ?', array('5'))->once()->andReturn(array(array("admin_id" => 5, "username" => "Steve5", "email" => "derek@example.com")));
$db = juicyORM\Database\DB::Instance($this->dbConfig, $connection, true);
$admin = new Admin($db);
$user_response = $admin->update(5, array("username" => "Derek", "email" => "derek@example.com"));
$this->assertEquals(gettype($user_response), 'object');
$this->assertEquals(get_class($user_response), 'juicyORM\\Database\\ModelRow');
$this->assertEquals($user_response->username, 'Steve5');
}