PHP User::GetByField Examples

PHP User::GetByField - 4 examples found. These are the top rated real world PHP examples of User::GetByField extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 public static function RegisterUser($SteamID, $IP)
 {
     $AuthHash = md5(rand()) . md5(rand());
     $SteamID = Database::Escape($SteamID);
     $IP = Database::Escape($IP);
     Database::Query("INSERT INTO `gmd_users` VALUES (NULL, '%s', '%s', '%s', 0, 0.0);", $AuthHash, $SteamID, $IP);
     return User::GetByField("User", "SteamID", $SteamID);
 }
Example #2
0
 static function LoadPage($PageName, $Wrapper = true)
 {
     if (KERNEL::IsValidPage($PageName) == false) {
         KERNEL::OnError("Attempt to load invalid page '" . $PageName . "'");
     }
     if (!is_null(KERNEL::$Pages[$PageName][2])) {
         $Result = call_user_func(KERNEL::$Pages[$PageName][2]);
         if ($Result !== true) {
             KERNEL::OnError("Access Denied - " . $Result);
             die("");
             // Force cancel just incase
         }
     }
     if ($Wrapper) {
         global $GMDConfig;
         $OpenID = new LightOpenID($GMDConfig["Domain"]);
         if ($OpenID->validate()) {
             $ID = $OpenID->identity;
             $URL_Parts = explode("/", $ID);
             // Get their SteamID
             $CommunityID = $URL_Parts[sizeof($URL_Parts) - 1];
             $SteamID = CommunityToSteam($CommunityID);
             // Try and authenticate them
             $User = User::GetByField("User", "SteamID", $SteamID);
             if ($User->IsReal()) {
                 $User->AuthToUser();
             } else {
                 User::RegisterUser($SteamID, $_SERVER['REMOTE_ADDR'])->AuthToUser();
             }
             KERNEL::HardNavigate("home");
         } elseif ($_GET["page"] == "login") {
             if (User::$ActiveUser != false) {
                 if (isset($_GET["logout"])) {
                     User::Logout();
                 }
                 KERNEL::HardNavigate("home");
             } else {
                 $OpenID->identity = 'http://steamcommunity.com/openid';
                 header('Location: ' . $OpenID->authUrl());
             }
         }
         LightOpenID::revalidate();
     }
     global $OutputData;
     $OutputData = "";
     if ($Wrapper) {
         require "includes/util/header.php";
     }
     require "pages/" . $PageName . "/_process.php";
     require "pages/" . $PageName . "/_display.php";
     echo $OutputData;
     if ($Wrapper) {
         require "includes/util/footer.php";
     }
 }
Example #3
0
<?php

if (isset($_POST["sendCredits"]) && Setting::QuickValue("credittransfer") == true) {
    $Amount = intval(str_replace("\$", "", $_POST["amount"]));
    $ToSteam = $_POST["toSteam"];
    if ($Amount == null || 0 >= $Amount || $Amount > User::$ActiveUser->GetValue("Credit")) {
        echo '
				<div class="alert alert-danger" role="alert">
					There was an error trying to transfer those credits...
				</div>
			';
    } else {
        $ToUser = User::GetByField("User", "SteamID", $ToSteam);
        if (!isset($ToUser) || !$ToUser->IsReal()) {
            echo '
					<div class="alert alert-danger" role="alert">
						No user was found with that SteamID!
					</div>
				';
        } else {
            User::$ActiveUser->AddCredit(-1 * $Amount);
            $ToUser->AddCredit($Amount);
            echo '
					<div class="alert alert-success" role="alert">
						Sent $' . number_format($Amount, 2) . ' to SteamID ' . $ToSteam . '
					</div>
				';
        }
    }
}
Example #4
0
 $receiver_email = $_POST['receiver_email'];
 $payer_email = $_POST['payer_email'];
 $custom = $_POST['custom'];
 /* MAKE SURE THEY ARENT TRYING ANYTHING TRICKY */
 if ($payment_currency != $Currency) {
     die("");
     // Bad currency..
 } elseif ($receiver_email != $Email) {
     die("");
     // Bad receiver email..
 } elseif ($payment_status != "Completed") {
     die("");
     // Transaction not complete
 }
 /* Fetch the User Account */
 $User = User::GetByField("User", "SteamID", $custom);
 if ($User == false || $User->IsReal() == false) {
     // They don't have an account.. wtf, lets make one to be safe
     $User = User::RegisterUser($custom, "0.0.0.0");
 }
 /* MAKE SURE THEY DIDNT ALREADY GET THEIR SHIT */
 $Donation = Donation::GetByField("Donation", "TransactionID", $txn_id);
 if ($Donation->IsReal() == true) {
     die("");
     // They already got their shit
 }
 /* GIVE THEM THEIR SHIT */
 $time = time();
 $uid = $User->Data["ID"];
 $User->ChangeValue("Credit", $User->Data["Credit"] + $payment_amount);
 Database::Query("INSERT INTO `gmd_donations` VALUES ( NULL, 1, '{$txn_id}', '{$custom}', '{$payer_email}', '{$first_name}', '{$last_name}', {$time}, {$payment_amount}, '{$payment_currency}' );");