2DaysAway Posted November 19, 2008 Share Posted November 19, 2008 Here's the scenario: Player clicks link when turns are available <a href="bonuscredits.php?rid=<?=$rid?>"><font size="-2">(add bonus turns)</font</a> Now, it should just take them to the bonuscredits page and then the player has to manually click the submit button to get his/her turns. BUT, what is happening is the player clicks the link for the bonuscredits and the next thing the player knows, he has his turns and never even saw the bonuscredits page. I'll post the code for the bonuscredits page, could someone please take a look and let me know why it's automatically running the script when I thought it should show the form and allow the player to choose.... <?php include("game_html.php"); $game="yes"; mysql_query("UPDATE `{$tab[pimp]}` SET `currently`='adding bonus turns', `online`='$time' WHERE `id`='$id' AND `rid`='$rid'"); $user = mysql_fetch_array(mysql_query("SELECT credit,username FROM `{$tab[user]}` WHERE `id`='$id';")); $un=$user["username"]; $pimp = mysql_fetch_array(mysql_query("SELECT pimp,transfer,bonusturntime,bonusturns,bonusturnsuses FROM `{$tab[pimp]}` WHERE `id`='$id' AND `rid`='$rid';")); $user2 = mysql_fetch_array(mysql_query("SELECT id FROM `{$tab[pimp]}` WHERE `pimp`='$pmp' AND `rid`='$rid';")); $adminid="5"; $bonustransfer=$pimp[bonusturns]; $timeleft=$time-$pimp[bonusturntime]; //add bonus turns if ($bonustransfer){ if($time < $pimp[bonusturntime]){ $msg='You have to wait before receiving bonus turns'; } elseif($time < $site[starts]){ $msg="You must wait until this game starts!"; } elseif($bonustransfer > $user[credit]){ $msg="You dont have that many credits!"; } else{ $pimp = mysql_fetch_array(mysql_query("SELECT bonusturnsuses,crewjoindate,crewbonusturns,bonusturns,loyality,crew FROM `{$tab[pimp]}` WHERE `id`='$id' AND `rid`='$rid';"))or die("Error : " . mysql_error()); $user = mysql_fetch_array(mysql_query("SELECT credit FROM `{$tab[user]}` WHERE `id`='$id';"))or die("Error : " . mysql_error()); $bonustime=$time+172800;//bonus turns every 48 hours $crewquery = "SELECT members FROM `{$tab[crew]}` WHERE `id`='$id' AND `rid`='$rid'"; $ct=$crewquery["members"]; $cjd=$pimp["crewjoindate"]; $cbt=$pimp["crewbonusturns"]; $btu=$pimp["bonusturnsuses"]; $pcw=$pimp["crew"]; $btu=$pimp["bonusturnsuses"]; if($pcw<=0){$bt=0;} else{$bt=10;} $enddate=$time; $diff=$enddate-$cjd; // immediately convert to days $temp=$diff/86400; // 60 sec/min*60 min/hr*24 hr/day=86400 sec/day // days $days=floor($temp); $temp=24*($temp-$days); $ply=$pimp["loyality"]; if($pcw<=0){$xbt=0;} else{$xbt=$days*$bt;} if($pcw<=0){$lxbt=0;} else{$lxbt=$bt*$ply;} $bonusturns=$pimp["bonusturns"]+$cbt+$lxbt; $adminmessage="Auto-Response: you received ". $bonusturns ." bonus turns."; mysql_query("INSERT INTO `{$tab[mail]}` (rid,src,dest,msg,time,inbox) VALUES ('$rid','$adminid','$id','$adminmessage','$time',2);")or die("Error : " . mysql_error("tabmail error")); mysql_query("UPDATE `{$tab[pimp]}` SET `messages`=messages+1 WHERE `id`='$id' AND `rid`='$rid'")or die("Error : did not update message bin" . mysql_error()); mysql_query("UPDATE `{$tab[pimp]}` SET `bonusturnsuses`=$btu+1 WHERE `id`='$id' AND `rid`='$rid'")or die("Error : did not update bonus turn count" . mysql_error()); mysql_query("UPDATE `{$tab[pimp]}` SET `loyalityturns`=$lxbt WHERE `id`='$id' AND `rid`='$rid'")or die("Error : did not update loyality turn count" . mysql_error()); mysql_query("UPDATE `{$tab[pimp]}` SET `turn`=turn+$bonustransfer+$cbt+$lxbt, `bonusturntime`=$bonustime WHERE `id`='$id' AND `rid`='$rid'")or die("Error : did not give turns" . mysql_error()); mysql_query("UPDATE `{$tab[pimp]}` SET `crewbonusturns`=crewbonusturns+$xbt WHERE `id`='$id' AND `rid`='$rid'")or die("Error : did not give crew bonus turns" . mysql_error()); mysql_query("UPDATE `{$tab[user]}` SET `credit`=credit-$bonustransfer WHERE `id`='$id'")or die("Error :did not deduct credits from account " . mysql_error()); mysql_query("INSERT INTO `{$tab[credits]}` (id,username,action,time,ip) VALUES ('','$un','$adminmessage','$time','$REMOTE_ADDR');")or die ("Did not INSERT info into credit table " .mysql_error ()); header("Location: buyturns.php?rid=$rid"); } } $user = mysql_fetch_array(mysql_query("SELECT credit FROM `{$tab[user]}` WHERE `id`='$id';")); ?> <div class="inside_box_header">Your account currently has <?=commas($user["credit"])?> credits. <div class="inside_box"> <form method="post" action="bonuscredits.php?action=bonustransfer"> <b>transfer your credits for more turns</b> <input type="submit" class="button" value="transfer" name="bonustransfer"> <table align="center" cellspacing="1" cellpadding="4"> <?if($msg){?> <div class="boxdef-hd"> <div class="boxdef"> <center> <b><font color="#ffffff"> <?=$msg?> </font></b> </center> </div> </div> <?}?> </table> </form> </div> </div> Link to comment https://forums.phpfreaks.com/topic/133397-php-script-is-loading-itself/ Share on other sites More sharing options...
revraz Posted November 19, 2008 Share Posted November 19, 2008 Where do you $_GET['rid'] at? Link to comment https://forums.phpfreaks.com/topic/133397-php-script-is-loading-itself/#findComment-693788 Share on other sites More sharing options...
2DaysAway Posted November 19, 2008 Author Share Posted November 19, 2008 the game_html file has another include file for the game_setup and that's where it gets it from. if (!isset($_GET["rid"])) $rid=$play; else $rid=$_GET["rid"]; Link to comment https://forums.phpfreaks.com/topic/133397-php-script-is-loading-itself/#findComment-693791 Share on other sites More sharing options...
2DaysAway Posted November 19, 2008 Author Share Posted November 19, 2008 Does anyone have any ideas? Link to comment https://forums.phpfreaks.com/topic/133397-php-script-is-loading-itself/#findComment-693817 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.