本文整理汇总了PHP中prepare_for_db函数的典型用法代码示例。如果您正苦于以下问题:PHP prepare_for_db函数的具体用法?PHP prepare_for_db怎么用?PHP prepare_for_db使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prepare_for_db函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SQLWhere
function SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest)
{
$hasDigits = false;
for ($i = 0; $i < strlen($SearchFor); $i++) {
if (is_numeric($SearchFor[$i])) {
$hasDigits = true;
break;
}
}
if (!$hasDigits) {
for ($i = 0; $i < strlen($SearchFor2); $i++) {
if (is_numeric($SearchFor2[$i])) {
$hasDigits = true;
break;
}
}
}
if (!$hasDigits) {
return "";
}
//$SearchFor = $this->prepare_datetime_for_search($SearchFor);
if ($SearchFor == "") {
return "";
}
//$SearchFor2 = $this->prepare_datetime_for_search($SearchFor2);
$SearchFor = prepare_for_db($this->field, $SearchFor, "time");
$SearchFor2 = prepare_for_db($this->field, $SearchFor2, "time");
return parent::SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest);
}
示例2: postvalue
// processibng Customer Type - end
// insert masterkey value if exists and if not specified
if (@$_SESSION[$sessionPrefix . "_mastertable"] == "dbo.LU_Customer Type") {
if (postvalue("masterkey1")) {
$_SESSION[$sessionPrefix . "_masterkey1"] = postvalue("masterkey1");
}
if ($avalues["Customer Type"] == "") {
$avalues["Customer Type"] = prepare_for_db("Customer Type", $_SESSION[$sessionPrefix . "_masterkey1"]);
}
}
if (@$_SESSION[$sessionPrefix . "_mastertable"] == "dbo.LU_Locations") {
if (postvalue("masterkey1")) {
$_SESSION[$sessionPrefix . "_masterkey1"] = postvalue("masterkey1");
}
if ($avalues["Location"] == "") {
$avalues["Location"] = prepare_for_db("Location", $_SESSION[$sessionPrefix . "_masterkey1"]);
}
}
$failed_inline_add = false;
// add filenames to values
foreach ($afilename_values as $akey => $value) {
$avalues[$akey] = $value;
}
// before Add event
$retval = true;
if ($eventObj->exists("BeforeAdd")) {
$retval = $eventObj->BeforeAdd($avalues, $usermessage, (bool) $inlineadd);
}
if ($retval && $pageObject->isCaptchaOk) {
$_SESSION[$strTableName . "_count_captcha"] = $_SESSION[$strTableName . "_count_captcha"] + 1;
if (DoInsertRecord($strOriginalTableName, $avalues, $blobfields, $id, $pageObject)) {
示例3: postvalue
// processing inserts - end
// insert masterkey value if exists and if not specified
if (@$_SESSION[$sessionPrefix . "_mastertable"] == "app.groups") {
if (postvalue("masterkey1")) {
$_SESSION[$sessionPrefix . "_masterkey1"] = postvalue("masterkey1");
}
if ($avalues["group_id"] == "") {
$avalues["group_id"] = prepare_for_db("group_id", $_SESSION[$sessionPrefix . "_masterkey1"]);
}
}
if (@$_SESSION[$sessionPrefix . "_mastertable"] == "app.modules") {
if (postvalue("masterkey1")) {
$_SESSION[$sessionPrefix . "_masterkey1"] = postvalue("masterkey1");
}
if ($avalues["module_id"] == "") {
$avalues["module_id"] = prepare_for_db("module_id", $_SESSION[$sessionPrefix . "_masterkey1"]);
}
}
$failed_inline_add = false;
// add filenames to values
foreach ($afilename_values as $akey => $value) {
$avalues[$akey] = $value;
}
// before Add event
$retval = true;
if ($eventObj->exists("BeforeAdd")) {
$retval = $eventObj->BeforeAdd($avalues, $usermessage, (bool) $inlineadd, $pageObject);
}
if ($retval && $pageObject->isCaptchaOk) {
//add or set updated lat-lng values for all map fileds with 'UpdateLatLng' ticked
setUpdatedLatLng($avalues, $pageObject->cipherer->pSet);
示例4: postvalue
}
// processing updated - end
// processing created - start
$inlineAddOption = true;
if ($inlineAddOption) {
$control_created = $pageObject->getControl("created", $id);
$control_created->readWebValue($avalues, $blobfields, "", false, $afilename_values);
}
// processing created - end
// insert masterkey value if exists and if not specified
if (@$_SESSION[$sessionPrefix . "_mastertable"] == "pad.pad_reklame_kelas_jalan") {
if (postvalue("masterkey1")) {
$_SESSION[$sessionPrefix . "_masterkey1"] = postvalue("masterkey1");
}
if ($avalues["jalan_kelas_id"] == "") {
$avalues["jalan_kelas_id"] = prepare_for_db("jalan_kelas_id", $_SESSION[$sessionPrefix . "_masterkey1"]);
}
}
$failed_inline_add = false;
// add filenames to values
foreach ($afilename_values as $akey => $value) {
$avalues[$akey] = $value;
}
// before Add event
$retval = true;
if ($eventObj->exists("BeforeAdd")) {
$retval = $eventObj->BeforeAdd($avalues, $usermessage, (bool) $inlineadd, $pageObject);
}
if ($retval && $pageObject->isCaptchaOk) {
//add or set updated lat-lng values for all map fileds with 'UpdateLatLng' ticked
setUpdatedLatLng($avalues, $pageObject->cipherer->pSet);
示例5: md5
}
if ($value !== false) {
if (0 && "Location" == "Password" && $url_page == "admin_users_") {
$value = md5($value);
}
$evalues["Location"] = $value;
}
}
// processing Location - end
// processing Customer Type - begin
$condition = 1;
if ($condition) {
$value = postvalue("value_Customer_Type_" . $id);
$type = postvalue("type_Customer_Type_" . $id);
if (FieldSubmitted("Customer Type_" . $id)) {
$value = prepare_for_db("Customer Type", $value, $type);
} else {
$value = false;
}
if ($value !== false) {
if (0 && "Customer Type" == "Password" && $url_page == "admin_users_") {
$value = md5($value);
}
$evalues["Customer Type"] = $value;
}
}
// processing Customer Type - end
foreach ($efilename_values as $ekey => $value) {
$evalues[$ekey] = $value;
}
if ($pageObject->lockingObj) {
示例6: md5
}
if (!($value === false)) {
if (0 && "Bill Amount" == "Password" && $url_page == "admin_users_") {
$value = md5($value);
}
$avalues["Bill Amount"] = $value;
}
}
// processibng Bill Amount - end
// processing Due Date - start
$inlineAddOption = true;
if ($inlineAddOption) {
$value = postvalue("value_Due_Date_" . $id);
$type = postvalue("type_Due_Date_" . $id);
if (FieldSubmitted("Due Date_" . $id)) {
$value = prepare_for_db("Due Date", $value, $type);
} else {
$value = false;
}
if (!($value === false)) {
if (0 && "Due Date" == "Password" && $url_page == "admin_users_") {
$value = md5($value);
}
$avalues["Due Date"] = $value;
}
}
// processibng Due Date - end
$failed_inline_add = false;
// add filenames to values
foreach ($afilename_values as $akey => $value) {
$avalues[$akey] = $value;
示例7: SQLWhere
/**
* Get the WHERE clause conditions string for the search or suggest SQL query
* @param String SearchFor
* @param String strSearchOption
* @param String SearchFor2
* @param String etype
* @param Boolean isSuggest
*/
function SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest)
{
$baseResult = $this->baseSQLWhere($strSearchOption);
if ($baseResult === false) {
return "";
}
if ($baseResult != "") {
return $baseResult;
}
if (!strlen($SearchFor)) {
return "";
}
$value1 = $this->pageObject->cipherer->MakeDBValue($this->field, $SearchFor, $etype, true);
$value2 = false;
$cleanvalue2 = false;
if ($strSearchOption == "Between") {
$cleanvalue2 = prepare_for_db($this->field, $SearchFor2, $etype);
$value2 = make_db_value($this->field, $SearchFor2, $etype);
}
if ($strSearchOption != "Contains" && $strSearchOption != "Starts with" && ($value1 === "null" || $value2 === "null") && !$this->pageObject->cipherer->isFieldPHPEncrypted($this->field)) {
return "";
}
if (($strSearchOption == "Contains" || $strSearchOption == "Starts with") && !$this->isStringValidForLike($SearchFor)) {
return "";
}
$searchIsCaseInsensitive = $this->pageObject->pSetEdit->getNCSearch();
if (IsCharType($this->type) && !$this->btexttype) {
$gstrField = $this->getFieldSQLDecrypt();
if (!$this->pageObject->cipherer->isFieldPHPEncrypted($this->field) && $searchIsCaseInsensitive) {
$value1 = $this->connection->upper($value1);
$value2 = $this->connection->upper($value2);
$gstrField = $this->connection->upper($gstrField);
}
} elseif ($strSearchOption == "Contains" || $strSearchOption == "Starts with") {
$gstrField = $this->connection->field2char($this->getFieldSQLDecrypt(), $this->type);
} elseif ($this->pageObject->pSetEdit->getViewFormat($this->field) == FORMAT_TIME) {
$gstrField = $this->connection->field2time($this->getFieldSQLDecrypt(), $this->type);
} else {
$gstrField = $this->getFieldSQLDecrypt();
}
if ($strSearchOption == "Contains") {
if ($this->pageObject->cipherer->isFieldPHPEncrypted($this->field)) {
return $gstrField . "=" . $this->pageObject->cipherer->MakeDBValue($this->field, $SearchFor);
}
$SearchFor = $this->connection->escapeLIKEpattern($SearchFor);
if (IsCharType($this->type) && !$this->btexttype && $searchIsCaseInsensitive) {
return $gstrField . " " . $this->like . " " . $this->connection->upper($this->connection->prepareString("%" . $SearchFor . "%"));
}
return $gstrField . " " . $this->like . " " . $this->connection->prepareString("%" . $SearchFor . "%");
}
if ($strSearchOption == "Equals") {
return $gstrField . "=" . $value1;
}
if ($strSearchOption == "Starts with") {
$SearchFor = $this->connection->escapeLIKEpattern($SearchFor);
if (IsCharType($this->type) && !$this->btexttype && $searchIsCaseInsensitive) {
return $gstrField . " " . $this->like . " " . $this->connection->upper($this->connection->prepareString($SearchFor . "%"));
}
return $gstrField . " " . $this->like . " " . $this->connection->prepareString($SearchFor . "%");
}
if ($strSearchOption == "More than") {
return $gstrField . ">" . $value1;
}
if ($strSearchOption == "Less than") {
return $gstrField . "<" . $value1;
}
if ($strSearchOption == "Equal or more than") {
return $gstrField . ">=" . $value1;
}
if ($strSearchOption == "Equal or less than") {
return $gstrField . "<=" . $value1;
}
if ($strSearchOption == "Between") {
$ret = $gstrField . ">=" . $value1 . " and ";
if (IsDateFieldType($this->type)) {
$timeArr = db2time($cleanvalue2);
// for dates without time, add one day
if ($timeArr[3] == 0 && $timeArr[4] == 0 && $timeArr[5] == 0) {
$timeArr = adddays($timeArr, 1);
$value2 = $timeArr[0] . "-" . $timeArr[1] . "-" . $timeArr[2];
$value2 = add_db_quotes($this->field, $value2, $this->pageObject->tName);
$ret .= $gstrField . "<" . $value2;
} else {
$ret .= $gstrField . "<=" . $value2;
}
} else {
$ret .= $gstrField . "<=" . $value2;
}
return $ret;
}
return "";
}
示例8: array
if ($pageObject->captchaExists()) {
$pageObject->doCaptchaCode();
}
}
// insert new record if we have to
if (@$_POST["a"] == "added") {
$afilename_values = array();
$avalues = array();
$blobfields = array();
// processing Type - start
$inlineAddOption = true;
if ($inlineAddOption) {
$value = postvalue("value_Type_" . $id);
$type = postvalue("type_Type_" . $id);
if (FieldSubmitted("Type_" . $id)) {
$value = prepare_for_db("Type", $value, $type);
} else {
$value = false;
}
if (!($value === false)) {
if (0 && "Type" == "Password" && $url_page == "admin_users_") {
$value = md5($value);
}
$avalues["Type"] = $value;
}
}
// processibng Type - end
$failed_inline_add = false;
// add filenames to values
foreach ($afilename_values as $akey => $value) {
$avalues[$akey] = $value;
示例9: MakeDBValue
/**
* @param String field
* @param Mixed value
* @param String controltype (optional)
* @param Boolean phpEncryptionOnly (optional)
*/
public function MakeDBValue($field, $value, $controltype = "", $phpEncryptionOnly = false)
{
$ret = prepare_for_db($field, $value, $controltype, "", $this->strTableName);
if ($ret === false) {
return $ret;
}
$ret = add_db_quotes($field, $this->EncryptField($field, $ret), $this->strTableName);
if ($phpEncryptionOnly) {
return $ret;
}
return $this->EncryptValueByDB($field, $ret);
}
示例10: getDateSliderWhere
/**
* Get the date slider's where
* @return string
*/
static function getDateSliderWhere($fName, $pSet, $cipherer, $table, $SearchFor, $SearchFor2, $strSearchOption, $fullFieldName)
{
$firstDelimPos = strpos($SearchFor, "-");
$lastDelimPos = strrpos($SearchFor, "-");
if ($firstDelimPos === FALSE || $firstDelimPos == $lastDelimPos) {
return "";
}
$stepType = $pSet->getFilterStepType($fName);
$timeValueEnvolved = false;
if ($stepType == FSST_SECONDS || $stepType == FSST_MINUTES || $stepType == FSST_HOURS) {
$timeValueEnvolved = true;
}
$value1 = $cipherer->MakeDBValue($fName, $SearchFor, "", true);
switch ($strSearchOption) {
case "slider":
$firstDelimPos = strpos($SearchFor2, "-");
$lastDelimPos = strrpos($SearchFor2, "-");
if ($firstDelimPos === FALSE || $firstDelimPos == $lastDelimPos) {
return "";
}
$cleanvalue2 = prepare_for_db($fName, $SearchFor2, "");
$timeArr = db2time($cleanvalue2);
if (!$timeValueEnvolved) {
// for dates without time, add one day
$timeArr = adddays($timeArr, 1);
$value2 = $timeArr[0] . "-" . $timeArr[1] . "-" . $timeArr[2];
} else {
if ($stepType == FSST_SECONDS) {
$timeArr = addSeconds($timeArr, 1);
} else {
$timeArr = addMinutes($timeArr, 1);
}
$dateString = $timeArr[0] . "-" . $timeArr[1] . "-" . $timeArr[2];
$hours = $timeArr[3] < 10 ? '0' . $timeArr[3] : $timeArr[3];
$minutes = $timeArr[4] < 10 ? '0' . $timeArr[4] : $timeArr[4];
$seconds = $timeArr[5] < 10 ? '0' . $timeArr[5] : $timeArr[5];
$timeString = $hours . ":" . $minutes . ":" . $seconds;
$value2 = $dateString . " " . $timeString;
}
$value2 = add_db_quotes($fName, $value2, $table);
return $fullFieldName . ">=" . $value1 . " and " . $fullFieldName . "<" . $value2;
case 'moreequal':
return $fullFieldName . ">=" . $value1;
case 'lessequal':
return $fullFieldName . "<=" . $value1;
default:
return "";
}
}
示例11: whereAdd
$strWhereClause = whereAdd($strWhereClause, KeyWhere($keys));
$oldValuesRead = false;
if ($eventObj->exists("AfterEdit") || $eventObj->exists("BeforeEdit") || $auditObj) {
// read old values
$rsold = db_query(gSQLWhere($strWhereClause), $conn);
$dataold = db_fetch_array($rsold);
$oldValuesRead = true;
}
$evalues = $efilename_values = $blobfields = array();
// processing Condition - begin
$condition = 1;
if ($condition) {
$value = postvalue("value_Condition_" . $id);
$type = postvalue("type_Condition_" . $id);
if (FieldSubmitted("Condition_" . $id)) {
$value = prepare_for_db("Condition", $value, $type);
} else {
$value = false;
}
if ($value !== false) {
if (0 && "Condition" == "Password" && $url_page == "admin_users_") {
$value = md5($value);
}
$evalues["Condition"] = $value;
}
}
// processing Condition - end
foreach ($efilename_values as $ekey => $value) {
$evalues[$ekey] = $value;
}
if ($pageObject->lockingObj) {
示例12: PrepareForDB
function PrepareForDB($field, $value, $controltype = ""){
return $this->EncryptValueByDB($field, $this->EncryptField($field, prepare_for_db($field, $value, $controltype, "", $this->strTableName)));
}
示例13: postvalue
}
// processing write_date - end
// processing write_uid - start
$inlineAddOption = true;
if ($inlineAddOption) {
$control_write_uid = $pageObject->getControl("write_uid", $id);
$control_write_uid->readWebValue($avalues, $blobfields, "", false, $afilename_values);
}
// processing write_uid - end
// insert masterkey value if exists and if not specified
if (@$_SESSION[$sessionPrefix . "_mastertable"] == "pad.pad_customer") {
if (postvalue("masterkey1")) {
$_SESSION[$sessionPrefix . "_masterkey1"] = postvalue("masterkey1");
}
if ($avalues["customer_id"] == "") {
$avalues["customer_id"] = prepare_for_db("customer_id", $_SESSION[$sessionPrefix . "_masterkey1"]);
}
}
$failed_inline_add = false;
// add filenames to values
foreach ($afilename_values as $akey => $value) {
$avalues[$akey] = $value;
}
// before Add event
$retval = true;
if ($eventObj->exists("BeforeAdd")) {
$retval = $eventObj->BeforeAdd($avalues, $usermessage, (bool) $inlineadd, $pageObject);
}
if ($retval && $pageObject->isCaptchaOk) {
//add or set updated lat-lng values for all map fileds with 'UpdateLatLng' ticked
setUpdatedLatLng($avalues, $pageObject->cipherer->pSet);
示例14: make_db_value
function make_db_value($field, $value, $controltype = "", $postfilename = "", $table = "")
{
$ret = prepare_for_db($field, $value, $controltype, $postfilename, $table);
if ($ret === false) {
return $ret;
}
return add_db_quotes($field, $ret, $table);
}
示例15: postvalue
}
}
if (@$_SESSION[$sessionPrefix . "_mastertable"] == "dbo.LU_Module Status") {
if (postvalue("masterkey1")) {
$_SESSION[$sessionPrefix . "_masterkey1"] = postvalue("masterkey1");
}
if ($avalues["Module Status"] == "") {
$avalues["Module Status"] = prepare_for_db("Module Status", $_SESSION[$sessionPrefix . "_masterkey1"]);
}
}
if (@$_SESSION[$sessionPrefix . "_mastertable"] == "dbo.LU_Module Type") {
if (postvalue("masterkey1")) {
$_SESSION[$sessionPrefix . "_masterkey1"] = postvalue("masterkey1");
}
if ($avalues["Module Type"] == "") {
$avalues["Module Type"] = prepare_for_db("Module Type", $_SESSION[$sessionPrefix . "_masterkey1"]);
}
}
$failed_inline_add = false;
// add filenames to values
foreach ($afilename_values as $akey => $value) {
$avalues[$akey] = $value;
}
// before Add event
$retval = true;
if ($eventObj->exists("BeforeAdd")) {
$retval = $eventObj->BeforeAdd($avalues, $usermessage, (bool) $inlineadd);
}
if ($retval && $pageObject->isCaptchaOk) {
$_SESSION[$strTableName . "_count_captcha"] = $_SESSION[$strTableName . "_count_captcha"] + 1;
if (DoInsertRecord($strOriginalTableName, $avalues, $blobfields, $id, $pageObject)) {