Script Help plz..

Codes here !

Moderators: macek, egami, gesf

Legacy
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Nov 05, 2002 3:05 pm

Script Help plz..

Postby Legacy » Tue Nov 05, 2002 3:10 pm

I have this ladder script that I purchased and the Creator will not support or help me with a major bug in it.
example with screenshot can be seen at this url:

http://www.squadgames.com/legacy/ladderscript2_bug.php

What is happening is a team CHALLENGES another team to a battle on the Ladder. Then the Other Team RESPONDS to the challenge. Now if the ORIGINAL Team who made the challenge DOES NOT Finalize the match withing 48 hrs then the script executes a FORFEIT..but the problem is the script is creating the FORFEIT to the team that was challenged even tho they responded to the original challenge..it should give the fofeit to the Orginal Team because they didnt FINALIZE the match. I have found the section of code in the script that creates the forfeits..any help would be appreciated.

The Script is Running here:
http://www.squadgames.com/ladder_network

I really could use some help with this..It Gives a forfeit to the wrong team and after paying $400.00 for this script the creator wont help me and the script is Useless.
also if you need more files e-mail me at admin@squadgames.com I'll provide anything you might need

the section of the code below is what creates the forfeits. I assume more code is needed to complete this..mabye a }else{ in the section of code //DIDNT RESPOND IN TIME or DIDNT FINALIZE IN TIME
------------------------------------------------------------------------------

[PHP]//NEXT 2 FUNCTIONS DELETES AND AWARDS WINS FOR UNRESPONDED OR UNFINALIZED CHALLENGES


function check_unrespondedchallenges(){

$challengeladders=mysql_query("SELECT id,respondhours,finalizehours FROM ladders WHERE challenge='1'");
while(list($id,$respondhours,$finalizehours)=mysql_fetch_row($challengeladders)){

$laterespond=date("Y-m-d H:i:s",time()-60*60*$respondhours);
$latefinalize=date("Y-m-d H:i:s",time()-60*60*$finalizehours);

$challengeinfo=mysql_query("SELECT challid,challenger,challenged,ladderid,challengerrank,challengedrank,respondedby,finalizedby FROM challenges WHERE
ladderid='$id' AND respondedby='0' AND finalizedby='0' AND challengedtime < '$laterespond' OR
ladderid='$id' AND respondedby > '0' AND finalizedby='0' AND respondedtime < '$latefinalize'");
while(list($challid,$challenger,$challenged,$ladderid,$challengerrank,$challengedrank,$respondedby,$finalizedby)=mysql_fetch_row($challengeinfo)){

//DIDNT RESPOND IN TIME or DIDNT FINALIZE IN TIME
if(($respondedby=="0") && ($finalizedby=="0") || ($respondedby > 0) && ($finalizedby=="0")){
create_forfeit($challid,$id,$challenger,$challenged,$challengerrank,$challengedrank);
}

}

}

}



function create_forfeit($challid,$ladderid,$winnerid,$loserid,$winrank,$loserank){
global $dir, $file, $url, $out, $plyr;

$loserteaminfo=mysql_query("SELECT teamname FROM teams WHERE id='$loserid'");
$lteam=mysql_fetch_array($loserteaminfo);

$winnerteaminfo=mysql_query("SELECT teamname FROM teams WHERE id='$winnerid'");
$wteam=mysql_fetch_array($winnerteaminfo);

$ladderinfo=mysql_query("SELECT laddername FROM ladders WHERE id='$ladderid'");
$linfo=mysql_fetch_array($ladderinfo);

$ip=getenv("REMOTE_ADDR");
$tday=date("Y-m-d H:i:s");

if(!$wteam[teamname]){
$wteam[teamname]="[DELETED]";
}

if(!$lteam[teamname]){
$lteam[teamname]="[DELETED]";
}

/*
//REPORT MATCH TO MATCH DATABASE
mysql_query("INSERT INTO matchdb VALUES (
'$challid',
'$winnerid',
'$loserid',
'$wteam[teamname]',
'$lteam[teamname]',
'$ladderid',
'$linfo[laddername]',
'$winrank',
'$loserank',
'0',
'0',
'',
'',
'',
'',
'Win by forfeit.',
'Loss by forfeit.',
'0',
'0',
'$plry[id]',
'$tday',
'0.0.0.0',
'$plry[id]',
'$tday',
'$ip');");
*/
[/PHP]

DutchBen
New php-forum User
New php-forum User
Posts: 36
Joined: Thu Oct 24, 2002 10:28 am
Location: Amsterdam

Postby DutchBen » Wed Nov 06, 2002 12:20 pm

Hi ....

I'm doing this at a glance but the anserw might be very simple instead of

Code: Select all

 while(list($challid,$challenger,$challenged,$ladderid,$challengerrank,$challengedrank,$respondedby,$finalizedby)=mysql_fetch_row($challengeinfo)){


dor

Code: Select all

while(list($challid,$CHALLENGED, $CHALLENGER,$ladderid,$challengerrank,$challengedrank,$respondedby,$finalizedby)=mysql_fetch_row($challengeinfo)){


Capital letters for clearer reading, don't copy !:)!

Be sure to test it very very very good before you go with it

Ben

Legacy
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Nov 05, 2002 3:05 pm

Postby Legacy » Wed Nov 06, 2002 5:49 pm

Ya.. I did that already..that works but then it messs up another part of the script forfeit..When you make that change this is what happens

Player 1 Challenges Player 2 to to match...A challenge e-mail gets sent..but Palyer 2 never respond to challenge... in 48 hrs script executes a Forfeit for not responding and the challenger gets the FORFEIT LOSS when player 2 should because they never responded....

it fixes the 1st scenario where player 1 challenges player 2 to match..then player 2 responds/accepts challenge but player 1 doesnt respond/finalize match.


needs more code to work the bug out

see why I think more code is neeeded to make this work...


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest

cron