本文整理汇总了PHP中ValidVar函数的典型用法代码示例。如果您正苦于以下问题:PHP ValidVar函数的具体用法?PHP ValidVar怎么用?PHP ValidVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ValidVar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckSettings
function CheckSettings()
{
global $DbHost, $DbPort, $DbName, $DbUser, $DbPass, $DbPref, $UpdateNeeded;
global $Errors, $Lang, $CLang;
$DbHost1 = $DbPort ? $DbHost . ":" . $DbPort : $DbHost;
$ID = @mysql_connect($DbHost1, $DbUser, $DbPass);
if (!$ID) {
$Errors[] = $Lang['ConnectFailed'];
return false;
}
$SelectRes = @mysql_select_db($DbName, $ID);
if (!$SelectRes) {
$Errors[] = $Lang['SelectFailed'];
return false;
}
$Query = "SELECT * FROM " . $DbPref . "_system_product";
$SelectRes = mysql_query($Query);
if ($SelectRes) {
$Check = mysql_fetch_row($SelectRes);
if (ValidVar($Check[0]) || !mysql_error()) {
$Errors[] = $Lang['PfxAlreadyExists'];
$UpdateNeeded = true;
return false;
}
}
NextStep();
}
示例2: TrackerConsult
function TrackerConsult()
{
global $nsUser;
if (!$nsUser->Logged() || !ValidVar($nsUser->HELP_MODE) || $nsUser->HELP_MODE == 0) {
$this->UseConsult = false;
return false;
}
$this->CurrentHelp = "default";
$this->UseConsult = true;
$this->Display = "none";
global $_GP, $Db;
$DisableContext = ValidVar($_GP['DisableContext']) ? true : false;
$DisableHelp = ValidVar($_GP['DisableHelp']) ? true : false;
if ($DisableContext) {
$Query = "UPDATE " . PFX . "_tracker_user_settings SET HELP_MODE='0' WHERE USER_ID=" . $nsUser->UserId();
$Db->Query($Query);
$this->UseConsult = false;
$nsUser->HELP_MODE = 0;
}
if ($DisableHelp) {
$Query = "UPDATE " . PFX . "_tracker_user_settings SET HELP_MODE='1' WHERE USER_ID=" . $nsUser->UserId();
$Db->Query($Query);
$nsUser->HELP_MODE = 1;
}
}
示例3: SaveSplitToFile
function SaveSplitToFile($Id = false, $Filename, $SplitId = false)
{
global $Db;
if (!$Id && !$SplitId) {
return false;
}
$UseStore = $Db->ReturnValue("SELECT USE_STORE FROM " . PFX . "_tracker_config WHERE COMPANY_ID=0");
if (!$UseStore) {
return true;
}
if (!$SplitId) {
$SplitId = $Db->ReturnValue("SELECT ID FROM " . PFX . "_tracker_split_test WHERE SUB_ID={$Id}");
}
$Query = "\n\t\tSELECT SP.FULL_PATH AS PAGE_PATH\n\t\t\tFROM " . PFX . "_tracker_split_page SP\n\t\t\tINNER JOIN " . PFX . "_tracker_site_page SPA\n\t\t\t\tON SPA.ID=SP.PAGE_ID\n\t\t\tINNER JOIN " . PFX . "_tracker_site S\n\t\t\t\tON S.ID=SPA.SITE_ID\n\t\t\tLEFT JOIN " . PFX . "_tracker_query Q\n\t\t\t\tON Q.ID=SP.QUERY_ID\n\t\t\tWHERE SP.SPLIT_ID={$SplitId}\n\t\t";
$Sql = new Query($Query, "ARR");
$PageArr = array();
while ($Row = $Sql->Row()) {
if (!ValidVar($Row['HOST'])) {
continue;
}
if (!$Row['PAGE_PATH']) {
$Row['PAGE_PATH'] = "http://" . $Row['HOST'] . $Row['PATH'];
if ($Row['QUERY_STRING']) {
$Row['PAGE_PATH'] .= "?" . $Row['QUERY_STRING'];
}
}
$PageArr[] = $Row['PAGE_PATH'];
}
if (!ValidArr($PageArr) || count($PageArr) < 1) {
return false;
}
@clearstatcache();
$f = @fopen("store/{$Filename}", "a+");
if (!@is_writable("store/{$Filename}")) {
return false;
}
if (!$f) {
return false;
}
$Data = @fread($f, @filesize("store/{$Filename}"));
if (!$Data) {
$DataArr[$SplitId] = $PageArr;
} else {
$DataArr = @unserialize($Data);
if (!ValidArr($DataArr)) {
$DataArr = array();
}
$DataArr[$SplitId] = $PageArr;
}
$Data = @serialize($DataArr);
@flock($f, LOCK_EX);
@ftruncate($f, 0);
if (!@fwrite($f, $Data)) {
return false;
}
@flock($f, LOCK_UN);
@fclose($f);
return true;
}
示例4: SendP3P
function SendP3P()
{
$this->P3PSent = true;
$Str = GetParam("P3P", "STRVAL");
$Ref = GetParam("P3P_REF", "STRVAL");
if (!ValidVar($Str)) {
return;
}
if (ValidVar($Ref)) {
$Ref = "policyref=\"{$Ref}\", ";
} else {
$Ref = "";
}
Header("P3P: {$Ref} CP=\"{$Str}\"");
}
示例5: CheckCompany
function CheckCompany()
{
global $CompName, $CompDescr, $SiteDomain;
global $Errors, $Lang;
if (!$CompName) {
$Errors[] = $Lang['MustFillCompanyName'];
return;
}
if (!$SiteDomain) {
$Errors[] = $Lang['MustFillDomain'];
return;
}
if (!ValidHost($SiteDomain)) {
$Errors[] = $Lang['DomainIncorrect'];
return;
}
$Check = @parse_url($SiteDomain);
if (is_array($Check) && ValidVar($Check['scheme'])) {
$Host = str_replace($Check['scheme'] . "://", "", $SiteDomain);
}
NextStep();
}
示例6: ExportCsv
function ExportCsv($DataArr, $Separator = ";", $NamesArr = false, $Expanded = false)
{
$Export = "";
if (ValidArr($NamesArr)) {
foreach ($NamesArr as $i => $Row) {
$NamesArr[$i] = CsvPrepare($NamesArr[$i], $Separator);
}
$Export .= implode($Separator, $NamesArr);
$Export .= "\n";
}
foreach ($DataArr as $i => $Row) {
$TmpArr = array();
foreach ($NamesArr as $Key => $SubRow) {
$Str = "";
$KeyArr = array();
$KeyArr = explode("|", $Key);
if (!$Expanded) {
$KeyArr = array_slice($KeyArr, 0, 1);
}
for ($z = 0; $z < count($KeyArr); $z++) {
if (!ValidVar($KeyArr[$z])) {
continue;
}
if ($z > 0) {
$Str .= " (";
}
$Str .= $Row[$KeyArr[$z]];
if ($z > 0) {
$Str .= ")";
}
}
$TmpArr[] = CsvPrepare($Str, $Separator);
}
$Export .= implode($Separator, $TmpArr);
$Export .= "\n";
}
return $Export;
}
示例7: ShowCost
<td class="ReportSimpleTd" height="23" ID="Income_<?php
echo $Row['Position'];
?>
" onmouseover="HighLightRow('Income', <?php
echo $Row['Position'];
?>
);" onmouseout="RemoveLight('Income',<?php
echo $Row['Position'];
?>
);" onclick="CheckRowCol('Income',<?php
echo $Row['Position'];
?>
);" >
<p class=ReportColumn><B>
<?php
if (ValidVar($Row['TotalIncome'])) {
echo ShowCost($Row['TotalIncome'], $CurrentCompany->CUR);
}
?>
</B><br><span class="ReportSubColumn"> </span></p>
</td>
<?php
}
?>
<?php
if ($nsUser->Columns->ACTIONS && $nsUser->Columns->CONVERSIONS) {
?>
示例8: ValidVar
}
?>
<tr><td class=ReportSimpleTd2>
<input type=checkbox value=1 ID="AddToMy" name="SaveReport[AddToMy]" <?php
echo ValidVar($SaveReport['AddToMy']) == 1 ? "checked" : "";
?>
><label for="AddToMy"> <?php
echo $Lang['AddToMy'];
?>
</label>
</td></tr>
<tr><td class=ReportSimpleTd2>
<input type=text size=30 name="SaveReport[Name]" value="<?php
echo htmlspecialchars(stripslashes(ValidVar($SaveReport['Name'])));
?>
"> <?php
echo $Lang['ReportName'];
?>
</td></tr>
<tr><td class=ReportSimpleTd2>
<input type=submit value="<?php
echo $Lang['Save'];
?>
">
</td></tr>
</form>
</table>
示例9: SaveUserReport
function SaveUserReport(&$Id, $Arr)
{
global $Db, $Logs, $Lang;
extract($Arr);
$Name = addslashes(trim(ValidVar($Name)));
if (!$Name) {
$Logs->Err($Lang['MustFillName']);
return;
}
$Query = "UPDATE " . PFX . "_tracker_user_report SET NAME='{$Name}' WHERE ID={$Id}";
$Db->Query($Query);
$Id = false;
$Logs->Msg($Lang['RecordUpdated']);
}
示例10: UpdateUser
//.........这里部分代码省略.........
if (!$Email) {
$ErrArr['Email'] = $Lang['MustFill'];
}
if (!$Login) {
$ErrArr['Login'] = $Lang['MustFill'];
}
if (strlen($Login) < 3) {
$ErrArr['Login'] = $Lang['LoginTooShort'];
}
if (strlen($Login) > 64) {
$ErrArr['Login'] = $Lang['LoginTooLong'];
}
if (!$Company) {
$ErrArr['Company'] = $Lang['CompanyRequired'];
}
if ($Pass) {
if (strlen($Pass) < 3) {
$ErrArr['Pass'] = $Lang['PassTooShort'];
}
if (strlen($Pass) > 64) {
$ErrArr['Pass'] = $Lang['PassTooLong'];
}
if ($Pass != $Pass2) {
$ErrArr['Pass2'] = $Lang['PassNotPass2'];
}
if (CheckSymb_($Pass)) {
$ErrArr['Pass'] = $Lang['SymbErr'];
}
}
if ($Login != $EditUser->LOGIN) {
$Query = "SELECT ID FROM " . PFX . "_system_user WHERE LOGIN = '{$Login}'";
$Check = $Db->Select($Query);
if (isset($Check->ID) && ValidId($Check->ID)) {
$ErrArr['Login'] = $Lang['LoginExists'];
}
}
if (isset($ErrArr)) {
$Logs->Err($Lang['FormErr']);
$GLOBALS['ErrArr'] = $ErrArr;
return;
}
if (!$nsUser->ADMIN) {
$Company = $nsUser->COMPANY_ID;
}
if (!$nsUser->ADMIN && !$nsUser->SUPER_USER) {
$Super = 0;
}
if ($nsProduct->LICENSE == 2) {
$Company = $CurrentCompany->ID;
}
if ($nsProduct->LICENSE != 3 || !$nsUser->ADMIN && !$nsUser->SUPER_USER) {
$Demo = $EditUser->DEMO;
}
$Query = "UPDATE " . PFX . "_system_user SET LOGIN = ? , NAME = ?, EMAIL = ? WHERE ID = {$Id}";
$Db->Query($Query, $Login, $Name, $Email);
$Query = "UPDATE " . PFX . "_tracker_user SET COMPANY_ID = {$Company} WHERE ID = " . $EditUser->MERCH_ID;
$Db->Query($Query);
if ($nsUser->UserId() != $EditUser->ID) {
$Query = "UPDATE " . PFX . "_tracker_user SET SUPER_USER = '{$Super}', DEMO='{$Demo}' WHERE ID = " . $EditUser->MERCH_ID;
$Db->Query($Query);
}
if ($Pass) {
$Query = "UPDATE " . PFX . "_system_user SET PWD = '" . md5($Pass) . "' WHERE ID = {$Id}";
$Db->Query($Query);
if ($Id == $nsUser->UserId()) {
$nsUser->Login($nsUser->UserInfo['LOGIN'], $Pass, ValidVar($_COOKIE[COOKIE_PFX . 'pwd']));
}
}
if ($Id == $nsUser->UserId()) {
if (ValidVar($DefSkin)) {
if ($nsUser->USKIN) {
$Query = "UPDATE " . PFX . "_system_user2skin SET SKIN='{$DefSkin}' WHERE UID={$Id} AND PROD_ID=" . $nsProduct->ID . "";
} else {
$Query = "INSERT INTO " . PFX . "_system_user2skin (UID, PROD_ID, SKIN) VALUES ({$Id}, " . $nsProduct->ID . ", '{$DefSkin}')";
}
$Db->Query($Query);
}
if (ValidVar($DefLang)) {
if ($nsUser->ULANG) {
$Query = "UPDATE " . PFX . "_system_user2lang SET LANG= '{$DefLang}' WHERE UID={$Id} AND PROD_ID=" . $nsProduct->ID . "";
} else {
$Query = "INSERT INTO " . PFX . "_system_user2lang (UID, PROD_ID, LANG) VALUES ({$Id}, " . $nsProduct->ID . ", '{$DefLang}')";
}
$Db->Query($Query);
}
$Query = "UPDATE " . PFX . "_tracker_user_column SET HITS='{$ColHits}', SALES='{$ColSales}', ACTIONS='{$ColActions}', CLICKS='{$ColClicks}', ROI='{$ColROI}', CONVERSIONS='{$ColConv}', GRAPHS='{$Graphs}' WHERE USER_ID={$Id}";
$Db->Query($Query);
$Query = "UPDATE " . PFX . "_tracker_user_settings SET ADVANCED_MODE='{$AdvMode}', HELP_MODE='{$HelpMode}', TIMEZONE='{$TZ}', PAGE_ENCODING = '{$Enc}' WHERE USER_ID={$Id}";
$Db->Query($Query);
}
if (ValidVar($Ignore)) {
$nsUser->SetCookie(COOKIE_PFX . 'skip', "1", time() + 60 * 60 * 24 * 10 * 365, "/");
} else {
$nsUser->SetCookie(COOKIE_PFX . 'skip', "", time() - 100, "/");
}
if (!$nsUser->ADMIN && !$nsUser->SUPER_USER) {
$nsProduct->Redir("users", "RUpd=1&EditUid={$Id}");
}
$nsProduct->Redir("users", "RUpd=1");
}
示例11: ShowCost
function ShowCost($Value = 0, $Arr = false)
{
global $CurrentCompany;
if (!$Arr) {
$Arr = ValidVar($CurrentCompany->CUR);
}
if (!$Arr || !$Arr[0] || !$Value) {
return $Value;
}
if ($Arr[1] == 0) {
return $Arr[0] . $Value;
}
if ($Arr[1] == 1) {
return $Value . $Arr[0];
}
}
示例12: GetFORM
<?php
GetFORM();
?>
<input type=hidden name=HostId value=<?php
echo $HostId;
?>
>
<input type=hidden name=EditId value=<?php
echo $EditId;
?>
>
<?php
echo $Lang['Template'];
?>
: <input type=text name="Templ" value="<?php
echo ValidVar($Templ) ? $Templ : "";
?>
"> <input type=submit value="<?php
echo $Lang['Search'];
?>
">
</form>
</td></tr>
<tr><td colspan=2>
<?php
echo $Pages->Dump();
?>
</td></tr>
<?php
示例13:
}
}
if ($WhereArr[$i]['Mode'] == "Pixel") {
$WhereArr[$i]['Name'] = $Lang['ByPixel'];
$MetaTitle .= ": " . $Lang['ByPixel'];
if (ValidVar($WhereArr[$i]['Id'])) {
$WhereArr[$i]['Name2'] = $WhereArr[$i]['Id'] != "-1" ? $WhereArr[$i]['Id'] : $Lang['Undefined'];
$MetaTitle .= ": " . ($WhereArr[$i]['Id'] != "-1" ? $WhereArr[$i]['Id'] : $Lang['Undefined']);
$Report->WhereArr[] = "V.PIXEL_DEPTH='" . $WhereArr[$i]['Id'] . "'";
$Report->JoinArr[] = "INNER JOIN " . PFX . "_tracker_visitor V ON V.ID=S_LOG.VISITOR_ID";
}
}
if ($WhereArr[$i]['Mode'] == "Flash") {
$WhereArr[$i]['Name'] = $Lang['ByFlash'];
$MetaTitle .= ": " . $Lang['ByFlash'];
if (ValidVar($WhereArr[$i]['Id'])) {
$WhereArr[$i]['Name2'] = $WhereArr[$i]['Id'] != "-1" ? $WhereArr[$i]['Id'] : $Lang['None'];
$MetaTitle .= ": " . ($WhereArr[$i]['Id'] != "-1" ? $WhereArr[$i]['Id'] : $Lang['None']);
$Report->WhereArr[] = "V.FLASH_VERSION='" . $WhereArr[$i]['Id'] . "'";
$Report->JoinArr[] = "INNER JOIN " . PFX . "_tracker_visitor V ON V.ID=S_LOG.VISITOR_ID";
}
}
$Get .= "&WhereArr[{$i}][Mode]=" . $WhereArr[$i]['Mode'];
$Get .= "&WhereArr[{$i}][Id]=" . $WhereArr[$i]['Id'];
if (ValidVar($WhereArr[$i]['OrderTo'])) {
$Get .= "&WhereArr[{$i}][OrderTo]=" . $WhereArr[$i]['OrderTo'];
}
if (ValidVar($WhereArr[$i]['OrderBy'])) {
$Get .= "&WhereArr[{$i}][OrderBy]=" . $WhereArr[$i]['OrderBy'];
}
}
示例14: UpdateAction
function UpdateAction($Arr, $Id = false)
{
global $Db, $Logs, $nsProduct, $HostsArr, $SiteId, $CpId, $Site, $Lang;
$TPath = "";
$ActionPath = "";
$CodeAction = 0;
$SiteHostId = 0;
extract($Arr);
if (!ValidVar($Name)) {
$Logs->Err($Lang['MustFillName']);
return;
}
if (!ValidVar($Templ) && ValidVar($RedirOnly) != 2) {
$Logs->Err($Lang['WhatIsAction']);
return;
}
if (ValidVar($RedirOnly) == 1 && !ValidVar($RedirUrl) && !ValidVar($Dynamic)) {
$Logs->Err($Lang['RedirUrlRequired']);
return;
}
if (!ValidVar($Active)) {
$Active = 0;
}
if (ValidVar($RedirOnly) == 2) {
$CodeAction = 1;
}
if (!$CodeAction) {
$TmpArr = explode("{a}", $Templ);
if (ValidArr($TmpArr) && count($TmpArr) > 2) {
$Logs->Err($Lang['OnlyOneActionTarget']);
return;
}
$NoPage = false;
$TArr = @parse_url($Templ);
if (!$TArr) {
$Logs->Err($Lang['UnableParseTemplate']);
return;
}
if (isset($TArr['path']) && !isset($TArr['host'])) {
//$Path=ToLower($TArr['path']);
for ($i = 0; $i < count($HostsArr); $i++) {
if (strpos($Path, $HostsArr[$i]) !== false) {
$Path = str_replace($HostsArr[$i], "", $Path);
$TArr['host'] = $HostsArr[$i];
$TArr['path'] = $Path;
break;
}
}
}
if (count($TArr) == 1 && substr(ValidVar($TArr['path']), 0, 1) != "/") {
if (isset($TArr['path']) && !isset($TArr['query'])) {
$TArr['query'] = $TArr['path'];
}
unset($TArr['path']);
$NoPage = 1;
}
if (isset($TArr['fragment'])) {
unset($TArr['fragment']);
}
if (!$NoPage) {
if (!isset($TArr['host'])) {
$TArr['host'] = $Site->HOST;
}
$TArr['host'] = ToLower($TArr['host']);
//if (isset($TArr['path'])&&isset($TArr['query'])&&!isset($TArr['host'])) $TArr['host']=$Site->HOST;
if (isset($TArr['path']) && substr($TArr['path'], 0, 1) != "/") {
$TArr['path'] = "/" . $TArr['path'];
}
if (!ValidVar($TArr['host']) || !in_array($TArr['host'], $HostsArr)) {
//$Logs->Err($Lang['InvalidDomain']);return;
$Query = "INSERT INTO " . PFX . "_tracker_site_host (HOST, SITE_ID) VALUES (?, " . $Site->ID . ")";
$Db->Query($Query, $TArr['host']);
$NewHostId = $Db->LastInsertId;
$HostsArr[] = $TArr['host'];
$Site->Hosts[$NewHostId] = $TArr['host'];
}
if (!ValidVar($TArr['path'])) {
$TArr['path'] = "/";
}
if (strpos($TArr['path'], "*") === false && strpos($TArr['path'], "{a}") === false && strpos($TArr['path'], ".") === false && $TArr['path'] != "/" && substr($TArr['path'], -1) != "/") {
$TArr['path'] .= "/";
}
extract($TArr);
foreach ($Site->Hosts as $SHId => $SHost) {
if ($host == $SHost) {
$SiteHostId = $SHId;
}
}
if (strpos($path, "*") === false && strpos($path, "{a}") === false) {
$Query = "SELECT ID FROM " . PFX . "_tracker_site_page WHERE SITE_ID={$SiteId} AND PATH='{$path}'";
$PageId = $Db->ReturnValue($Query);
if (!ValidId($PageId)) {
$Query = "INSERT INTO " . PFX . "_tracker_site_page (SITE_ID, PATH) VALUES ({$SiteId}, '{$path}')";
$Db->Query($Query);
$PageId = $Db->LastInsertId;
}
$ActionPath = $path;
if (!ValidId($PageId)) {
$Logs->Err($Lang['UnableCreatePage']);
return;
//.........这里部分代码省略.........
示例15: getURL
$nsLang->TplInc("inc/user_welcome");
$ProgPath[0]['Name'] = $Lang['Administr'];
$ProgPath[0]['Url'] = getURL("admin", "", "admin");
$ProgPath[1]['Name'] = $PageTitle;
$ProgPath[1]['Url'] = getURL("base_stat", "", "admin");
$MenuSection = "admin";
$DoOptimize = ValidVar($_GP['DoOptimize']) ? true : false;
$EndDate = ValidDate($_GP['EndDate']) ? $_GP['EndDate'] : false;
$DoClear = ValidVar($_GP['DoClear']) ? true : false;
$ForClient = ValidId($_GP['ForClient']) ? $_GP['ForClient'] : false;
$SiteId = ValidId($_GP['SiteId']) ? $_GP['SiteId'] : false;
$EndTime = false;
if ($EndDate) {
$EndTime = $EndDate . " 23:59:59";
}
if (!$ForClient && ValidVar($_GP['ForClient']) != "all" && ValidId($CurrentCompany->ID)) {
$ForClient = $CurrentCompany->ID;
}
$ClientsArr = array();
$StatLogArr = array();
$ActionLogArr = array();
$SaleLogArr = array();
$SplitLogArr = array();
$UndefLogArr = array();
$ClickLogArr = array();
$Query = "SELECT C.ID, C.NAME, S.HOST, S.ID AS SITE_ID FROM " . PFX . "_tracker_client C INNER JOIN " . PFX . "_tracker_site S ON S.COMPANY_ID=C.ID ORDER BY C.NAME";
$Sql = new Query($Query);
while ($Row = $Sql->Row()) {
if (!$nsUser->ADMIN && $Row->ID != $nsUser->COMPANY_ID) {
continue;
}