我有一個web site和我的問題是關於「選民」部分。PHP錯誤語法
當我們投,我們沒有禮物和錯誤來約我行121:
PHP Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /home/pvpdream/public_html/voter/recompenses.php on line 121
我給你的腳本:
<?php
if ($_SESSION['out'] == true)
{
$inputString = $_SESSION['Pseudo_String'];
$pseudo = $inputString;
$selection = $bdd -> prepare('SELECT * FROM joueurs WHERE user_pseudo = :user_pseudo');
$selection -> bindParam(':user_pseudo', $inputString);
$selection -> execute();
$MonPersonnage = $selection -> fetch(PDO::FETCH_OBJ);
$NomPersonnage = $MonPersonnage->user_pseudo;
#### POINTS
$NbrPoints = $MonPersonnage->user_points;
$NbrVote = $MonPersonnage->vote;
$ApresVote = $NbrPoints + $Points_par_vote;
$vote = $NbrVote +1 ;
#### TEMPS
$date = time();
$HeureVote = $MonPersonnage->date_vote;
$EcartMinutes = ($date - $HeureVote)/60;
#### IP
$ip = $_SERVER['REMOTE_ADDR'];
if ($EcartMinutes > 180)
{
if($_GET['verification'] == "items" && $_GET['serveur'] == 'f')
{
$serveur = 'f';
$update = $bdd->prepare('UPDATE joueurs SET date_vote = :date_vote, vote = :vote WHERE user_pseudo = :user_pseudo');
$update -> bindParam(':date_vote', $date);
$update -> bindParam(':vote', $vote);
$update -> bindParam(':user_pseudo', $NomPersonnage);
$update -> execute();
$update = $bdd->prepare('UPDATE vote_ip SET date_vote = :date_vote WHERE ip = :ip');
$update -> bindParam(':date_vote', $date);
$update -> bindParam(':ip', $ip);
$update -> execute();
##################################### Probabilités
$query = $bdd->prepare('SELECT SUM(p) AS somme FROM probabilites');
$query->execute();
$string = $query->fetch();
$nbr_items = $string['somme'];
$query = $bdd->prepare ("SELECT * FROM probabilites WHERE serveur = '".$serveur."'");
$query->execute();
$prob = 1000;
$rand = mt_rand(0, $prob);
$items = array();
while($resultats = $query->fetch(PDO::FETCH_OBJ))
{
$items[$resultats->quantite.'|'.$resultats->nom.'|'.$resultats->commande.''] = $resultats->p/$nbr_items;
}
asort($items);
$i = 0;
foreach ($items as $name => $value)
{
if ($rand <= $i+=($value * $prob))
{
$item = $name;
break;
}
}
list($quantite, $nom, $commande) = explode("|", $item);
# Exécution des requêtes items
$commande_exp = explode(" ", $commande);
if($commande_exp[0] == 'POINTS')
{
$requete = str_replace("POINTS ", "", $commande);
$VoteBoutique = $NbrPoints + $requete;
echo '<br /><div class="alert alert-success"><b> Succès</b> : '.$pseudo.' vous venez d\'obtenir le cadeau suivant : <b> '.$quantite.' '.$nom.' </b>.</div>';
$update = $bdd->prepare('UPDATE joueurs SET user_points = :user_points WHERE user_pseudo = :user_pseudo');
$update -> bindParam(':user_points', $VoteBoutique);
$update -> bindParam(':user_pseudo', $pseudo);
$update -> execute();
$connexion_1->call("runConsoleCommand", array("broadcast ".$pseudo." vient de gagner ".$quantite." ".$nom." en votant pour le serveur."));
/*$connexion_2->call("runConsoleCommand", array("broadcast ".$pseudo." vient de gagner ".$quantite." ".$nom." en votant pour le serveur."));
$connexion_3->call("runConsoleCommand", array("broadcast ".$pseudo." vient de gagner ".$quantite." ".$nom." en votant pour le serveur."));
$connexion_4->call("runConsoleCommand", array("broadcast ".$pseudo." vient de gagner ".$quantite." ".$nom." en votant pour le serveur."));
$connexion_5->call("runConsoleCommand", array("broadcast ".$pseudo." vient de gagner ".$quantite." ".$nom." en votant pour le serveur."));
$connexion_6->call("runConsoleCommand", array("broadcast ".$pseudo." vient de gagner ".$quantite." ".$nom." en votant pour le serveur."));
$connexion_7->call("runConsoleCommand", array("broadcast ".$pseudo." vient de gagner ".$quantite." ".$nom." en votant pour le serveur."));
$connexion_8->call("runConsoleCommand", array("broadcast ".$pseudo." vient de gagner ".$quantite." ".$nom." en votant pour le serveur."));
*/}
else
{
echo '<br /><div class="alert alert-success"><b> Succès</b> : Vous venez d\'obtenir le cadeau suivant : <b> '.$quantite.' '.$nom.' </b>.</div>';
$commande = str_replace('pseudo_var', $pseudo, $commande);
$connexion_1->call("runConsoleCommand", array("".$commande.""));
$connexion_1->call("runConsoleCommand", array("broadcast &c&lFélicitation &b&l".$pseudo." vient de gagner ".$quantite." ".$nom." en votant pour le serveur.));
}
$_SESSION['out'] = false;
}
}
else
{
echo '<br /><div class="alert alert-danger">Vous devez attendre 180 minutes afin de pouvoir revoter.</div>';
}
}
elseif ($_SESSION['out'] == false)
{
echo '<br /><div class="alert alert-danger"><b> Erreur</b>: Votre récompense a déjà été obtenue.</div>';
}
?>
語法高亮顯示了丟失的報價是:'$ connexion_1->通話(「runConsoleCommand 「),」 –