After installing this game, i have seen a great deal that could be updated/cleaned and reorganized.
So i have started on this matter and already made some minor changes and updates.
I will release the changelog as it stands for now.
!!! Changelog 13-08-2010 !!!
---------------------------------
Little cleanup of to many connect.php files.
Changed all files containing.
include '../config/connect.php';
To read this now from a new folder named config with the file connect.php in it.
so now the line states as follow: include 'config/connect.php';
-------------------
Removed 1 body tag from style.css and added it to the first.
-------------------
Changed session start();
Now the whole script:
Code: Select all
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("Could not get user stats");
$playerinfo3=mysql_fetch_array($playerinfo2);
print "<input type='hidden' name='id' value='$playerinfo3[id]'>";
$updaterefresh="update players set lastattacked=0 where ID='$playerinfo3[id]'";
mysql_query($updaterefresh) or die("Died");
}
else
{
print "Sorry, not logged in please <A href='/login.php'>Login</a><br>";
exit;
} $currentbar = ($playerinfo3['stamina']/$playerinfo3['maxstamina']) * 100;
$healthbar = ($playerinfo3['hp']/$playerinfo3['maxhp']) * 100;
?>
This is how it is included and setup:
Code: Select all
<?php
session_start();
include 'config/connect.php';
include 'config/session.php';
?>
Reorganization of scripts, such as tabs and how it is read, clearing out white spaces where they are not necessary and giving white spaces where they are needed.
---------------------------------
!!! Changelog 14-08-2010 !!!
---------------------------------
Editted session.php, so now it automatically goes to the login page after 5 seconds if a player is not logged in yet.
See below the script:
Code: Select all
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("Could not get user stats");
$playerinfo3=mysql_fetch_array($playerinfo2);
echo "<input type='hidden' name='id' value='$playerinfo3[id]'>";
$updaterefresh="update players set lastattacked=0 where ID='$playerinfo3[id]'";
mysql_query($updaterefresh) or die("Died");
}
else
{
echo "Sorry, not logged in, please wait you will be redirected to the appropriate place in 5 seconds <meta http-equiv='refresh' content='5;url=../forsaken1/login.php'>";
echo "<br>";
echo "If you are not being redirected within 5 seconds, please click <a href='../forsaken1/login.php'>HERE</a> to go there manually";
exit;
}
$currentbar = ($playerinfo3['stamina']/$playerinfo3['maxstamina']) * 100;
$healthbar = ($playerinfo3['hp']/$playerinfo3['maxhp']) * 100;
?>
---------------------------------
This post will be updated accordingly.
Sincere:
Asgarth aka Michael B