Probleme newscore punbb arcade apres mise a j

Fermé
sob59 Messages postés 3 Date d'inscription mardi 19 mai 2009 Statut Membre Dernière intervention 19 mai 2009 - 19 mai 2009 à 01:02
Archeus01 Messages postés 1567 Date d'inscription mercredi 3 octobre 2007 Statut Membre Dernière intervention 9 juin 2022 - 25 mai 2009 à 10:59
Bonjour,

voila jai installé le mod punbb arcade celui fonctionner bien a la version 1.2.15 mais depuis que jai passé le forum en 1.2.21 des que je joue a un jeux arcade le score ne fonctionne plus et me met cette erreur.

Parse error: syntax error, unexpected '}' in /home/totor/web/www/newscore.php on line 8

voici le code a ligne 8 du newscore en dessous

}

je vous met le code entier en dessous

<?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']);
}
?>
A voir également:

3 réponses

Archeus01 Messages postés 1567 Date d'inscription mercredi 3 octobre 2007 Statut Membre Dernière intervention 9 juin 2022 447
19 mai 2009 à 14:39
sans l'indentation c'est plutot illisible...
Ligne 8 tu fermes un guillemet qui n'a jamais été ouvert! (le guillemet ouvert au milieu du commentaire ne compte pas.)
Tu n'ouvres pas de guillemet depuis le début...
Tu auras le même pb ligne 11: deux de fermer, une seule d'ouverte et encore ligne 15/16 : deux fermées, une seule ouverte...
0
sob59 Messages postés 3 Date d'inscription mardi 19 mai 2009 Statut Membre Dernière intervention 19 mai 2009
19 mai 2009 à 15:25
je suis un peut perdu car je ne suis pas codeur,je vous met le fichier en txt sa sera plus lisible et si quelqu un povez me régler lerreur sa serait sympas.

merci

le lien

http://www.punbb-angelus.com/forum/newscore.txt
0
Archeus01 Messages postés 1567 Date d'inscription mercredi 3 octobre 2007 Statut Membre Dernière intervention 9 juin 2022 447
19 mai 2009 à 17:06
Essaye
<?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']);
}
?>
0
sob59 Messages postés 3 Date d'inscription mardi 19 mai 2009 Statut Membre Dernière intervention 19 mai 2009
19 mai 2009 à 19:33
jai cette erreur maintenant lorsque je veut valider le score.


An error was encountered
Error: Vous n'avez pas l'autorisation d'afficher cette page..
0
Archeus01 Messages postés 1567 Date d'inscription mercredi 3 octobre 2007 Statut Membre Dernière intervention 9 juin 2022 447
25 mai 2009 à 10:59
define('PUN_ROOT', './');require PUN_ROOT.'include/common.php';
if ($pun_user['g_id'] == PUN_GUEST) error($lang_common['No permission']);
Tu t'authentifies comme PUN_GUEST (invité donc même pas authentifié en fait) alors c'est normal. il faut t'authentifier comme autre chose...
0