davespring Posted December 22, 2009 Share Posted December 22, 2009 I was wondering if you could help me find the source of the error, im getting a 'Parse error- unexpected $end on line 213, which is the ?> on the last line. <?php session_start(); $page = array(); $page['title'] = 'Guess the Number Results | Dufflotto'; include('gamheader.php'); $stake = $_POST['stake']; $guess = $_POST['guess']; $rannum = range(1, 1000); shuffle($rannum); $number = $rannum[0]; $username = $_SESSION['userInfo']['userInfo']['nickname']; $_SESSION['gtn']['last_level_played'] = $stake; settype($number, 'int'); settype($username, 'string'); settype($stake, 'float'); settype($guess, 'int'); if (($guess < 1) || ($guess > 1000)) { include('gtnerror.php'); die(); exit(); } if ($stake != .01 && $stake != .02 && $stake != .04 && $stake != .08) { include('gtnerror.php'); die(); exit(); } require_once('./../hidden/dbcon.php'); require_once('/home/davespri/hidden/moolaapi.php'); $api = new gtnAPI(); $response = $api->pointTransfer($_SESSION['userInfo']['userInfo']['mooUserId'], -1 * $stake, null, 'None'); if (!$response['pointTransferInfo']['confirmationId']) { die("Point transfer failed, go back and try again"); } else { $connect = mysql_connect($host, $user, $pass) or die ("unable to connect"); mysql_select_db("davespri_Gamerecords", $connect); mysql_query("INSERT INTO Gtnrecords (GameID, Nickname, MooUserId, Stake, Guess, Way) VALUES ( '".mysql_real_escape_string($response['pointTransferInfo']['partnerTxnId'])."', '".mysql_real_escape_string($username)."', '".mysql_real_escape_string($_SESSION['userInfo']['userInfo']['mooUserId'])."', '".mysql_real_escape_string($stake)."', '".mysql_real_escape_string($guess)."', 'In');"); echo "<h3>Guess the Number Results!</h3><br />"; echo "Your guess was: $guess"; echo "<br />"; echo "The actual number was: $number"; echo "<br />"; if ($number > $guess) { $result = $number - $guess; } elseif ($number < $guess) { $result = $guess - $number; } else { $result = 0; } settype($result, 'int'); echo "You were out by: $result<br />"; if ($result > 150) { echo 'Sorry, you have not won, but please try again!'; $payout = $stake * 0; $response = $api->pointTransfer($_SESSION['userInfo']['userInfo']['mooUserId'], +0 * $stake, null, 'None'); $_SESSION['userInfo']['userInfo']['accountInfo']['amountAvailable'] = $response['userInfo']['accountInfo']['amountAvailable']; if (!$response['pointTransferInfo']['confirmationId']) { $response = $api->pointTransfer($_SESSION['userInfo']['userInfo']['mooUserId'], +0 * $stake, null, 'None'); $_SESSION['userInfo']['userInfo']['accountInfo']['amountAvailable'] = $response['userInfo']['accountInfo']['amountAvailable']; } settype($response['pointTransferInfo']['partnerTxnId'], 'string'); settype($payout, 'float'); $connect = mysql_connect($host, $user, $pass) or die ("unable to connect"); mysql_select_db("davespri_Gamerecords", $connect); mysql_query("INSERT INTO Gtnrecords (gameID, Nickname, MooUserId, Stake, Guess, Actual, Result, Win, Way) VALUES ( '".mysql_real_escape_string($response['pointTransferInfo']['partnerTxnId'])."', '".mysql_real_escape_string($username)."', '".mysql_real_escape_string($_SESSION['userInfo']['userInfo']['mooUserId'])."', '".mysql_real_escape_string($stake)."', '".mysql_real_escape_string($guess)."', '".mysql_real_escape_string($number)."', '".mysql_real_escape_string($result)."', '".mysql_real_escape_string($payout)."','Out');"); } elseif ($result > 40) { echo 'Congratulations on 2x Payout!'; $payout = $stake * 2; echo " - $$payout"; $response = $api->pointTransfer($_SESSION['userInfo']['userInfo']['mooUserId'], +2 * $stake, null, 'None'); $_SESSION['userInfo']['userInfo']['accountInfo']['amountAvailable'] = $response['userInfo']['accountInfo']['amountAvailable']; if (!$response['pointTransferInfo']['confirmationId']) { $response = $api->pointTransfer($_SESSION['userInfo']['userInfo']['mooUserId'], +2 * $stake, null, 'None'); $_SESSION['userInfo']['userInfo']['accountInfo']['amountAvailable'] = $response['userInfo']['accountInfo']['amountAvailable']; settype($response['pointTransferInfo']['partnerTxnId'], 'string'); settype($payout, 'float'); $connect = mysql_connect($host, $user, $pass) or die ("unable to connect"); mysql_select_db("davespri_Gamerecords", $connect); mysql_query("INSERT INTO Gtnrecords (gameID, Nickname, MooUserId, Stake, Guess, Actual, Result, Win, Way) VALUES ( '".mysql_real_escape_string($response['pointTransferInfo']['partnerTxnId'])."', '".mysql_real_escape_string($username)."', '".mysql_real_escape_string($_SESSION['userInfo']['userInfo']['mooUserId'])."', '".mysql_real_escape_string($stake)."', '".mysql_real_escape_string($guess)."', '".mysql_real_escape_string($number)."', '".mysql_real_escape_string($result)."', '".mysql_real_escape_string($payout)."','Out');"); } elseif ($result > 10) { echo 'Congratulations on 4x Payout!'; $payout = $stake * 4; echo " - $$payout"; $response = $api->pointTransfer($_SESSION['userInfo']['userInfo']['mooUserId'], +4 * $stake, null, 'None'); $_SESSION['userInfo']['userInfo']['accountInfo']['amountAvailable'] = $response['userInfo']['accountInfo']['amountAvailable']; if (!$response['pointTransferInfo']['confirmationId']) { $response = $api->pointTransfer($_SESSION['userInfo']['userInfo']['mooUserId'], +4 * $stake, null, 'None'); $_SESSION['userInfo']['userInfo']['accountInfo']['amountAvailable'] = $response['userInfo']['accountInfo']['amountAvailable']; } settype($response['pointTransferInfo']['partnerTxnId'], 'string'); settype($payout, 'float'); $connect = mysql_connect($host, $user, $pass) or die ("unable to connect"); mysql_select_db("davespri_Gamerecords", $connect); mysql_query("INSERT INTO Gtnrecords (gameID, Nickname, MooUserId, Stake, Guess, Actual, Result, Win, Way) VALUES ( '".mysql_real_escape_string($response['pointTransferInfo']['partnerTxnId'])."', '".mysql_real_escape_string($username)."', '".mysql_real_escape_string($_SESSION['userInfo']['userInfo']['mooUserId'])."', '".mysql_real_escape_string($stake)."', '".mysql_real_escape_string($guess)."', '".mysql_real_escape_string($number)."', '".mysql_real_escape_string($result)."', '".mysql_real_escape_string($payout)."','Out');"); } elseif ($result > 5) { echo 'Congratulations on 8x Payout!'; $payout = $stake * 8; echo " - $$payout"; $response = $api->pointTransfer($_SESSION['userInfo']['userInfo']['mooUserId'], +8 * $stake, null, 'None'); $_SESSION['userInfo']['userInfo']['accountInfo']['amountAvailable'] = $response['userInfo']['accountInfo']['amountAvailable']; if (!$response['pointTransferInfo']['confirmationId']) { $response = $api->pointTransfer($_SESSION['userInfo']['userInfo']['mooUserId'], +8 * $stake, null, 'None'); $_SESSION['userInfo']['userInfo']['accountInfo']['amountAvailable'] = $response['userInfo']['accountInfo']['amountAvailable']; } settype($response['pointTransferInfo']['partnerTxnId'], 'string'); settype($payout, 'float'); $connect = mysql_connect($host, $user, $pass) or die ("unable to connect"); mysql_select_db("davespri_Gamerecords", $connect); mysql_query("INSERT INTO Gtnrecords (gameID, Nickname, MooUserId, Stake, Guess, Actual, Result, Win, Way) VALUES ( '".mysql_real_escape_string($response['pointTransferInfo']['partnerTxnId'])."', '".mysql_real_escape_string($username)."', '".mysql_real_escape_string($_SESSION['userInfo']['userInfo']['mooUserId'])."', '".mysql_real_escape_string($stake)."', '".mysql_real_escape_string($guess)."', '".mysql_real_escape_string($number)."', '".mysql_real_escape_string($result)."', '".mysql_real_escape_string($payout)."','Out');"); } else { echo 'Congratulations on 16x Payout!'; $payout = $stake * 16; echo " - $$payout"; $response = $api->pointTransfer($_SESSION['userInfo']['userInfo']['mooUserId'], +16 * $stake, null, 'None'); $_SESSION['userInfo']['userInfo']['accountInfo']['amountAvailable'] = $response['userInfo']['accountInfo']['amountAvailable']; if (!$response['pointTransferInfo']['confirmationId']) { $response = $api->pointTransfer($_SESSION['userInfo']['userInfo']['mooUserId'], +16 * $stake, null, 'None'); $_SESSION['userInfo']['userInfo']['accountInfo']['amountAvailable'] = $response['userInfo']['accountInfo']['amountAvailable']; } settype($response['pointTransferInfo']['partnerTxnId'], 'string'); settype($payout, 'float'); $connect = mysql_connect($host, $user, $pass) or die ("unable to connect"); mysql_select_db("davespri_Gamerecords", $connect); mysql_query("INSERT INTO Gtnrecords (gameID, Nickname, MooUserId, Stake, Guess, Actual, Result, Win, Way) VALUES ( '".mysql_real_escape_string($response['pointTransferInfo']['partnerTxnId'])."', '".mysql_real_escape_string($username)."', '".mysql_real_escape_string($_SESSION['userInfo']['userInfo']['mooUserId'])."', '".mysql_real_escape_string($stake)."', '".mysql_real_escape_string($guess)."', '".mysql_real_escape_string($number)."', '".mysql_real_escape_string($result)."', '".mysql_real_escape_string($payout)."','Out');"); } } sleep(5); echo '<br /><a href="gtn.php"><button type="button">Click here to try again!</button></a>'; mysql_close($connect); echo '<br /><br />'; include('payouttable.php'); include('footer.php'); ?> Link to comment https://forums.phpfreaks.com/topic/186047-unexpected-end/ Share on other sites More sharing options...
Buddski Posted December 22, 2009 Share Posted December 22, 2009 Your missing a } somewhere.. But im not paid enough to find out where Link to comment https://forums.phpfreaks.com/topic/186047-unexpected-end/#findComment-982498 Share on other sites More sharing options...
mrMarcus Posted December 22, 2009 Share Posted December 22, 2009 you should indent your code .. will prevent these issues from even occurring. you don't close your else <?php //... if (!$response['pointTransferInfo']['confirmationId']) { die("Point transfer failed, go back and try again"); } else { //you never close this with a } $connect = mysql_connect($host, $user, $pass) or die ("unable to connect"); mysql_select_db("davespri_Gamerecords", $connect); mysql_query("INSERT INTO Gtnrecords (GameID, Nickname, MooUserId, Stake, Guess, Way) //... ?> Link to comment https://forums.phpfreaks.com/topic/186047-unexpected-end/#findComment-982500 Share on other sites More sharing options...
davespring Posted December 22, 2009 Author Share Posted December 22, 2009 Thanks guys, I wouldnt have found this, but in the future, it will teach me to indent Link to comment https://forums.phpfreaks.com/topic/186047-unexpected-end/#findComment-982503 Share on other sites More sharing options...
mrMarcus Posted December 22, 2009 Share Posted December 22, 2009 just makes it so much easier to see when you're missing things... <?php if ($a == $b) { if ($b == $c) { if ($c == $d) { //indented code; } } ?> Link to comment https://forums.phpfreaks.com/topic/186047-unexpected-end/#findComment-982506 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.