- Joined
- Aug 14, 2009
- Messages
- 2,304
- Reaction score
- 1,189
-- update session key/id
declare [USER=2000045131]Session[/USER]Key varchar(50) = NEWID()
declare [USER=2000045131]Session[/USER]ID int = checksum [USER=2000045131]Session[/USER]Key)
if exists (SELECT CustomerID FROM LoginSessions WHERE CustomerID = [USER=25895]Custom[/USER]erID)
begin
UPDATE LoginSessions SET
SessionKey [USER=2000045131]Session[/USER]Key,
SessionID [USER=2000045131]Session[/USER]ID,
LoginIP=@in_IP,
TimeLogged=GETDATE(),
TimeUpdated=GETDATE()
WHERE CustomerID [USER=25895]Custom[/USER]erID
end
else
begin
INSERT INTO LoginSessions
(CustomerID, SessionKey, SessionID, LoginIP, TimeLogged, TimeUpdated)
VALUES
[USER=25895]Custom[/USER]erID, [USER=2000045131]Session[/USER]Key, [USER=2000045131]Session[/USER]ID, @in_IP, GETDATE(), GETDATE())
end
-- update session key/id
declare [B]@[/B]SessionKey varchar(50) = NEWID()
declare [B]@[/B]SessionID int = checksum [B]@[/B]SessionKey)
if exists (SELECT CustomerID FROM LoginSessions WHERE CustomerID = [B]@[/B]CustomerID)
begin
UPDATE LoginSessions SET
SessionKey [B]@[/B]SessionKey,
SessionID [B]@[/B]SessionID,
LoginIP=@in_IP,
TimeLogged=GETDATE(),
TimeUpdated=GETDATE()
WHERE CustomerID [B]@[/B]CustomerID
end
else
begin
INSERT INTO LoginSessions
(CustomerID, SessionKey, SessionID, LoginIP, TimeLogged, TimeUpdated)
VALUES
[B]@[/B]CustomerID, [B]@[/B]SessionKey, [B]@[/B]SessionID, @in_IP, GETDATE(), GETDATE())
end
blocks.