File "inc.inc"

Full path: /home/meharicl/www/BDD_MCDF_2010/inc.inc
File size: 4.4 B
MIME-type: text/html
Charset: 8 bit

Download   Open   Edit   Advanced Editor   Back

<? 
/* - - - - - - - - - - - - - - - - - - - - - - -
 Include PHP
 mardi 28 septembre 2010 20:31:49
 HAPedit 3.1.11.111
 - - - - - - - - - - - - - - - - - - - - - - - */
 function connect()
{
// Paramtres persos
$host = "sql4"; // voir hbergeur
$user = "mehariclubdd"; // vide ou "root" en local
$pass = "OoCLcS5Z"; // vide en local
$bdd = "mehariclubdd"; // nom de la BD
// connexion
@mysql_connect($host,$user,$pass)
   or die("Impossible de se connecter 1");
@mysql_select_db($bdd)
   or die("Impossible de se connecter 2");
   //echo('Connexion OK');
}

function init()
{
  $handle = fopen("bdd_mcdf.csv", "r");
  $vrac=fgetcsv($handle,10000000,";");
  echo($vrac[0]);
  for($line=0;$line<1000;$line++)
      {
          $vrac=fgetcsv($handle,10000000,";");
          if (count($vrac)!=1)
             {
                 if(strlen($vrac [9])<5) { $vrac [9]='0'.$vrac[9];
                 echo ($vrac [9].'-'.strlen($vrac [9]).'<br>'); }
                 $query="INSERT INTO `mehariclubdd`.`Annuaire` (`Id_Adh` ,`Pseudo` , `Public`,`Cotisation` ,`Prenom` ,`Nom` ,`Adresse-1` ,`Adresse-2` ,`Ville` ,`CP` ,`Pays` ,`Tel-1`,`Tel-2`,`Mail` )VALUES (";
                 $query.=$vrac[0].", '".$vrac[2]."','".$vrac[1]."','".$vrac[3]."', '".$vrac[4]."','".$vrac[5]."', '".$vrac[6]."','".$vrac[7]."', '".$vrac[8]."','".$vrac[9]."', '".$vrac[10]."','".$vrac[11]."','".$vrac[12]."','".$vrac[13]."');";
                 mysql_query($query);


                 echo($query.'<br>');

              }
       }
}


function get_annuaire(&$annuaire)
{
$annuaire=mysql_query("SELECT * FROM `Annuaire` ORDER BY `Annuaire`.`Nom` ASC");

return;
}
function recup_mail()
{
$query="SELECT * FROM `Annuaire` ";
$liste= mysql_query($query);

while($result=mysql_fetch_array($liste))
{
if( strlen ($result['Pseudo'])>1)
          {
          $query2="SELECT * FROM `phpbb3_users`WHERE `username` LIKE '%".$result['Pseudo']."%' ";
          $liste2=mysql_query($query2);
          if ($result2=mysql_fetch_array($liste2))
          {
          $query3="UPDATE `mehariclubdd`.`Annuaire` SET `Mail` = '".$result2['user_email']."' WHERE `Annuaire`.`Pseudo`='".$result['Pseudo']."';";
          mysql_query($query3);
          }
          else
          {
          $query3="UPDATE `mehariclubdd`.`Annuaire` SET `Mail` = '"."***@**'"."' WHERE `Annuaire`.`Pseudo`='".$result['Pseudo']."';";
          echo($query3);
          mysql_query($query3);
          echo('<br>');
          };

          }
};
};
function get_new_user_id()
{
$sql = 'SELECT MAX(Id_Adh)FROM (Annuaire)';
$result=mysql_query($sql);
$max=mysql_fetch_array($result);
return $max[0]+1;
}
function affiche_m($annuaire)
{
echo("<table ><tr>");
echo("<tr bgcolor=##FF9900><td>Id Adhrent</td><td>Nom</td><td>Prenom</td><td>Pseudo</td><td>Telephone</td><td>Mail</td><td>Adresse</td><td>Cotisation</td></tr>");
echo("</tr>");
while
($result=mysql_fetch_array($annuaire))
{
echo("<tr bgcolor=##FF9900><td><a href='modification.php?id=".$result['Id_Adh']."'>".$result['Id_Adh']."</a></td><td>".$result['Nom']."</td><td>".$result['Prenom']."</td><td>".$result['Pseudo']."</td><td>".$result['Tel-1']."</td><td>".$result['Mail']);
echo("</td><td>".$result['Adresse-1'].'<br>'.$result['Adresse-2']."<br>".$result['Ville']." ".$result['CP'].'<br>'.$result['Pays']."</td><td>".$result['Cotisation']."</td></tr>");
}
echo("</table>");
}
function affiche($annuaire)
{

echo("<table >");
echo("<tr bgcolor=##FF9900><td>Id Adhrent</td><td>Nom</td><td>Prenom</td><td>Pseudo</td><td>Telephone 1</td><td>Telephone 2</td><td>Mail</td><td>Adresse</td><td>Cotisation</td></tr>");

//echo('<tr><td  colspan="8" height="1">**<img src="http://www.mehariclubdefrance.com/phpBB3/images/spacer.gif" alt="" width="1" height="1" /></td></tr>');

while
($result=mysql_fetch_array($annuaire))
{
echo("<tr bgcolor=##FF9900><td>".$result['Id_Adh']."</td><td>".$result['Nom']."</td><td>".$result['Prenom']."</td><td>".$result['Pseudo']."</td><td>".$result['Tel-1']."</td><td>".$result['Tel-2']."</td><td > ".$result['Mail']);
echo("</td><td>".$result['Adresse-1'].'<br>'.$result['Adresse-2']."<br>".$result['Ville']." ".$result['CP'].'<br>'.$result['Pays']."</td><td>".$result['Cotisation']."</td></tr>");
//echo('<tr><td  colspan="8" height="1"><img src="http://www.mehariclubdefrance.com/phpBB3/images/spacer.gif" alt="" width="1" height="1" /></td></tr>');
}

echo("</table>");
}
?>