!!! Changelogs by Asgarth !!!

All code and questions for Urban Realms, Forsaken Sanctum, ect...
Post Reply
User avatar
Asgarth
Posts: 62
Joined: Tue Aug 10, 2010 11:57 am

!!! Changelogs by Asgarth !!!

Post by Asgarth »

Hello folks.

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;

?>
Doesnt have to be anymore in any file, as it is now read trough a newly created file called session.php wich is located in the folder config.

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
Last edited by Asgarth on Sat Aug 14, 2010 9:33 am, edited 1 time in total.
Image
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: !!! Changelogs by Asgarth !!!

Post by hallsofvallhalla »

awesome man, keep up the good work!
User avatar
Asgarth
Posts: 62
Joined: Tue Aug 10, 2010 11:57 am

Re: !!! Changelogs by Asgarth !!!

Post by Asgarth »

!!! 1st post Updated !!!
Image
User avatar
Asgarth
Posts: 62
Joined: Tue Aug 10, 2010 11:57 am

Re: !!! Changelogs by Asgarth !!!

Post by Asgarth »

!!! Changelog 14-08-2010 !!!
---------------------------------

I made some little changes to the login and logout.php files, hope you like it.

---------------------------------

Login includes now image of the game (Banner) everything is centered andbackground is black.

login.php

Code: Select all

<?php
	include 'config/connect.php';
	session_start();
?>
<html>
	<body>
		<link href="style.css" rel="stylesheet" type="text/css" />
			<table width="100%">
				<tr>
					<td>
						<div id="logo">
							<img src="images/logo.jpg" width="500" height="120" />
						</div>
		
						<div id="logintable">
							<form method="POST" action="authenticate.php">
								<p align=center>Username: <input type="text" name="player" size="15"> <br>Password:  <input type="password" name="password" size="15" mask="x"></p>
								<p align=center>   <input type="submit" value="submit" name="submit"></p>
								<p align=center>Not registered? Please <A href='register.php'>Register</a><br>Forgot password? <A href="getpass.php">Get Password</a></p>
								<br>
								<p align=center>For question/concerns/suggestions or if you would like to help on this project please visit the forums @ <a href="http://forsakensanctum.com/forum/index.php">http://forsakensanctum.com/forums/index.php</a></p>
								<p align=center>Or email me hallsofvallhalla@yahoo.com</p>
							</form>
						</div>
					</td>
				</tr>
			</table>
	</body>
</html>
---------------------------------
Now when a person logs out of the game, the logout.php now automaticly redirects you back to the login screen, so it is easier for people to log back in again.

logout.php

Code: Select all

<?php
	session_start();
	include 'config/connect.php';
	include 'config/session.php';
	session_destroy();
	
		echo "<table width=100% height='100%' bgcolor='#000000'>";
		echo "<tr>";
		echo "<td>";
		echo "<center>";
		echo "<img src='images/logo.jpg' width='500' height='120' />";
		echo "<br>";
		echo "<font color='white'>";
		echo "<big><center> Logged out. Thanks for Playing!!!!</big></center>";
		echo "<br>";
		echo "You will now be redirected back to our login page 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";
		echo "</center>";
		echo "</font>";
		echo "</td>";
		echo "</tr>";
		echo "</table>";
?>
---------------------------------
Image
User avatar
Asgarth
Posts: 62
Joined: Tue Aug 10, 2010 11:57 am

Re: !!! Changelogs by Asgarth !!!

Post by Asgarth »

Updated the session.php file yet again with some more features.

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 "<table width=100% height='100%' bgcolor='#000000'>";
		echo "<tr>";
		echo "<td>";
		echo "<center>";
		echo "<img src='images/logo.jpg' width='500' height='120' />";
		echo "<br>";
		echo "<font color='white'>";
		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";
		echo "</center>";
		echo "</font>";
		echo "</td>";
		echo "</tr>";
		echo "</table>";
		exit;
	}

	$currentbar = ($playerinfo3['stamina']/$playerinfo3['maxstamina']) * 100;
	$healthbar = ($playerinfo3['hp']/$playerinfo3['maxhp']) * 100;

?>
Have fun.
Image
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: !!! Changelogs by Asgarth !!!

Post by hallsofvallhalla »

awesome stuff
User avatar
Asgarth
Posts: 62
Joined: Tue Aug 10, 2010 11:57 am

Re: !!! Changelogs by Asgarth !!!

Post by Asgarth »

hallsofvallhalla wrote:awesome stuff
Thank you.

I will try todo as much stuff as i can with the files i have.

If there are any other updates from your end, wich arent included inside the 1.0 please let me know so i dont change stuff the wrong way around.

Sincere:
Asgarth aka Michael B.
Image
User avatar
Asgarth
Posts: 62
Joined: Tue Aug 10, 2010 11:57 am

Re: !!! Changelogs by Asgarth !!!

Post by Asgarth »

I do however have a minor problem here.

I cannot run cron jobs, as i am running win xp sp3.
I know i can install win cron or set this up via windows xp settings, but i dont want to harm my pc by doing so.

For this reason i cannot make anything wich runs cron jobs, there for i will see if i can make it run in either php, ajax, or js if i can make this happen.
Image
User avatar
Asgarth
Posts: 62
Joined: Tue Aug 10, 2010 11:57 am

Re: !!! Changelogs by Asgarth !!!

Post by Asgarth »

!!! Changelog 14-08-2010 !!!
---------------------------------

Alright here is a new update.
I have finished the main folder files, by regrouping and organizing it accordingly.

Currently i am busy on the Building Folder.

Accordingly i will try to see in every file what can stay in and what can go out, for example in every single file i see the session_start(); function, wich is absolutely not necessary if it isn't use by players, i mean mainly the session_start(); function is only used when a player logs in and the rest will be done by the session.php file as this is included in every file.

If you are using session_start(); in every file, this will cause an overload in usage and mainly this will then cause a cascade feedback if a player use the back button, wich internally can screw up your server or even crash it due to heavy usage.

Also as i stated in my previous post, i will try to see if i can redo the cron job function to a more sustainable function run by either php, ajax or js as these are more commonly used by any web hoster or self hoster, as they are more commonly use Windows XP or Vista/7.

Anyways this was my small update on where i am, and will keep you covered on my progress accordingly.

Sincere:
Asgarth aka Michael B.
Image
User avatar
Asgarth
Posts: 62
Joined: Tue Aug 10, 2010 11:57 am

Re: !!! Changelogs by Asgarth !!!

Post by Asgarth »

Alright after fixing some stuff in the database, wich now allows me back in the game again after using food to gain hp, i tried the crafting feature.

I found out that this not completely work, why ? well first of heavy_armor isn't available in the database, also for example crafting insist you to have at least some sort of item to work with or from... lets say for example a recipe or item piece.

A recipe allows you to gather the required items needed to craft a weapon/armor/jewel wich then can be brought to the crafting forge who then can make the desired item after taking the appropriate items from the players backpack.

1: When entering a Crafting Forge, a text pops up atm wich asks you what you want todo.
2: This should in turn after clicking one of the options given, check your backpack to see if you have the desired items yes or no.
3: If desired items are not available, or not completely there a text should popup with Sorry but you do not have the required amount of items for this object, you need This: then the items list what you need for it : to be able to craft this object.
4: If player does have the required items he/she needs to Forge/Craft an object, after clicking the desired link you have the items for should then in turn remove those items required from your backpack and say to you: Thank you for giving me the desired amount of items needed to Forge/Craft your object *Boing* *Boing* Hammer Cling.... There you go dear $player <-- current player, here is your object (Object is in turn the desired item you wanted), Please come back later if you want to let us make you another object, or choose what you want us to make from the following links: List of available items in the forge.
5: Player gets the item and and either goes on his/her way or crafts another item, if he/she has the desired amount of items needed to make it happen.

I hope you all understood what i wrote above, as in turn this is pretty easy to develop the explenation is more harder for me.

Sincere:
Asgarth aka Michael B.
Image
Post Reply

Return to “Hall's Games”