本文整理汇总了PHP中db_prepare_input函数的典型用法代码示例。如果您正苦于以下问题:PHP db_prepare_input函数的具体用法?PHP db_prepare_input怎么用?PHP db_prepare_input使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_prepare_input函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: btn_delete
function btn_delete()
{
global $db, $messageStack;
if ($this->security_id < 4) {
$messageStack->add_session(ERROR_NO_PERMISSION, 'error');
return false;
}
$countries_id = db_prepare_input($_POST['rowSeq']);
$result = $db->Execute("select countries_name from " . $this->db_table . " where countries_id = " . (int) $countries_id);
$db->Execute("delete from " . $this->db_table . " where countries_id = " . (int) $countries_id);
gen_add_audit_log(SETUP_LOG_COUNTRIES . TEXT_DELETE, $result->fields['countries_name']);
return true;
}
示例2: btn_delete
function btn_delete()
{
global $db, $messageStack;
if ($this->security_id < 4) {
$messageStack->add_session(ERROR_NO_PERMISSION, 'error');
return false;
}
$tax_auth_id = db_prepare_input($_POST['rowSeq']);
// Check for this authority being used in a tax rate calculation, if so do not delete
$result = $db->Execute("select tax_auths from " . TABLE_JOURNAL_MAIN . " \r\n\t\twhere tax_auths like '%" . $tax_auth_id . "%'");
while (!$result->EOF) {
$auth_ids = explode(':', $result->fields['tax_auths']);
for ($i = 0; $i < count($auth_ids); $i++) {
if ($tax_auth_id == $auth_ids[$i]) {
$messageStack->add(SETUP_TAX_AUTHS_DELETE_ERROR, 'error');
return false;
}
}
$result->MoveNext();
}
// OK to delete
$result = $db->Execute("select description_short from " . $this->db_table . " where tax_auth_id = " . (int) $tax_auth_id);
$db->Execute("delete from " . $this->db_table . " where tax_auth_id = " . (int) $tax_auth_id);
gen_add_audit_log(SETUP_TAX_AUTHS_LOG . TEXT_DELETE, $result->fields['description_short']);
return true;
}
示例3: btn_save
function btn_save($id = '')
{
global $db, $messageStack;
if ($_SESSION['admin_security'][SECURITY_ID_CONFIGURATION] < 2) {
$messageStack->add_session(ERROR_NO_PERMISSION, 'error');
return false;
}
$tab_name = db_prepare_input($_POST['tab_name']);
$sql_data_array = array('module_id' => 'assets', 'tab_name' => db_prepare_input($_POST['tab_name']), 'description' => db_prepare_input($_POST['description']), 'sort_order' => db_prepare_input($_POST['sort_order']));
if ($id) {
db_perform(TABLE_EXTRA_TABS, $sql_data_array, 'update', "id = " . $id);
gen_add_audit_log(sprintf(EXTRA_TABS_LOG, TEXT_UPDATE), $tab_name);
} else {
// Test for duplicates.
$result = $db->Execute("select id from " . TABLE_EXTRA_TABS . " where module_id='assets' and tab_name='" . $tab_name . "'");
if ($result->RecordCount() > 0) {
$messageStack->add(EXTRA_TABS_DELETE_ERROR, 'error');
return false;
}
$sql_data_array['id'] = db_prepare_input($_POST['rowSeq']);
db_perform(TABLE_EXTRA_TABS, $sql_data_array);
gen_add_audit_log(sprintf(EXTRA_TABS_LOG, TEXT_ADD), $tab_name);
}
return true;
}
示例4: Update
function Update()
{
if (count($this->params) == 0) {
$this->params['num_rows'] = db_prepare_input($_POST['todays_orders_field_0']);
}
parent::Update();
}
示例5: Update
function Update()
{
global $db;
$admin_id = $_SESSION['admin_id'];
$my_title = db_prepare_input($_POST['my_title']);
$my_url = db_prepare_input($_POST['my_url']);
$remove_id = db_prepare_input($_POST[$this->module_id . '_rId']);
$page_id = $_GET['module'] ? $_GET['module'] : 'index';
// do nothing if no title or url entered
if (!$remove_id && ($my_title == '' || $my_url == '')) {
return;
}
// fetch the current params
$result = $db->Execute("select params from " . TABLE_USERS_PROFILES . "\r\n\t\t\twhere page_id = '" . $page_id . "' and user_id = " . $admin_id . " and module_id = '" . $this->module_id . "'");
if ($remove_id) {
// remove element
$params = unserialize($result->fields['params']);
$first_part = array_slice($params, 0, $remove_id - 1);
$last_part = array_slice($params, $remove_id);
$params = array_merge($first_part, $last_part);
} elseif ($result->fields['params']) {
// append new url and sort
$params = unserialize($result->fields['params']);
$params[$my_title] = $my_url;
ksort($params);
} else {
// first entry
$params = array($my_title => $my_url);
}
$db->Execute("update " . TABLE_USERS_PROFILES . " set params = '" . serialize($params) . "' \r\n\t\t\twhere user_id = " . $admin_id . " and page_id = '" . $page_id . "' and module_id = '" . $this->module_id . "'");
}
示例6: btn_delete
function btn_delete()
{
global $db, $messageStack;
if ($this->security_id < 4) {
$messageStack->add_session(ERROR_NO_PERMISSION, 'error');
return false;
}
$phase_id = db_prepare_input($_POST['rowSeq']);
/*
// Check for this project phase being used in a journal entry, if so do not allow deletion
$result = $db->Execute("select projects from " . TABLE_JOURNAL_ITEM . "
where projects like '%" . $phase_id . "%'");
while (!$result->EOF) {
$phase_ids = explode(':', $result->fields['projects']);
for ($i = 0; $i < count($phase_ids); $i++) {
if ($phase_id == $phase_ids[$i]) {
$messageStack->add(SETUP_PROJECT_PHASESS_DELETE_ERROR,'error');
return false;
}
}
$result->MoveNext();
}
*/
// OK to delete
$result = $db->Execute("select description_short from " . $this->db_table . " where phase_id = " . (int) $phase_id);
$db->Execute("delete from " . $this->db_table . " where phase_id = " . (int) $phase_id);
gen_add_audit_log(SETUP_PROJECT_PHASESS_LOG . TEXT_DELETE, $result->fields['description_short']);
return true;
}
示例7: btn_save
function btn_save($id = '')
{
global $db, $messageStack;
if ($this->security_id < 2) {
$messageStack->add(ERROR_NO_PERMISSION, 'error');
return false;
}
if ($_POST['subdepartment'] && !$_POST['primary_dept_id']) {
$_POST['subdepartment'] = '0';
}
if (!$_POST['subdepartment']) {
$_POST['primary_dept_id'] = '';
}
if ($_POST['primary_dept_id'] == $id) {
$messageStack->add(HR_DEPARTMENT_REF_ERROR, 'error');
$this->error = true;
return false;
}
// OK to save
$sql_data_array = array('description_short' => db_prepare_input($_POST['description_short']), 'description' => db_prepare_input($_POST['description']), 'subdepartment' => db_prepare_input($_POST['subdepartment']), 'primary_dept_id' => db_prepare_input($_POST['primary_dept_id']), 'department_type' => db_prepare_input($_POST['department_type']), 'department_inactive' => db_prepare_input($_POST['department_inactive'] ? '1' : '0'));
if ($id) {
db_perform($this->db_table, $sql_data_array, 'update', "id = '" . $id . "'");
gen_add_audit_log(HR_LOG_DEPARTMENTS . TEXT_UPDATE, $id);
} else {
$sql_data_array['id'] = db_prepare_input($_POST['id']);
db_perform($this->db_table, $sql_data_array);
gen_add_audit_log(HR_LOG_DEPARTMENTS . TEXT_ADD, $id);
}
return true;
}
示例8: objectInfo
function objectInfo($object_array)
{
reset($object_array);
while (list($key, $value) = each($object_array)) {
$this->{$key} = db_prepare_input($value);
}
}
示例9: __construct
public function __construct()
{
foreach ($_POST as $key => $value) {
$this->{$key} = db_prepare_input($value);
}
$this->id = isset($_POST['sID']) ? $_POST['sID'] : $_GET['sID'];
}
示例10: Update
function Update()
{
global $db;
$my_note = db_prepare_input($_POST['my_notes_field_0']);
$remove_id = db_prepare_input($_POST['my_notes_rId']);
// do nothing if no title or url entered
if (!$remove_id && $my_note == '') {
return;
}
// fetch the current params
$result = $db->Execute("select params from " . TABLE_USERS_PROFILES . "\n\t\t where user_id = " . $_SESSION['admin_id'] . " and menu_id = '" . $this->menu_id . "' \n\t\t and dashboard_id = '" . $this->dashboard_id . "'");
if ($remove_id) {
// remove element
$this->params = unserialize($result->fields['params']);
$first_part = array_slice($this->params, 0, $remove_id - 1);
$last_part = array_slice($this->params, $remove_id);
$this->params = array_merge($first_part, $last_part);
} elseif ($result->fields['params']) {
// append new note and sort
$this->params = unserialize($result->fields['params']);
$this->params[] = $my_note;
} else {
// first entry
$this->params[] = $my_note;
}
ksort($this->params);
db_perform(TABLE_USERS_PROFILES, array('params' => serialize($this->params)), "update", "user_id = " . $_SESSION['admin_id'] . " and menu_id = '" . $this->menu_id . "' and dashboard_id = '" . $this->dashboard_id . "'");
}
示例11: Update
function Update()
{
global $db;
$my_title = db_prepare_input($_POST['company_links_field_0']);
$my_url = db_prepare_input($_POST['company_links_field_1']);
$remove_id = db_prepare_input($_POST[$this->dashboard_id . '_rId']);
// do nothing if no title or url entered
if (!$remove_id && ($my_title == '' || $my_url == '')) {
return;
}
// fetch the current params
$result = $db->Execute("select params from " . TABLE_USERS_PROFILES . "\n\t\t where menu_id = '" . $this->menu_id . "' and dashboard_id = '" . $this->dashboard_id . "'");
// just need one
if ($remove_id) {
// remove element
$this->params = unserialize($result->fields['params']);
$first_part = array_slice($this->params, 0, $remove_id - 1);
$last_part = array_slice($this->params, $remove_id);
$this->params = array_merge($first_part, $last_part);
} elseif ($result->fields['params']) {
// append new url and sort
$this->params = unserialize($result->fields['params']);
$this->params[$my_title] = $my_url;
} else {
// first entry
$this->params[$my_title] = $my_url;
}
ksort($this->params);
db_perform(TABLE_USERS_PROFILES, array('params' => serialize($this->params)), "update", "menu_id = '" . $this->menu_id . "' and dashboard_id = '" . $this->dashboard_id . "'");
}
示例12: __construct
public function __construct()
{
$this->security_id = $_SESSION['admin_security'][SECURITY_ID_CONFIGURATION];
foreach ($_POST as $key => $value) {
$this->{$key} = db_prepare_input($value);
}
$this->id = isset($_POST['sID']) ? $_POST['sID'] : $_GET['sID'];
}
示例13: btn_save
function btn_save($id = '')
{
if (parent::btn_save($id = '')) {
$sql_data_array['use_in_inventory_filter'] = db_prepare_input($_POST['use_in_inventory_filter']);
db_perform(TABLE_EXTRA_FIELDS, $sql_data_array, 'update', "id = {$this->id}");
return true;
}
return false;
}
示例14: postAssign
function postAssign(&$smartyobj, $postArray = '')
{
if (!is_array($postArray)) {
$postArray = $_POST;
}
foreach ($postArray as $key => $value) {
$smartyobj->assign($key, db_prepare_input($value));
}
}
示例15: __construct
public function __construct()
{
$this->security_id = $_SESSION['admin_security'][SECURITY_ID_CONFIGURATION];
foreach ($_POST as $key => $value) {
$this->{$key} = db_prepare_input($value);
}
$this->id = isset($_POST['sID']) ? $_POST['sID'] : $_GET['sID'];
$this->store_ids = gen_get_store_ids();
if ($_REQUEST['page'] == 'main') {
$this->showDropDown();
}
}