First i need to say this: I got this idea when i was in the bathroom, pretty stupid han?
xD
So lets start.
First make a new file called info.php
Then Type this into it:
Code: Select all
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
$player=$_SESSION['player'];
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
?>
So this is pretty basic, so this will catch the player info and stuff.
Now insert a new filed to your Players Table in the DB called online and make it SMALLINT and dont set a default value.
Now go to your Auth.php (Authenticate.php)
And add this to it after the part saying
or something.Welcome back
Code: Select all
$isonline="update players set online='1' where name='$name'";
mysql_query($isonline) or die("The Server is getting Errors, Please Contact the Admins with the following error code: 981A");
this was my idea just to know the error if it occurs, you can edit as you want.The Server is getting Errors, Please Contact the Admins with the following error code: 981A
So this in your Authenticate page will set the online field to 1, saying that you are online.
Now go to your Logout.php and add before
this:session_destroy();
Code: Select all
$isonline="update players set online='0' where name='$name'";
mysql_query($isonline) or die("The Server is getting Errors, Please Contact the Admins with the following error code: 981A");
now delete this in your logout.php:
this i dont know why its there but when i made this system, xampp was giving me annoying messages about the session_start and stuff so, deleting it its no big deal...session_start();
So now you got the "timer" checking if you are online or offline.
Uses:
Now you can use this "system" for a lot of things in your game like the rank page (you can check how to make one HERE , Tut by me)
to add to it just follow the Tut and at the end i explain to you how to add new fields to the page.
Well, the tut ends here

hope its usefull to you people, and sorry if its too simple but it's easy to the beginners to understand ...
You dont need to credit me.
CREDIT INDIE-RESOURCE FOR ALL THE HELP THEY ARE GIVING TO YOU