Skip to content

Instantly share code, notes, and snippets.

@ProtoJazz
Last active December 21, 2015 01:55
Show Gist options
  • Select an option

  • Save ProtoJazz/bb8a31119f2142fe8e61 to your computer and use it in GitHub Desktop.

Select an option

Save ProtoJazz/bb8a31119f2142fe8e61 to your computer and use it in GitHub Desktop.
list($SessionID, $UserID) = explode("|~|", $Enc->decrypt($LoginCookie));
$DB->query("
SELECT
SessionID,
Browser,
OperatingSystem,
IP,
LastUpdate,
i.AdminComment
FROM users_sessions
JOIN users_info AS i ON i.UserID = $UserID
WHERE SessionID = '$SessionID'");
list($ThisSessionID, $Browser, $OperatingSystem, $IP, $LastUpdate, $oldComment) = $DB->next_record();
$date = date('Y/m/d H:i:s');
$countryCode = Tools::geoip($IP);
$infoToAdd = $date . " - " . " User sent invite to " . $CurEmail . " from " . $IP . "(" . $countryCode . ")" . " using " . $Browser . "\n" . $infoDump;
$newComment = db_string($oldComment . " " . "\n" . $infoToAdd);
$DB->query("
INSERT INTO invites
(InviterID, InviteKey, Email, Expires, Reason)
VALUES
('$LoggedUser[ID]', '$InviteKey', '" . db_string($CurEmail) . "', '$InviteExpires', '$InviteReason')");
$DB->query("
UPDATE users_info
SET AdminComment ='$newComment'
WHERE UserID = '$LoggedUser[ID]'");
if (!check_perms('site_send_unlimited_invites')) {
$DB->query("
UPDATE users_main
SET Invites = GREATEST(Invites, 1) - 1
WHERE ID = '$LoggedUser[ID]'");
$Cache->begin_transaction('user_info_heavy_' . $LoggedUser['ID']);
$Cache->update_row(false, array('Invites' => '-1'));
$Cache->commit_transaction(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment