PunBB Resource

Your ultimate PunBB resource!

Keywords:

    (Extended)

You are not logged in.

#1 2008-06-15 16:03:56

forumdesados
New member
Registered: 2008-03-09
Posts: 6

Arcad mod problem (by pandark, ango...)

Could anyone help me please, I have a major problem...

When i want to save a score, I've an error:

Parse error: syntax error, unexpected '}' in /home/forumdes/public_html/newscore.php on line 8

I've not changed anything in my newscore.php

Sorry for the bad english i use, i'm french :s

That is my newscore.php:

Code:

<?php
define('PUN_ROOT', './');require PUN_ROOT.'include/common.php';
if ($pun_user['g_id'] == PUN_GUEST)    error($lang_common['No permission']);
// Recover the game name and the score $game_name = $HTTP_POST_VARS['game_name'];// str_replace strips all spaces present in the score string$score = str_replace(" ", "", $HTTP_POST_VARS['score']);$topscore = 0;$now = time();// This is a fix for var "score" wich is send as "Score" and not as "score" like in game "Easter Egg Catch"    if(empty($score))    {        $score = $HTTP_POST_VARS['Score'];    }if(!empty($game_name) && !empty($score)){    // Find Topscore    $sql = 'SELECT rank_topscore, rank_score FROM '.$db->prefix.'arcade_ranking, '.$db->prefix.'users WHERE rank_player = '.$db->prefix.'users.id AND rank_game = "'.$game_name.'" ORDER BY rank_score DESC LIMIT 1';        $query = $db->query($sql) or error("Impossible to select topscore.", __FILE__, __LINE__, $db->error());    $line = $db->fetch_assoc($query);    if($line['rank_topscore'] = 1 && $line['rank_score'] < $score)    {        $sql = 'UPDATE '.$db->prefix.'arcade_ranking SET rank_topscore = '.$topscore.' WHERE rank_game = "'.$game_name.'"';        $query = $db->query($sql) or error("Impossible to update the topscore", __FILE__, __LINE__, $db->error());        $topscore = 1;    }    elseif($line['rank_topscore'] >= 0 && $line['rank_score'] <= $score)    {        $topscore = 1;            }    else    {        $topscore = 0;    }    $sql = 'SELECT * FROM '.$db->prefix.'arcade_ranking WHERE rank_player = '.$pun_user['id'].' AND rank_game = "'.$game_name.'"';    $query = $db->query($sql) or error("Impossible to select the user and game", __FILE__, __LINE__, $db->error());    if(mysql_num_rows($query) > 0)    {        $line = $db->fetch_assoc($query);        if($line['rank_score'] <= $score)        {        
            // Update new highscore            $sql = 'UPDATE '.$db->prefix.'arcade_ranking SET rank_score = '.$score.', rank_date = '.$now.' , rank_topscore = '.$topscore.' WHERE rank_player = '.$pun_user['id'].' AND rank_game = "'.$game_name.'"';            $query = $db->query($sql) or error("Impossible to update new highscore", __FILE__, __LINE__, $db->error());    
            $sql = 'SELECT game_id FROM '.$db->prefix.'arcade_games WHERE game_filename = "'.$game_name.'"';            $query = $db->query($sql) or error("Impossible to select the game", __FILE__, __LINE__, $db->error());            $gameid = $db->fetch_assoc($query);
            echo '<script type="text/javascript">window.location= "arcade_ranking.php?id='.$gameid['game_id'].'"</script>';
        }
        else
        {            // No new highscore            $sql = 'SELECT game_id FROM '.$db->prefix.'arcade_games WHERE game_filename = "'.$game_name.'"';            $query = $db->query($sql) or error("Impossible to select the game", __FILE__, __LINE__, $db->error());            $gameid = $db->fetch_assoc($query);            echo '<script type="text/javascript">window.location= "arcade_play.php?id='.$gameid['game_id'].'"</script>';
        }    }
    else
    {
        // Is there a score?        $sql = 'SELECT rank_score, rank_topscore FROM '.$db->prefix.'arcade_ranking WHERE rank_game = "'.$game_name.'" ORDER BY rank_score DESC, rank_topscore DESC';        $query = $db->query($sql) or error("Impossible to select the topscore", __FILE__, __LINE__, $db->error());        $line = $db->fetch_assoc($query);        if($line['rank_score'] <= 0 && $line['rank_topscore'] <= 0)        {            $topscore = 1;        }        // Add new Highscore        $sql = 'INSERT INTO '.$db->prefix.'arcade_ranking (rank_game, rank_player, rank_score, rank_topscore, rank_date) VALUES    ("'.$game_name.'", '.$pun_user['id'].', '.$score.', '.$topscore.', '.$now.')';        $query = $db->query($sql) or error("Impossible to insert the new score", __FILE__, __LINE__, $db->error());                $sql = 'SELECT game_id FROM '.$db->prefix.'arcade_games WHERE game_filename = "'.$game_name.'"';        $query = $db->query($sql) or error("Impossible to select the game", __FILE__, __LINE__, $db->error());        $gameid = $db->fetch_assoc($query);        echo '<script type="text/javascript">window.location= "arcade_ranking.php?id='.$gameid['game_id'].'"</script>';
    }
}
else{
    error($lang_common['No permission']);
}
?>

Offline

 

#2 2008-06-15 17:54:39

forumdesados
New member
Registered: 2008-03-09
Posts: 6

Re: Arcad mod problem (by pandark, ango...)

Resolved, sorry big_smile

Offline

 

Board footer

Based on PunBB
© Copyright 2002–2005 Rickard Andersson

© Copyright 2004–2006 Kristoffer Jansson

User contributed files are property of their respective owners.