garancia-pharmaciens/httpdocs/actualites.php
2017-05-30 17:55:38 +02:00

169 lines
4.3 KiB
PHP
Executable File

<?php
/*-----------------------------------------------------*/
include_once("_inc/config.php");
/*-----------------------------------------------------*/
/////////////////////////////////////////////////////////////////////////////
// ACTIONS
if(isset($_POST['action'])){
header("Content-type: application/json");
echo '{"results":{';
switch($_POST['action']){
case "inscription" :
$lastname = sqlEscape($_POST['lastname']);
$firstname = sqlEscape($_POST['firstname']);
$mobile = sqlEscape($_POST['mobile']);
$birthdate = sqlEscape($_POST['birthdate']);
$email = sqlEscape($_POST['email']);
$opt_sms = sqlEscape($_POST['opt_sms']);
$opt_email = sqlEscape($_POST['opt_email']);
$filename = sqlEscape($_POST['filename']);
//uploader fichier !!
$tmpArray = explode(".", $filename);
$ext = strtolower(end($tmpArray));
$pharmacie = getPharmacieByCode($_SESSION["gar_front_code_client"]);
$newFilename = $pharmacie -> id . "." . $ext;
$filePath = "files/ambassadeurs/sell_out/" . $newFilename;
if(file_exists($filePath))unlink($filePath);
copy("tmp/" . $filename,$filePath);
unlink("tmp/" . $filename);
$query = "UPDATE `".$GLOBALS['sql_prefixe']."pharmacies`
SET
`ambassadeur` = '1' ,
`ambassadeur_lastname` = '".$lastname."' ,
`ambassadeur_firstname` = '".$firstname."' ,
`ambassadeur_mobile` = '".$mobile."' ,
`ambassadeur_birthdate` = '".$birthdate."' ,
`ambassadeur_email` = '".$email."' ,
`ambassadeur_opt_sms` = '".$opt_sms."' ,
`ambassadeur_opt_email` = '".$opt_email."' ,
`ambassadeur_sell_out_file` = '".$newFilename."'
WHERE `code_client` = '".$_SESSION["gar_front_code_client"]."' ;";
$result = mysql_query($query);
if(!$result){
echo '"error":"Inscription impossible..."';
echo "}}";
exit();
}
echo '"complete":"1"';
break;
}
echo "}}";
exit();
}
//////////////////////////////////////////////////////////
$_RUBRIQUE = "actualites";
/*-----------------------------------------------------*/
include_once("_inc/assets/metas.php");
include_once("_inc/assets/top.php");
/*-----------------------------------------------------*/
?>
<div class="page">
<div id="arianne">
<a href="home.php">Accueil</a> |
<!-- <a href="le-conseil-des-mages.php">Informez-vous</a> | -->
<span class="current">Actualités</span>
</div>
<div class="page_menu">
<!-- <a href="le-conseil-des-mages.php"><span>Le Conseil des Mages</span></a>
<a href="le-cercle-des-ambassadeurs.php"><span>Le Cercle des Ambassadeurs</span></a>
-->
<a href="actualites.php" class="current"><span>Actualités</span></a>
</div>
<div class="clear"></div>
<div class="page_contents">
<?php
$items = getFrontActualites();
foreach($items as $item){
?>
<div class="actualite">
<div class="visuel"><img src="files/actualites/<?php echo $item -> id; ?>.jpg" /></div>
<div class="infos">
<div class="date"><?php echo $item -> date; ?></div>
<div class="title"><?php echo $item -> title; ?></div>
<div class="description ctn"><?php echo $item -> description; ?></div>
<?php if($item -> btn_contact){ ?>
<div class="btnCtn">
<a href="contact.php" class="btnRightArrow">contactez-nous pour EN SAVOIR PLUS</a>
</div>
<?php } ?>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<?php } ?>
</div>
</div>
<script type="text/javascript">
function centerText(){
$(".actualite").each(function(index, element) {
var h = $(this).innerHeight();
var txtH = $(this).find(".infos").innerHeight();
if(txtH < h){
var t = Math.round((h - txtH) / 2);
$(this).find(".infos").css("margin-top",t + "px");
}
});
}
centerText();
setTimeout(centerText,2000);
setTimeout(centerText,5000);
setTimeout(centerText,10000);
setTimeout(centerText,15000);
setTimeout(centerText,20000);
setTimeout(centerText,30000);
</script>
<?php
/*-----------------------------------------------------*/
include_once("_inc/assets/footer.php");
/*-----------------------------------------------------*/
?>