Le forum officiel du site, discussions, aide, astuces...
Vous n'êtes pas identifié.
Voici les script php pour utiliser icecast et l'url authentification avec vBulletin. Donc on commence 
tous d'abort crée un fichier action.txt et a l'interieur de se fichier vous aller mettre les ligne suivante puis vous aller le renommer en action.php:
<?php
// Specific license do not distrib only for http://www.wrestling-stream.com
require_once('./global.php');
require_once(DIR . '/includes/functions_login.php');
// Authorisation configuration
$authorized_groups = array('groupe 1', 'groupe 2', 'groupe 3','groupe 4');
$authorized_users = array('user');
// Action configuration
$listener_add = "listener_add";
$listener_remove = "listener_remove";
$mount_add = "mount_add";
$mount_remove = "mount_remove";
// ##################### Check for a valid auth #####################
// Security :
// username :
// use in $vbulletin->db->query_first securized with escape_string(htmlspecialchars_uni($username)
// password :
// use in md5
// authorized_groups : Admin created
// authorized_users : Admin created
function icecast_verify_vb_auth($username, $password, $authorized_groups, $authorized_users) {
global $vbulletin;
$username = strip_blank_ascii($username, ' ');
// Get the user info if he exists
// Security username checked
if ($vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'")) {
if (($password != '') && // Sanity checks
($vbulletin->userinfo['password'] == iif($password, md5(md5($password) . $vbulletin->userinfo['salt']), ''))) {
// Authentification OK
// FIXME logs
// Checking authorization
$membergroups = explode(',', str_replace(' ', '', $vbulletin->userinfo['membergroupids']));
// Check for groups authorization
foreach ($membergroups as $group) {
foreach ($authorized_groups as $ok_group) {
if ($vbulletin->usergroupcache[$group]['title'] == $ok_group) {
return true;
}
}
}
foreach ($authorized_groups as $ok_group) {
if ($vbulletin->usergroupcache[$vbulletin->userinfo['usergroupid']]['title'] == $ok_group) {
return true;
}
}
// Check for users authorization
foreach ($authorized_users as $ok_user) {
if ($username == $ok_user) {
return true;
}
}
// Not authorized
return false;
}
}
// Authentification not OK
// FIXME logs
return false;
}
// ######################### Sanity checks ##########################
// Performing sanity checks on inputs variables
function icecast_sanity_checks($action, $mount, $username, $password) {
// Check if $action is set
if ($action == '') {
header('icecast-auth-user: 0');
header('icecast-auth-message: action not supplied');
exit;
}
// Check if $mount is set
if ($mount == '') {
header('icecast-auth-user: 0');
header('icecast-auth-message: mount not supplied');
exit;
}
// Check if $username is set
if ($username == '') {
header('icecast-auth-user: 0');
header('icecast-auth-message: username not supplied');
exit;
}
// Check if $password is set
if ($password == '') {
header('icecast-auth-user: 0');
header('icecast-auth-message: password not supplied');
exit;
}
}
// Gets Icecast varibles
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
$duration = isset($_REQUEST['duration']) ? $_REQUEST['duration'] : '';
$mount = isset($_REQUEST['mount']) ? $_REQUEST['mount'] : '';
$password = isset($_REQUEST['pass']) ? $_REQUEST['pass'] : '';
$port = isset($_REQUEST['port']) ? $_REQUEST['port'] : '';
$server = isset($_REQUEST['server']) ? $_REQUEST['server'] : '';
$username = isset($_REQUEST['user']) ? $_REQUEST['user'] : '';
// Sanity checks exit on error
icecast_sanity_checks($action, $mount, $username, $password);
// Specifics actions code
switch ($action) {
case $mount_add:
case $mount_remove:
header('icecast-auth-message: OK');
break;
case $listener_add:
// FIXME logs
if (icecast_verify_vb_auth($username, $password, $authorized_groups, $authorized_users)) {
// Identification successful
header('icecast-auth-user: 1');
header('icecast-auth-message: OK');
} else {
header('icecast-auth-user: 0');
header("icecast-auth-message: bad username or password");
}
break;
case $listener_remove:
// FIXME logs
header('icecast-auth-message: OK');
break;
}
?>
ensuite vous avez juste a modifier les ligne suivante pour configure le script
// Authorisation configuration
$authorized_groups = array('groupe 1', 'groupe 2', 'groupe 3','groupe 4');
$authorized_users = array('user');
et modifier seulement les groupe d'utilisateur. une fois la modification des groupe d'utilisateur effecteur vous pouvez uploader le fichier action.php dans le repertoire root de votre forum (ou il y a index.php)
maintenant nous allons crée un point dans le fichier icecast.xml
<mount>
<mount-name>/example-complex.nsv</mount-name>
<stream-name>My audio stream</stream-name>
<stream-description>My audio description</stream-description>
<stream-url>http://some.place.com</stream-url>
<genre>classical</genre>
<bitrate>64</bitrate>
<authentication type="url">
<option name="mount_add" value="http://www.domaine.com/forum/action.php" />
<option name="mount_remove" value="http://www.domaine.com/forum/action.php" />
<option name="listener_add" value="http://www.domaine.com/forum/action.php" />
<option name="listener_remove" value="http://www.domaine.com/forum/action.php" />
</authentication>
</mount>la version de icecast utiliser et la version Icecast 2.3.1 donc si vous utiliser une version plus recente il se peut quel se script ne fonctionne pas
laisser vos commentaire 
Dernière modification par takerman (31-05-2008 16:35:18)
Hors ligne
Je me suis permis de déplacer ton post dans le topic qui me semblait plus approprié que celui des scripts d'informations.
Il me semble que tu ne respecte pas l'accord plus haut ?
// Specific license do not distrib only for http://www.wrestling-stream.com
En tout cas, c'est une mise en application intéressante de l'authentification déporté sur URL d'Icecast.
IceCast est en 2.3.1 depuis 2005 et n'a toujours pas évolué...
Hors ligne
alors le site Wrestling-Stream.Com et mon site internet ^^ donc ya aucun probleme
oui je c'est que icecast 2.3.1 et la depuis 2005 mais j'ai prefere mettre sa pour l'avenir
Dernière modification par takerman (31-05-2008 19:05:36)
Hors ligne
takerman a écrit:
alors le site Wrestling-Stream.Com et mon site internet ^^ donc ya aucun probleme
Cela aide, effectivement
Merci de partager ce script avec nous 
Hors ligne