本文整理汇总了PHP中Key::validKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Key::validKey方法的具体用法?PHP Key::validKey怎么用?PHP Key::validKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Key
的用法示例。
在下文中一共展示了Key::validKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Create
public static function Create($Key = 0, $Company = false)
{
$Return = false;
if ($Key !== 0) {
if (\Session::exists("refKey")) {
if (\Session::get("refKey") != $Key) {
//This computer has multiple Keys? I'm not sure how or why this would happen.
//It is a possibility so I guess I should probably plan for it
$SavedKey = new Key(\Session::get("refKey"));
if ($SavedKey->validKey()) {
//Has two valid keys? What on earth? I will have to account for this later
} else {
\Session::put("refKey", $Key);
$Return = true;
}
}
} else {
\Session::put("refKey", $Key);
$Return = true;
}
if (\Cookie::exists("refKey")) {
if (\Cookie::get("refKey") != $Key) {
$SavedKey = new Key(\Cookie::get("refKey"));
if ($SavedKey->validKey()) {
//Has two valid keys? What on earth? I will have to account for this later
} else {
\Cookie::put("refKey", $Key, \Config::get("tracking/cookie_expiry"));
$Return = true;
}
}
} else {
\Cookie::put("refKey", $Key, \Config::get("tracking/cookie_expiry"));
$Return = true;
}
if ($Company != false) {
if (count(\DB::getInstance()->table("companyip")->where("IP", \Connection::IP())->where("Company", $Company->ID())) == 0) {
\DB::getInstance()->table("companyip")->insert(array("IP" => \Connection::IP(), "Company" => $Company->ID(), "LastScene" => \Time::get(), "Hits" => 1));
} else {
\DB::getInstance()->table("companyip")->where("IP", \Connection::IP())->increment("Hits");
}
}
//IP Based Search will go here
return $Return;
}
return false;
}
示例2: __construct
public function __construct()
{
$this->IP = \Connection::IP();
//Allows for spoofing IP
$refKey = $this->getKey();
if ($refKey != false) {
$Key = new Key($refKey);
if ($Key->validKey($refKey)) {
$Company = $this->getCompany($Key);
Tracker::Create($refKey, $Company);
$this->Valid = true;
} else {
Tracker::Clear();
throw new \Exception("Key is Invalid");
}
} else {
throw new \Exception("No Key");
}
}