1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
<?php
$ip=$_SERVER['REMOTE_ADDR'];
if (isset($_SESSION['pseudo'])){
$username=$_SESSION['pseudo'];
$querypub="select * from publicite where valide=1 and ((aff<quantite and type='cpm') or (clic<quantite and type='clic') or type='regie') and NOT EXISTS (select * from cpmban where cpmban.idpub=publicite.idpub and datevue=CURDATE() and (ip='$ip' or pseudo='".mysql_real_escape_string($username)."')) order by rand() limit 1";
}
else {
$querypub="select * from publicite where valide=1 and ((aff<quantite and type='cpm') or (clic<quantite and type='clic') or type='regie') and NOT EXISTS (select * from cpmban where cpmban.idpub=publicite.idpub and datevue=CURDATE() and ip='$ip') order by rand() limit 1";
}
$resultpub = mysql_query($querypub, $connection) or die('error making query');
$affected_rowspub = mysql_num_rows($resultpub);
if ($affected_rowspub==0) {
echo '<p align="center"><img src="banniere1.gif" width="468" height="60" border="0"></p>';
exit();
}
else {
$datapub=mysql_fetch_array($resultpub);
if ($datapub[coderegie]=='') {
if ($datapub[lientexte]=='') {
echo '<p align="center"><a href="clicban.php?idpub='.$datapub[idpub].'" target="_blank"><img src="'.$datapub[banniere].'" width="'.$datapub[largeur].'" height="'.$datapub[hauteur].'" border="0"></a></p>';
}
else {
echo '<p align="center"><table width="468" border="0" cellspacing="0" cellpadding="0" height="60" bgcolor="#CCCCCC">
<tr>
<td height="55">
<div align="center">
<p align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><a href="clicban.php?idpub='.$datapub[idpub].'" target="_blank">'.$datapub[lientexte].'</a></b></font><br>
<font face="Geneva, Arial, Helvetica, san-serif" size="2">'.$datapub[html].'</font><br>
<font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><a href="clicban.php?idpub='.$datapub[idpub].'" target="_blank">'.$datapub[lien].'</a></b></font></p>
</div>
</td>
</tr>
<tr>
<td height="5" bgcolor="#006699">
<div align="right"><font color="#FFFFFF"><b><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Annonces
CASHOCLIC</font></b></font></div>
</td>
</tr>
</table></p>';
}
$querypub2="UPDATE publicite SET Aff = Aff + 1 where Idpub = $datapub[idpub]";
$resultpub2 = mysql_query($querypub2, $connection) or die('error making query');
$mois=date("n");
$annee=date("Y");
$querypub10="insert into statspub values ('$mois','$annee','0','1','$datapub[idpub]') ON DUPLICATE KEY update aff=aff+1";
$resultpub10 = mysql_query($querypub10, $connection) or die('error making query');
if (isset($_SESSION['pseudo'])){
$querypub3="select * from cpmban where idpub=$datapub[idpub] and (ip='$ip' or pseudo='".mysql_real_escape_string($username)."')";
}
else {
$querypub3="select * from cpmban where idpub=$datapub[idpub] and ip='$ip'";
}
$resultpub3 = mysql_query($querypub3, $connection) or die('error making query');
$affected_rowspub3 = mysql_num_rows($resultpub3);
if ($affected_rowspub3==0) {
if (isset($_SESSION['pseudo'])) {
$querypub4="INSERT INTO cpmban values ('','$datapub[idpub]','".mysql_real_escape_string($username)."','$ip',CURDATE(),1)";
}
else {
$querypub4="INSERT INTO cpmban values ('','$datapub[idpub]','','$ip',CURDATE(),1)";
}
$resultpub4 = mysql_query($querypub4, $connection) or die('error making query');
$queryact="insert into activite values('','".mysql_real_escape_string($username)."','$datapub[idpub]',NOW(),'','insertcpmban','$ip')";
$resultact = mysql_query($queryact, $connection) or die('error making query');
}
else {
if (isset($_SESSION['pseudo'])) {
$querypub4="UPDATE cpmban SET datevue=CURDATE(), pseudo='".mysql_real_escape_string($username)."', ip='$ip' where idpub=$datapub[idpub] and (ip='$ip' or pseudo='".mysql_real_escape_string($username)."')";
}
else {
$querypub4="UPDATE cpmban SET datevue=CURDATE() where idpub=$datapub[idpub] and ip='$ip'";
}
$resultpub4 = mysql_query($querypub4, $connection) or die('error making query');
$queryact="insert into activite values('','".mysql_real_escape_string($username)."','$datapub[idpub]',NOW(),'','updatecpmban','$ip')";
$resultact = mysql_query($queryact, $connection) or die('error making query');
}
}
else {
echo '<p align="center">'.$datapub[coderegie].'</p>';
}
}
?> |
Partager