Problème variable qui ne prend pas en compte

Par Yubo, il y a 10 ans


Bonjour,
j'était entrain de bidouiller un script irc pour mon site.
Le paramètre $_GET['message'] fonctionne mais quand je passe mon script avec deux paramètres (c'est-à-dire $_GET['message'] et $_GET['channel']) il n'envoi pas le message sur la chaîne

<?php $ircChannel = $_GET['channel']; set_time_limit(0); $socket = fsockopen("irc.twitch.tv", 6667); fputs($socket,"USER aZp_BOT\n"); fputs($socket,"PASS oauth:c4hqxdusnwezb138faid2jmypidsli\n"); fputs($socket,"NICK aZp_BOT\n"); fputs($socket,"JOIN #$ircChannel\n"); while($data = fgets($socket, 128)) { $msg = $_GET['message']; fwrite($socket, "PRIVMSG " . $ircChannel . " :" . $msg . "\n"); die('envoyé'); } ?>

comme je l'ai dit, si je met juste message en paramètre, le script fonctionne bien.

<?php set_time_limit(0); $socket = fsockopen("irc.twitch.tv", 6667); fputs($socket,"USER aZp_BOT\n"); fputs($socket,"PASS oauth:c4hqxdusnwezb138faid2jmypidsli\n"); fputs($socket,"NICK aZp_BOT\n"); fputs($socket,"JOIN #azp_tv\n"); $ircChannel = "#azp_tv"; while($data = fgets($socket, 128)) { $msg = $_GET['message']; fwrite($socket, "PRIVMSG " . $ircChannel . " :" . $msg . "\n"); die('envoyé'); } ?>

Merci!

2 réponses

Yubo, il y a 10 ans

Hey Martin!
Tu me sauves, je suis vraiment un bouffon de première... Il manquais bien le #!

Merci beaucoup!