Author Topic: Brainstorming  (Read 933 times)

Offline toxin

  • Level 21
  • *
  • Posts: 231
  • Reputation: +4/-2
    • View Profile
    • Encore Montreal
Brainstorming
« on: February 15, 2009, 09:19:33 PM »
I thought to put this here if it is the wrong place sorry I was not sure were to put it.

As I am coming up with some thoughts I will be putting it here. I am still learning and may not be able to do it so any advice would be appreciated. If you do not understand  my thoughts please let me know and I shall try to explain it better.  As it is not an easy thing to get my thoughts out.

NOTE: I am still learning. Some of the things I can not test. I shall just give you  how I think it may work.

My first thought if for active logged on users. I am not sure how this would work exactly or if it work how I thought it out.
Some game sites I have been to log you out about 15 minutes after inactivity. It could be do to session timing out or other tings.

I believe AJAX would be used to do this. It would have two parts. One you place at the bottom of the page the other at the top. The top page would keep track of what page the users is on. The bottom would count down from a set time. After the time runs out the users is logged out. The reason to keep track of the page is if the users is using an auto refresh on more than one page.
It can be configured in so many ways. The main thing is to keep the active players up to date.  If a player keeps the browser open on your site or has an auto refresher running it would log them out.

More to come.

Offline toxin

  • Level 21
  • *
  • Posts: 231
  • Reputation: +4/-2
    • View Profile
    • Encore Montreal
Re: Brainstorming
« Reply #1 on: February 16, 2009, 12:22:43 AM »
Not sure on the Double posting policy on the forum but i thought better to keep it in this one.

So far the main things I have used php for  lazy html coding. It is very useful I think.  this is something I just did. Not much just a html form.


<php
function html_form($nunber_of_filds=4$action="testemail.php",$method="post",$type="text",$name=array("F1","F2","F3","F4"),$value=null)
{
echo 
"<form action=\"$action\" method=\"$method\">
<table>
"
;
$cc=0;
while(
$cc!=$nunber_of_filds)
{
echo
"<tr><td>{$name[$cc]} : <td><input type=\"$type\" name=\"{$name[$cc]}\"";
if(
$value!=null)
{
echo 
"value=\"{$value[$cc]}\"";
}
echo
"> </td>
"
;
$cc++;
}
echo 
"</table></form>";
}
html_form(2,$action,$method,$type,array("Login","Password"));
?>

It is not much and is sloppy.
It may be done already.
« Last Edit: February 16, 2009, 12:26:01 AM by toxin »

Offline Slashmore

  • Level 17
  • *
  • Posts: 156
  • Reputation: +1/-0
    • View Profile
Re: Brainstorming
« Reply #2 on: February 16, 2009, 02:54:33 AM »
I woulldn't know much about the active part, I'm not onto that bit yet. :(

I use a bit of JS so if anyone trys to open the page out of the main frame it will redirect them back to /index.php - They can't use auto refreshers.

Code: [Select]
if (window.location.href == window.top.location.href) {
  window.top.location.replace('index.php');
}

Then add the following line to the pages you want the framecheck to work on.

Code: [Select]
<script language="javascript" src="connections/framecheck.js"></script>

Offline lolninja

  • Level 19
  • *
  • Posts: 194
  • Reputation: +5/-0
  • BSc powered Programmer
    • View Profile
    • HTTPmmo
Re: Brainstorming
« Reply #3 on: February 16, 2009, 03:31:43 AM »
Hey, using Javascript for any kind of security action is a really really bad idea, as if someone wanted to they can just turn it off, and then there auto refresher will work fine.
The way I was planning on doing this in a game I'm working on was to record the time of the last command, this would be when a user ordered some troops, looked at the world map etc, then I would have a periodic update script which checks for updates, one of the messages it receives would be to redirect to the log-in page.
In the case that the user doesn't have Javascript enables, the next time they click a link, and there idle period has expired, I will do a server-side redirect pointing them to the log-in page.

Offline toxin

  • Level 21
  • *
  • Posts: 231
  • Reputation: +4/-2
    • View Profile
    • Encore Montreal
Re: Brainstorming
« Reply #4 on: February 16, 2009, 03:45:50 AM »
Yea I know javascript is not the only thing to use. As the  script would be more than javascript it would stay connected to a server side script that works with the client side. If the javascript does not reconnect that it logs them out.

Offline lolninja

  • Level 19
  • *
  • Posts: 194
  • Reputation: +5/-0
  • BSc powered Programmer
    • View Profile
    • HTTPmmo
Re: Brainstorming
« Reply #5 on: February 16, 2009, 03:59:45 AM »
In my experience with complex Javascript systems its easier to rely on a message system, so if you want anything to happen on the client machine you have a periodicUpdater, which makes a request to a given url, that url will return some dynamic content, either a block of json data which can be used within the app, or a block of Javascript code which can be executed.
Therefore when you request data from this url, it will determine that the user is not currently logged into the system, which will return a block of Javascript  to redirect them to your sites landing page.

Although it is possible to write some Javascript to check for a 404 or something for a given request, I believe that its better to always return something, and it allows you to remotely execute commands on the clients machine.

Using a system like this you could use it to help manage load on your system during peak usage, simply by sending a command to all users to reduce the frequency of there periodicUpdate, or any number of cool things.

Offline toxin

  • Level 21
  • *
  • Posts: 231
  • Reputation: +4/-2
    • View Profile
    • Encore Montreal
Re: Brainstorming
« Reply #6 on: March 11, 2009, 03:00:43 PM »
More Brainstorming.

A bit  sloppy

function  slow_refresh($limit=10,$link="somepage.php")
{
if(isset(
$_SESSION['load']))
{
if(
time()<$_SESSION['load'])
{
die (
"Haste makes Waste. <br> <a href=\"$link\">BACK</a>");
}
else
{
$_SESSION['load']=time()+$limit;
}
}
else
{
$_SESSION['load']=time()+$limit;
}
}

Not much yet. Someone may have a better version. What it does if is slow down someone from refreshing a page.

Offline blindangel

  • Level 8
  • *
  • Posts: 36
  • Reputation: +0/-0
  • I'm not the girl your mother warned you about... h
    • View Profile
    • Draconus Majorus
Re: Brainstorming
« Reply #7 on: June 06, 2009, 08:10:55 AM »
hi there, why not use a framework and then half of this coding you are currently doing is already done? just a thought...

Also try to use css instead of tables for layout or positioning and avoid frames if can, that way your game will be more accessible to blind or disabled users, frames are nasty to someone like me who is blind :D

but thats just my 2 cents worth :D
Dont knock on deaths door... ring the dorbell and run away, thats what I do!

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal