It is currently November 18, 2018, 07:53:33 PM




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
 More issues from my side =D (jscript this time) 
Author Message
Tester
User avatar

Joined: March 30, 2006, 07:13:19 PM
Posts: 2232
Location: Houten, Netherlands
Character: TrevoriuS
Clan: Dwarfhood
Post More issues from my side =D (jscript this time)
Well K-Zodron helped me out last time so maybe theres someone in here that knows this too :P
JSCRIPT knows the unload event. This works, when we unload a page (pressing F5 is enough to do that). What I want is to have an event when a page is absolutely closed (thus clicking the X on the browser window, or the tab). Still using JSCRIPT, how? ><
Code:
<script language="JavaScript" type="text/javascript">
function checkWin()
{
if( self.closed ){
   newwindow=window.open('http://trevorius.com/exit.php','Logout','height=150,width=250');
   if (window.focus) {newwindow.focus()}
   return false;
}
}
</script>
<body onUnload="checkWin();">

Thats what I currently use. The self.closed however, makes it no longer work. If I remove it, or say self.open, it will occur every time the page refreshes as well.

_________________
My fairly outdated portfolio
Art is about beauty, nor originality. If quality can't be indicated, it's not abstract nor original, its more likely bad.
Philosophy


December 29, 2007, 11:20:21 PM
Profile
Staff

Joined: July 27, 2006, 05:36:07 PM
Posts: 2053
Location: Papillion, NE
Character: Jason
Clan: Ironfist
Post Re: More issues from my side =D (jscript this time)
Man.. this is not the 1990's, people do not want to deal with that shit :P

Popups when exiting sites are EXTREMELY annoying (as well as music too...), I advise you to stop that idea :)

_________________
Jason » Website Administrator
Image


December 30, 2007, 03:50:16 AM
Profile
Tester
User avatar

Joined: March 30, 2006, 07:13:19 PM
Posts: 2232
Location: Houten, Netherlands
Character: TrevoriuS
Clan: Dwarfhood
Post Re: More issues from my side =D (jscript this time)
Well its like this:

You log in -> database says you logged in
You try to log in on same account -> database says you are already logged in
You logout -> database says you logged out
You close page without logging out -> database says you are logged in!
So now I want: you close page -> popup opens, logs out and closes itself again :P

_________________
My fairly outdated portfolio
Art is about beauty, nor originality. If quality can't be indicated, it's not abstract nor original, its more likely bad.
Philosophy


December 30, 2007, 03:50:27 PM
Profile
Tester

Joined: April 14, 2007, 07:21:32 PM
Posts: 2159
Clan: Order of the Beetle
Post Re: More issues from my side =D (jscript this time)
I'll suggest the same thing I suggested last time, K-Zodron is probably what you're looking for, I'm sure he'll help you out again.

_________________
OBA OBA OBA


December 30, 2007, 07:05:34 PM
Profile
Staff

Joined: July 27, 2006, 05:36:07 PM
Posts: 2053
Location: Papillion, NE
Character: Jason
Clan: Ironfist
Post Re: More issues from my side =D (jscript this time)
Just use sessions, they expire when the browser closes.. There is also no need to store whether you are or aren't logged in, in the database. Use a simple algorithm and detect the time their were last active, and only show users that were active in the last 15 minutes as "logged in".

_________________
Jason » Website Administrator
Image


December 30, 2007, 10:04:56 PM
Profile
Tester
User avatar

Joined: March 30, 2006, 07:13:19 PM
Posts: 2232
Location: Houten, Netherlands
Character: TrevoriuS
Clan: Dwarfhood
Post Re: More issues from my side =D (jscript this time)
Then you would need to wait 15 minutes anyways...
And if a session starts when I log in -> how will another guys computer know that the account he tries to login to(hacked or his own, I dont care) is already logged in?

_________________
My fairly outdated portfolio
Art is about beauty, nor originality. If quality can't be indicated, it's not abstract nor original, its more likely bad.
Philosophy


December 30, 2007, 10:34:53 PM
Profile
Tester
User avatar

Joined: May 19, 2007, 01:05:32 AM
Posts: 79
Location: Finland
Post Re: More issues from my side =D (jscript this time)
Why would he need to know :confused:

Code:
if(time() - player->GetLastLogin() < 3600 5)
{
    
// ZOMG ONLINE
}
 

_________________
Zezenia Online


January 02, 2008, 11:28:35 PM
Profile
Tester
User avatar

Joined: March 30, 2006, 07:13:19 PM
Posts: 2232
Location: Houten, Netherlands
Character: TrevoriuS
Clan: Dwarfhood
Post Re: More issues from my side =D (jscript this time)
Well the other guys PC needs to know that the one guys PC already uses this account, so that you can't login on the same account wice (thus proxy).
This because I for example use a system like this:
If constructingtime < now
Display 'construct next level building' button
Else
Don't display

So when I proxy; I can ignore the time by starting to construct on one window of my account, and then construct something else on another window of my account; because the buttons are still visible there (page not refreshed; script to construct still call-able).

_________________
My fairly outdated portfolio
Art is about beauty, nor originality. If quality can't be indicated, it's not abstract nor original, its more likely bad.
Philosophy


January 03, 2008, 04:55:09 PM
Profile
Tester
User avatar

Joined: May 19, 2007, 01:05:32 AM
Posts: 79
Location: Finland
Post Re: More issues from my side =D (jscript this time)
TrevoriuS wrote:
Well the other guys PC needs to know that the one guys PC already uses this account, so that you can't login on the same account wice (thus proxy)


Don't you mean the server should know the user is already logged in? And what does a proxy have to do with this? Why wouldn't he be able to login by lets say opening a new browser tab, if your system really sucks this much by now?

TrevoriuS wrote:
This because I for example use a system like this:
If constructingtime < now
Display 'construct next level building' button
Else
Don't display

So when I proxy; I can ignore the time by starting to construct on one window of my account, and then construct something else on another window of my account; because the buttons are still visible there (page not refreshed; script to construct still call-able).


O_O? Your game works with javascript? Why don't you call the server and ask if it's okay to start constructing before you start constructing? What do you construct? Don't tell me the browser sends to the server when things are done?

_________________
Zezenia Online


January 03, 2008, 06:58:07 PM
Profile
Tester
User avatar

Joined: March 30, 2006, 07:13:19 PM
Posts: 2232
Location: Houten, Netherlands
Character: TrevoriuS
Clan: Dwarfhood
Post Re: More issues from my side =D (jscript this time)
I'd need to post a few lines of code for that, and no its not javascript but PHP - but my issue is thus; how can I make sure that a user can't be logged in twice at the same moment?

_________________
My fairly outdated portfolio
Art is about beauty, nor originality. If quality can't be indicated, it's not abstract nor original, its more likely bad.
Philosophy


January 05, 2008, 07:46:51 AM
Profile
Staff

Joined: July 27, 2006, 05:36:07 PM
Posts: 2053
Location: Papillion, NE
Character: Jason
Clan: Ironfist
Post Re: More issues from my side =D (jscript this time)
Store the user status (online/offline) in the database, then check the status upon logging in..

Code:
if($account->online)
{
    //no cookie for you
}

_________________
Jason » Website Administrator
Image


January 05, 2008, 08:54:15 AM
Profile
Tester
User avatar

Joined: March 30, 2006, 07:13:19 PM
Posts: 2232
Location: Houten, Netherlands
Character: TrevoriuS
Clan: Dwarfhood
Post Re: More issues from my side =D (jscript this time)
Finally, we have arrived at understanding the first post.
Now what if the user closes the browser, how will the databse be updated again to status = 0?

_________________
My fairly outdated portfolio
Art is about beauty, nor originality. If quality can't be indicated, it's not abstract nor original, its more likely bad.
Philosophy


January 06, 2008, 12:23:45 AM
Profile
Staff

Joined: July 27, 2006, 05:36:07 PM
Posts: 2053
Location: Papillion, NE
Character: Jason
Clan: Ironfist
Post Re: More issues from my side =D (jscript this time)
Just store the IP address of the dude that's logged in..

Then when someone tries to do something in-game (NOT when logging in, IN-GAME)

Code:
if($account->ip !== $_SERVER['REQUEST_ADDR'] )
{
    // Logout the user, as another person has logged into the account
    // This is similar to how MSN works..
}

_________________
Jason » Website Administrator
Image


January 06, 2008, 05:50:45 AM
Profile
Tester
User avatar

Joined: March 30, 2006, 07:13:19 PM
Posts: 2232
Location: Houten, Netherlands
Character: TrevoriuS
Clan: Dwarfhood
Post Re: More issues from my side =D (jscript this time)
Thus I will store the IP in the database at logging in?

_________________
My fairly outdated portfolio
Art is about beauty, nor originality. If quality can't be indicated, it's not abstract nor original, its more likely bad.
Philosophy


January 06, 2008, 04:04:41 PM
Profile
Staff

Joined: July 27, 2006, 05:36:07 PM
Posts: 2053
Location: Papillion, NE
Character: Jason
Clan: Ironfist
Post Re: More issues from my side =D (jscript this time)
Yes, genius =)

_________________
Jason » Website Administrator
Image


January 06, 2008, 04:12:04 PM
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.