本文整理汇总了PHP中Manager::update_common方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::update_common方法的具体用法?PHP Manager::update_common怎么用?PHP Manager::update_common使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manager
的用法示例。
在下文中一共展示了Manager::update_common方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
$log = $manager->select_special($tables, $rel, $filters, " LIMIT 1");
//testando
if ($log === false) {
header("location: {$project_index}/?error=user_not_found");
} elseif ($log[0]['user_status'] == "0") {
//status
header("location: {$project_index}/?error=user_inative");
} elseif ($log[0]['user_password'] != $password) {
//senha
header("location: {$project_index}/?error=password_incorrect");
} else {
//deu certo.
//atualizando ultimo acesso
$last_d['user_last_access'] = date('Y-m-d H:i:s');
$last_f['id_user'] = $log[0]['id_user'];
$manager->update_common('tb_user', $last_d, $last_f, "");
$log[0]['user_last_access'] = $last_d['user_last_access'];
//removendo a senha
unset($log[0]['user_password']);
//criando o objeto com os dados do banco
$user = new User($log[0]['user_name'], $log[0]['user_email']);
//setando dados do usuario.
foreach ($log[0] as $k => $v) {
$user->{$k} = $v;
}
//inicia o serviço sessão
session_start();
//colocando o objeto dentro da sessao.
$_SESSION[md5('us_inventory')] = $user;
header("location: {$project_index}");
}
示例2: dirname
include_once dirname(__DIR__) . '/model/urls.php';
include_once $project_path . '/model/class/Connect.class.php';
include_once $project_path . '/model/class/Manager.class.php';
include_once $project_path . '/model/class/User.class.php';
//iniciar a sessao
session_start();
//testando permissão.
if (!isset($_SESSION[md5('us_inventory')])) {
header("location: {$project_index}?error=permission_denied");
}
//resgata os dados antigos do usuário
$user = $_SESSION[md5('us_inventory')];
//receber os dados
$new_data['user_name'] = $_POST['name'];
$new_data['user_email'] = $_POST['email'];
if ($_POST['password'] != "") {
$new_data['user_password'] = sha1($_POST['password']);
}
//alterar no banco
$manager = new Manager();
//filtros
$filters['id_user'] = $user->id_user;
//executa a atualização
$manager->update_common('tb_user', $new_data, $filters, "");
//alterar na sessao
$user->user_name = $new_data['user_name'];
$user->user_email = $new_data['user_email'];
//atualiza a sessao
$_SESSION[md5('us_inventory')] = $user;
header("location: {$project_index}/" . $user->profile_page . ".php?success=user_updated");
示例3: dirname
<?php
include_once dirname(__DIR__) . '/model/urls.php';
include_once $project_path . '/model/class/Connect.class.php';
include_once $project_path . '/model/class/Manager.class.php';
include_once $project_path . '/model/class/User.class.php';
session_start();
//permissao
if (!isset($_SESSION[md5('us_inventory')])) {
header("location: {$project_index}?error=permission_denied");
}
//testa se é admin
$user = $_SESSION[md5('us_inventory')];
if ($user->profile_page != "admin") {
header("location: {$project_index}?error=permission_denied");
}
if (!isset($_POST['filter'])) {
header("location: {$project_index}?error=less_permission");
}
//aqui começa...
//recebe os dados
$new_data['category_name'] = $_POST['name'];
$new_data['category_desc'] = $_POST['desc'];
$filter['id_category'] = $_POST['filter'];
$manager = new Manager();
$manager->update_common('tb_category', $new_data, $filter, "");
header("location: {$project_index}/" . $user->profile_page . ".php?option=list_categories&success=category_updated");
示例4: dirname
<?php
include_once dirname(__DIR__) . '/model/urls.php';
include_once $project_path . '/model/class/Connect.class.php';
include_once $project_path . '/model/class/Manager.class.php';
include_once $project_path . '/model/class/User.class.php';
session_start();
if (!isset($_SESSION[md5('us_inventory')])) {
header("location: {$project_index}?error=less_permission");
}
//resgata os dados do usuario
$user = $_SESSION[md5('us_inventory')];
//testando permissão
if ($user->profile_page != "admin") {
header("location: {$project_index}?error=less_permission");
}
if (!isset($_POST['filter'])) {
header("location: {$project_index}?error=less_permission");
}
//recebendo os dados
$new_data['category_id'] = $_POST['category'];
$new_data['product_name'] = $_POST['name'];
$new_data['product_price'] = $_POST['price'];
$new_data['product_details'] = $_POST['details'];
$new_data['product_quantity'] = $_POST['quantity'];
$filter['id_product'] = $_POST['filter'];
$manager = new Manager();
$manager->update_common('tb_product', $new_data, $filter, "");
header("location: {$project_index}/" . $user->profile_page . ".php?option=list_products&success=product_updated");