Jump to content

Can you help me with this code?


00king00

Recommended Posts

On the page where the user actually clicks to use the Sentry Skill, what function does it call on?

 

Everything I see points to currentSentrySkill

 

Example:

	$pris=pow(2,$user->currentSentrySkill)*12000;

 

Throughout all the code, that is nowhere to be found. It's probably in the lib.php file which contains the class(s). The problem may be within the lib.php file.

Link to comment
Share on other sites

Great hint mate!

 

But the lib file got this info:

 

	
//---------- Game options
$conf["gold_from_soldier"]=25;
$conf["minutes_per_turn"]=10;
$conf["days_of_inactivity_before_delete_this_user"]=35;
$conf["users_per_page"]=25;
$conf["mercenaries_per_turn"]=5;
$conf["days_to_hold_logs"]=10; //For Battle Logs
$conf["hours_to_block_same_user_recruiting"]=24;
$conf["ips_to_hold_per_user"]=20;

 

But the Sentry Skill got the function from another file called ( train.php)

 

here the code:

 

            <TABLE class=table_lines cellSpacing=0 cellPadding=2 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TH align=middle colSpan=2>Upgrade Spy Skill:</TH></TR>
              <TR>
                <TH class=subh align=left>Current Spy Skill:</TH>
                <TH class=subh>Upgrade:</TH></TR>
              <TR>
                <TD>Level <? echo $user->currentSpySkill?></TD>
			<? $pris=pow(2,$user->currentSpySkill)*12000;?>
                <TD align=middle><INPUT type=submit size=5 value="<? numecho($pris)?> Gold" name=spyupgrade> 
                  <INPUT type=hidden value=yes 
            name=upgrade_spy></TD></TR></TBODY></TABLE><INPUT type=hidden 
            value=93aa2b6a02603399396203313b45827e name=hash> </FORM></TD>
		        <TR>
          <TD style="PADDING-RIGHT: 25px" vAlign=top>
            <FORM action=train.php method=post>
            <TABLE class=table_lines cellSpacing=0 cellPadding=2 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TH align=middle colSpan=2>Upgrade Sentry Skill:</TH></TR>
              <TR>
                <TH class=subh align=left>Current Sentry Skill:</TH>
                <TH class=subh>Upgrade:</TH></TR>
              <TR>
                <TD>Level <? echo $user->currentSentrySkill?></TD>
			<? $pris=pow(2,$user->currentSentrySkill)*12000;?>
                <TD align=middle><INPUT type=submit size=5 value="<? numecho($pris)?> Gold" name=sentryupgrade> 
                  <INPUT type=hidden value=yes 
            name=upgrade_sentry></TD></TR></TBODY></TABLE><INPUT type=hidden 
            value=93aa2b6a02603399396203313b45827e name=hash> </FORM></TD>
          <TD>
            <FORM action=train.php method=post>

 

Link to comment
Share on other sites

You're going to have to find the "currentSentrySkill" method which is located in a class.

 

Is there a class.php file or anything?

 

No mate, there is no class.php file with the folder!

 

But that function can be done with (train.php) I think

 

and the lib file got no more opitions!

 

 

Link to comment
Share on other sites

The only reason I mentioned a class.php file is because thats what I've seen people use most of the time. Keep in mind I haven't seen a whole lot. class.php was just a thought.

 

If you look at the train.php you see it uses an object called $user and calls on the method named "currentSentrySkill"

 

It looks as if the train.php file is included in a larger file (such as index.php, game.php, or whatever the main file is called). Inside that file, the $user object will be defined. Look for $user = new USER (USER will be the name of the class you need to find). Inside that class, you will find the line that looks something like "public function currentSentrySkill(.....) {".

 

Once you find that piece of code, post the function.

Link to comment
Share on other sites

The only reason I mentioned a class.php file is because thats what I've seen people use most of the time. Keep in mind I haven't seen a whole lot. class.php was just a thought.

 

If you look at the train.php you see it uses an object called $user and calls on the method named "currentSentrySkill"

 

It looks as if the train.php file is included in a larger file (such as index.php, game.php, or whatever the main file is called). Inside that file, the $user object will be defined. Look for $user = new USER (USER will be the name of the class you need to find). Inside that class, you will find the line that looks something like "public function currentSentrySkill(.....) {".

 

Once you find that piece of code, post the function.

 

Hi mate

 

I searched for all file plus the index.php

 

all the files got this code on the first lines:

 

<?
include "vsys.php";
?>

is this mean anything?

 

 

Link to comment
Share on other sites

I think I found it mate..the main

 

Its in (train.php) I already attached it

 

Here the first lines codes in the file:

 

<?
include "vsys.php";
$user=getUserDetails($_SESSION['isLogined'],"*");
if($cgi[train]){
	$wal=round($wal);
	if($cgi[atsold]){
		$wal=$cgi[atsold];$typ=0;
		$detail.=Train($user,$wal,$typ);
		$buylog=BuyLog(AT,$wal,$cgi[atsold],$user,1,$HTTP_SERVER_VARS['REMOTE_ADDR']);
		$user=getUserDetails($_SESSION['isLogined'],"*");
	}
	if($cgi[defsold]){
		$wal=$cgi[defsold];$typ=1;
		$detail.=Train($user,$wal,$typ);
		$buylog=BuyLog(DE,$wal,$cgi[atsold],$user,0,$HTTP_SERVER_VARS['REMOTE_ADDR']);
		$user=getUserDetails($_SESSION['isLogined'],"*");
	}
	if($cgi[spy]){
		$wal=$cgi[spy];$typ=2;
		$detail.=Train($user,$wal,$typ);
		$buylog=BuyLog(SP,$wal,$cgi[atsold],$user,1,$HTTP_SERVER_VARS['REMOTE_ADDR']);
		$user=getUserDetails($_SESSION['isLogined'],"*");
	}
	if($cgi[sentry]){
		$wal=$cgi[sentry];$typ=5;
		$detail.=Train($user,$wal,$typ);
		$buylog=BuyLog(SE,$wal,$cgi[atsold],$user,0,$HTTP_SERVER_VARS['REMOTE_ADDR']);
		$user=getUserDetails($_SESSION['isLogined'],"*");
	}
	if($cgi[reat]){
		$wal=$cgi[reat];$typ=3;
		$detail.=Train($user,$wal,$typ);
	}
	if($cgi[redef]){
		$wal=$cgi[redef];$typ=4;
		$detail.=Train($user,$wal,$typ);
	}

	//echo "--$typ--";
	header("Location: train.php?strErr=$detail");
	}

if($cgi[spyupgrade]){$detail=Trainupgrade($user,'spy');header("Location: train.php?strErr=$detail");}
	if($cgi[sentryupgrade]){$detail=Trainupgrade($user,'spy');header("Location: train.php?strErr=$detail");}
if($cgi[unitupgrade]){$detail=Trainupgrade($user,'unit');header("Location: train.php?strErr=$detail");}
if($cgi[unitupgradeall]){$detail=TrainupgradeAll($user,'unitall');header("Location: train.php?strErr=$detail");}
if($cgi[unitupgradeallwithout]){$detail=TrainupgradeAllWithout($user,'unitall');header("Location: train.php?strErr=$detail");}


?>

 

Thanx :-)

Link to comment
Share on other sites

Hmm, I'm not quite sure anymore :-/ I'm still newer to php and the way it's coded seems very strange to me. My lack of experience is showing, lol. I've got homework to get done so hopefully one of the moderators and/or experienced programmers will jump in and help out!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.