Bonsoir, j'utilise une api de vote ( serveur privé.net) et je voudrais pour le coup ajouter a chaque vote un certains nombres de points au compte de la personne qui vote, cependant ma méthode ne semble pas fonctionner et je ne comprend pas pourquoi pour le coup.
function SpNetVote($id){
global $bdd;
global $tokenvote2;
if($_POST){
if($json_data->status == 1) {
$findaccount = $bdd->prepare('SELECT * FROM ox_webaccount WHERE id=?');
$findaccount -> execute(array ($id));
$find = $findaccount->fetch();
$nbrvotes = $find['vote'] + 1;
$nbrpoints = $find['token'] + $tokenvote2;
$newtokens = $bdd->prepare('UPDATE ox_webaccount SET token=? WHERE id=?');
$newtokens->bindvalue(1, $nbrpoints, PDO::PARAM_STR);
$newtokens->bindvalue(2, $id, PDO::PARAM_STR);
$newtokens->execute();
$newvote = $bdd->prepare('UPDATE ox_webaccount SET vote=? WHERE id=?');
$newvote->bindvalue(1, $nbrvotes, PDO::PARAM_STR);
$newvote->bindvalue(2, $id, PDO::PARAM_STR);
$newvote->execute();
header('Location: http://hecateserveur.ddns.net/index.php?page=vote_confirmation2');
echo "<script>
document.getElementById('inscrip_error').innerHTML = \"<img src='look/img/work.png' style='width: 32px; margin-left: -38px; position: absolute; margin-top: 2px;'>Félicitations : Votre vote a bien été pris en compte.</br><div id='myProgress'><div id='myBar'></div></div><style>#inscrip_error{background-color: #38dd2c;}#myBar{background-color: rgba(255, 255, 255, 0.5);}</style>\";
setTimeout(function() {
document.getElementById('inscrip_error').innerHTML = \"\";
},7000);
move();
</script>
";
}
else {
echo "<script>
document.getElementById('inscrip_error').innerHTML = \"<img src='look/img/error.png' style='width: 32px; margin-left: -38px; position: absolute; margin-top: 2px;'>Erreur : Il vous reste ". $json_data->nextvote ." minutes avant de voter.</br><div id='myProgress'><div id='myBar'></div></div>\";
setTimeout(function() {
document.getElementById('inscrip_error').innerHTML = \"\";
},7000);
move();
</script>
";
}
}
}
si l'un d'entre vous peux m'éclairer je vous remercie d'avance.