session_start();
$session = session_id();
//include('f/fxml.php5');
include('class/mysql.class.php5');
/*function date_convert($Date)
{
$Temp_date = explode("-",$Date);
$New_date = "$Temp_date[2]/$Temp_date[1]/$Temp_date[0]";
return $New_date;
}
*/
//Version avec argument pass par valeur
function stripHTMLtags($texte){
//On retire le code HTML
$mots = explode("<",$texte);
$texte = "";
$nbmots = count($mots);
for ($m = 0; $m < $nbmots; $m++)
{
$mot = $mots[$m];
$finbalise = strpos($mot,">",0);
if ($finbalise > 0) { $mot = substr($mot,$finbalise+1); }
$texte .= "$mot";
}
return $texte;
}
//Version avec argument pass par rfrence
function stripHTMLtags_byref(&$texte){
//On retire le code HTML
$mots = explode("<",$texte);
$texte = "";
$nbmots = count($mots);
for ($m = 0; $m < $nbmots; $m++)
{
$mot = $mots[$m];
$finbalise = strpos($mot,">",0);
if ($finbalise > 0) { $mot = substr($mot,$finbalise+1); }
$texte .= "$mot";
}
}
function addDesc($page){
$mysql = new mysql;
$mysql->connect('');
//////////////////////////////////
// IF ARTISTE
if($_GET['rep'] == 'artistes'){
$dj = str_replace('-',' ',$_GET['nompage']);
$mysql->requete('SELECT * FROM `staff` WHERE active = "1" AND nom LIKE "%'.$dj.'%" ORDER BY id_staff ASC',1);
$r1 = $mysql->fetch_row(1);
echo stripHTMLtags($r1['bio_fr']);
}
//////////////////////////////////
// IF PRODUIT
if($_GET['catalogue'] != '' && $_GET['rep'] == 'shop' && $_GET['id_produit'] != ''){
$mysql->requete('SELECT * FROM `shop_articles` WHERE id_produit = "' . $_GET['id_produit'] . '"',1);
$r1 = $mysql->fetch_row(1);
$mysql->requete('SELECT * FROM `shop_catalogue` WHERE id_catalogue = "' . $_GET['id_catalogue'] . '"',2);
$r2 = $mysql->fetch_row(2);
echo stripHTMLtags($r1['commentaire'] . ' [ '. round($r1['prix'],2) .'Eur. ]');
}
//////////////////////////////////
// IF NEWS
if($_GET['rep'] == 'news'){
$mysql->requete('SELECT * FROM `news` WHERE id_news = "' . $_GET['id_news'] . '" AND active = "1"',1);
$r1 = $mysql->fetch_row(1);
echo stripHTMLtags($r1['infos']);
}
//////////////////////////////////
// IF MAILING
if($_GET['rep'] == 'news' && $_GET['id'] != ''){
$mysql->requete('SELECT * FROM `newsletter_envoi` WHERE id_newsletter="'.$_GET['id'].'"',1);
$r1 = $mysql->fetch_row(1);
echo stripHTMLtags($r1['fr']);
}
//////////////////////////////////
// IF LABEL
if($_GET['rep'] == 'label'){
$mysql->requete('SELECT * FROM `ebrec`',1);
$r1 = $mysql->fetch_row(1);
echo stripHTMLtags($r1['texte']);
}
//////////////////////////////////
// DESCRIPTION DUNE FICHE CLUB TOUR
if($_GET['cat'] == 'club-tour' && $_GET['etat'] != 'details'){
$mysql->requete('SELECT * FROM `type` WHERE id_type = "' . $_GET['id_type'] . '"',1);
$r1 = $mysql->fetch_row(1);
$mysql->requete('SELECT * FROM `agenda` WHERE id_type="'.$r1['id_type'].'" ORDER BY date ASC',2);
if($mysql->nbre_lignes(2) > 0){
while($r2 = $mysql->fetch_row(2)){
$mysql->requete('SELECT * FROM `club` WHERE id_club="'.$r2['id_club'].'"',4);
$r4 = $mysql->fetch_row(4);
$mysql->requete('SELECT * FROM `pays` WHERE id_pays ="'.$r4['id_pays'].'"',5);
$r5 = $mysql->fetch_row(5);
$agenda .= utf8_encode(ConvertDate($r2['date'])).' @ '.$r4['nom'].' // ';
}
}
echo $agenda;
}
//////////////////////////////////
// DESCRIPTION DUNE FICHE SOIREE AUTRE - ATTENTION A REVERIFIER !!
if($_GET['rep'] == 'evenements' && $_GET['cat'] != 'club-tour' && $_GET['etat'] != 'details'){
$mysql->requete('SELECT * FROM `type` WHERE id_type = "' . $_GET['id_type'] . '"',1);
$r1 = $mysql->fetch_row(1);
$mysql->requete('SELECT * FROM `agenda` WHERE id_type="'.$r1['id_type'].'" ORDER BY date ASC',2);
$r2 = $mysql->fetch_row(2);
$mysql->requete('SELECT * FROM `type` WHERE id_type="'.$r1['id_type'].'"',30);
$r30 = $mysql->fetch_row(30);
$mysql->requete('SELECT * FROM `club` WHERE id_club="'.$r2['id_club'].'"',4);
$r4 = $mysql->fetch_row(4);
$mysql->requete('SELECT * FROM `type_info` WHERE id_type="'.$r1['id_type'].'"',5);
$r5 = $mysql->fetch_row(5);
$infos .= ConvertDate($r2['date']).' - '.$r4['nom'].' - '.$r5['info'];
echo str_replace('"','',$infos) .' // Line Up : '. utf8_encode(str_replace(' ',' / ',$r5['dj']));
}
else if ($_GET['rep'] == 'accueil' || ($_GET['rep'] == 'shop' && $_GET['id_produit'] == '') || $_GET['rep'] == 'contact' || $_GET['rep'] == 'evenements') {
$mysql->requete('SELECT * FROM `meta`',11);
$r11 = $mysql->fetch_row(11);
echo stripHTMLtags(str_replace('"','',$r11['description']));
}
}
function redirection($page)
{
echo '';
}
function ConvertDate($value) {
// JOURS
$jours = array('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi');
$jours_numero = date('w', $value);
$jours_complet = $jours[$jours_numero];
// Numero du jour
$NumeroDuJour = date('d', $value);
// MOIS
$mois = array('', 'Janvier', 'Fvrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Aot', 'Septembre', 'Octobre', 'Novembre', 'Dcembre');
$mois_numero = date("n", $value);
$mois_complet = $mois[$mois_numero];
// ANNEE
$annee = date("Y", $value);
// DATE FULL
return $jours_complet .' '. $NumeroDuJour .' '. $mois_complet .' '. $annee;
}
function Cutxt($texte, $longeur_max)
{
if (strlen($texte) > $longeur_max)
{
$texte = substr($texte, 0, $longeur_max);
$dernier_espace = strrpos($texte, "");
$texte = substr($texte, 0, $dernier_espace)."...";
}
return $texte;
}
//fonction encode
/*function encode($pass_str)
{
$pass_coder = mcrypt_ecb(MCRYPT_TripleDES, "3t3rn4lbl1ss", $pass_str, MCRYPT_ENCRYPT);
return $pass_coder;
}
//fonction decode
function decode($pass_coder)
{
$pass_str = mcrypt_ecb(MCRYPT_TripleDES, "3t3rn4lbl1ss", $pass_coder, MCRYPT_DECRYPT);
return $pass_str;
}*/
function decode($str)
{
/* $filter = "eb";
$filter = md5($filter);
$letter = -1;
$newstr = '';*/
$str = base64_decode($str);
/*$strlen = strlen($str);
for ( $i = 0; $i < $strlen; $i++ )
{
$letter++;
if ( $letter > 31 )
{
$letter = 0;
}
$neword = ord($str{$i}) - ord($filter{$letter});
if ( $neword < 1 )
{
$neword += 256;
}
$newstr .= chr($neword);
}*/
return $str;
}
function encode($str)
{
/*$filter = "eb";
$filter = md5($filter);
$letter = -1;
$newpass = '';
$strlen = strlen($str);
for ( $i = 0; $i < $strlen; $i++ )
{
$letter++;
if ( $letter > 31 )
{
$letter = 0;
}
$neword = ord($str{$i}) + ord($filter{$letter});
if ( $neword > 255 )
{
$neword -= 256;
}
$newstr .= chr($neword);
}*/
return base64_encode($str);
}
function ConvertChar($value) {
$replace = Array ("","","","","","","","","","","","","","","","","","z","Y;","i","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","A","A","A","A","A","A","A","C","E","E","E","E","l","l","l","l","","N","O","O","O","O","O","","O","U","U","U","U","Y","","b","a","a","a","a","a","a","o","c","e","e","e","e","i","i","i","i","","n","o","o","o","o","o","","","u","u","u","u","y","","y","a","","","","","");
$search = Array ("&","<",">","^","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","@","'","\""," ","/","#");
return str_replace($search, $replace, $value);
}
function MiniConvertChar($value) {
$replace = Array ("","","","","","","","","","","","","","","","","","z","Y;","i","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","A","A","A","A","A","A","A","C","E","E","E","E","l","l","l","l","","N","O","O","O","O","O","","O","U","U","U","U","Y","","b","a","a","a","a","a","a","o","c","e","e","e","e","i","i","i","i","","n","o","o","o","o","o","","","u","u","u","u","y","","y","a","","","-","","","");
$search = Array ("&","<",">","^","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","@","'","\""," ","/","%","#");
return str_replace($search, $replace, $value);
}
function dateFr($time) {
$label_mois = array(1=>"Janvier","Fvrier","Mars","Avril","Mai","Juin","Juillet","Aot","Septembre","Octobre","Novembre","Dcembre");
//return $label_mois[$mois];
return date('d',$time).' '.$label_mois[date('n',$time)].' '.date('Y',$time);
}
function moisFr($mois) {
$label_mois = array(1=>"Janvier","Fvrier","Mars","Avril","Mai","Juin","Juillet","Aot","Septembre","Octobre","Novembre","Dcembre");
return $label_mois[$mois];
//return date('d',$time).' '.$label_mois[date('n',$time)].' '.date('Y',$time);
}
function count_files($dir)
{
$num = 0;
$dir_handle = opendir($dir);
while($entry = readdir($dir_handle))
if(is_file($dir.'/'.$entry))
$num++;
closedir($dir_handle);
return $num;
}
function mailing($to, $sujet, $message, $prev=0){
$mysql = new mysql;
$mysql->connect('');
$mysql->requete('SELECT * FROM `'.$_GET['bdd'].'`',7);
$total = $mysql->nbre_lignes(7);
$mysql->requete('SELECT * FROM `newsletter_envoi` ORDER by id_newsletter DESC',11);
$r11 = $mysql->fetch_row(11);
$id_news = $r11['id_newsletter'];
$mysql->requete('SELECT * FROM `emailing` WHERE email="'.$to.'"',12);
$r12 = $mysql->fetch_row(12);
$id_emailing = $r12['id_emailing'];
$header_email = '