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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
| <?php
include("connect_click.php");
//connexion a la BDD
$db=mysql_connect($mysql_host,$mysql_login,$mysql_pass);
mysql_select_db($mysql_dbnom,$db);
// verification du mot de passe *************************************************************************
if ($pass!=$mysql_pass)
{
print "
<table width=100% height=100% border=0>
<tr>
<td><form name=form1 method=post action=admin_click.php>
<div align=center>
<p class=Style1><strong>Acces a l'administration du compteur de click</strong></p>
<p class=Style1>Mot de passe administrateur (le meme que celui de la base mysql) </p>
<p>
<input name=pass type=password id=pass>
<input type=submit name=Submit value=Envoyer>
</p>
</div>
</form></td>
</tr>
</table>
</body>
</html>
";
exit;
}
// ajout d'un lien ************************************************************************************
if ($action=="ajouter")
{
$sql="insert into compteur_click values (0,'$text_nom','$text_url',$text_compteur)";
$res=mysql_query($sql, $db);
if ($res==1)
{print "Ajout effectué avec succès";}
else
{
{print "Erreur pour ajouter";}
}
}
//Supprimer un lien ***********************************************************************************
if ($action=="supprimer")
{
$sql="delete from compteur_click where ID=$id";
$res=mysql_query($sql, $db);
if ($res==1)
{print "Suppression effectuée avec succès";}
else
{
{print "Erreur pour supprimer";}
}
}
//Modifier url par defaut ***********************************************************************************
if ($action=="modifier_url_default")
{
$sql="update compteur_click set URL='$text_url_default' where ID=1";
$res=mysql_query($sql, $db);
if ($res==1)
{print "Modification effectuée avec succès";}
else
{
{print "Erreur pour modifier";}
}
}
//desinstaller l'application ***********************************************************************************
//on efface que la base de donnée
if ($action=="desinstaller")
{
$sql="drop table compteur_click";
$res=mysql_query($sql, $db);
if ($res==1)
{
print "<div align=\"center\">
<p> </p>
<p> </p>
<p><font size=\"5\"><i><font color=\"#FF0000\">Désinstallation reussi </font></i></font></p>
</div>";
}
else
{
print"<div align=\"center\">
<p> </p>
<p> </p>
<p><font size=\"5\"><i><font color=\"#FF0000\">Désinstallation échouée </font></i></font></p>
<p><font size=\"5\" color=\"#000000\"><b><a href=\"admin.php\">revenir</a></b></font></p>
</div>";
}
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Compteur liens sortants manuels</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
<link href="../../essai.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="1" cellspacing="10" bordercolor="#FFFFFF">
<tr>
<td bordercolor="#000000" class="verdana12seul"><form name="form1" method="post" action="admin_click.php">
<p align="center"><span class="Style12"><span class="Style11"><strong>Ajouter un compteur sur un lien </strong></span></span></p>
<p align="center"><span class="Style12">URL</span><span class="verdana11seul"> (vous pouvez mettre un chemin relatif)</span> :
<input name="text_url" type="text" id="text_url" value="<?php echo $url_default; ?>" size="100">
</p>
<p align="center">
<span class="Style12">NOM (nom du fichier ou de la page web)</span> :
<input name="text_nom" type="text" id="text_nom" size="40">
<br>
</p>
<p align="center"><span class="Style12">COMPTEUR (nombre avec lequel le compteur va démarrer)</span> :
<input name="text_compteur" type="text" id="text_compteur" value="0" size="10">
<input name="pass" type="hidden" id="pass" value="<?php echo $mysql_pass; ?>">
<input name="action" type="hidden" id="action" value="ajouter">
</p>
<p align="center">
<input name="Submit" type="submit" onClick="MM_validateForm('text_nom','','R','text_compteur','','RisNum');return document.MM_returnValue" value="Ajouter">
</p>
</form></td>
<td width="170" align="center" valign="top" bordercolor="#000000" class="verdana12seul" ><p><strong>Mettre dans le href </strong> </p>
<p> </p>
<p>click.php?id=39</p>
<p> </p>
<p>en modifiant <br>
évidemment l'ID !</p></td>
</tr>
</table>
<?php
// Modification lien ***************************************************************************
if ($action=="modifier")
{
if ($action2=="enregistrer")
{
$sql_click="update compteur_click set URL='$text_url',NOM='$text_nom',COMPTEUR='$text_compteur' where ID='$text_id'";
if ($res=mysql_query($sql_click, $db)) {print "Modification reussie";}
else {print "Modification echouée";}
}
else
{
$sql_click="select * from compteur_click where ID='$id'";
$res=mysql_query($sql_click, $db);
$ligne = mysql_fetch_object ($res); ?>
<table width="100%" border="1" cellpadding="0" cellspacing="20" bordercolor="#FFFFFF">
<tr>
<td bordercolor="#000000"><form name="form1" method="post" action="admin_click.php">
<p align="center"><span class="Style12">URL</span>
<input name="text_url" type="text" id="text_url3" value="<?php echo $ligne->URL; ?>" size="100">
</p>
<p align="center"> <span class="Style12">NOM (nom du fichier ou de la page web)</span> :
<input name="text_nom" type="text" id="text_nom3" value="<?php echo $ligne->NOM; ?>" size="40">
</p>
<p align="center"><span class="Style12">COMPTEUR (nombre avec lequel le compteur va démarrer)</span>
<input name="text_compteur" type="text" id="text_compteur3" value="<?php echo $ligne->COMPTEUR; ?>" size="10">
<input name="pass" type="hidden" id="pass3" value="<?php echo $mysql_pass; ?>">
<input name="action" type="hidden" id="action4" value="<?php print "modifier" ?>">
<input name="action2" type="hidden" id="action2" value="<?php print "enregistrer" ?>">
<input name="text_id" type="hidden" id="text_id" value="<?php echo $ligne->ID ?>">
</p>
<p align="center">
<input name="Submit" type="submit" onClick="MM_validateForm('text_nom','','R','text_compteur','','RisNum');return document.MM_returnValue" value="Enregistrer la modification">
</p>
</form></td>
</tr>
</table>
<form action="admin_click.php" method="post" name="rafraichir" id="rafraichir">
<div align="center">
<input type="submit" name="Submit2" value="Retourner a l'administration">
<input name="pass" type="hidden" id="pass" value="<?php echo $mysql_pass ?>">
</div>
</form>
<p> </p>
<?php
print "</body></html>";
exit;
}
}
// fin modification *********************************************************************************
?>
<form action="admin_click.php" method="post" name="rafraichir" id="rafraichir">
<div align="center">
<input name="pass" type="hidden" id="pass" value="<?php echo $mysql_pass ?>">
<input type="submit" name="Submit2" value="---- Rafraichir la page ----">
</div>
</form>
<p align="center" class="Style15">Pour visualiser le code à mettre cliquer l'ID du lien.</p>
<table width="100%" border="0" cellspacing="0">
<tr><td >
<table width="100%" border="1" cellspacing="0" bordercolor="#000000" class="verdana12">
<?php
//On recupere l'url par defaut
$sql_click="select URL from compteur_click where ID='1'";
$res=mysql_query($sql_click, $db);
$ligne = mysql_fetch_object ($res);
$url_default=$ligne->URL;
//on recupere tous les liens des telechargements sauf le 1er
$sql_click="select * from compteur_click where ID!='1' order by ID desc";
$res=mysql_query($sql_click, $db);
while($ligne = mysql_fetch_object ($res))
{
?>
<tr>
<td width="7%" bordercolor="#000000"><div align="center"><span class="Style9">
<a class="texte" href="<?php print "admin_click.php?pass=$mysql_pass&action=demo&id=$ligne->ID"; ?>"><?php echo $ligne->ID; ?></a></span></div></td>
<td width="60%" height="23" bordercolor="#000000"><div align="left"><span class="Style9">
<a class="texte" href="<?php print "$ligne->URL$ligne->NOM"; ?>" target="_blank">
<?php print "$ligne->URL$ligne->NOM"; ?></a></span></div></td>
<td width="10%" bordercolor="#000000"><div align="center"><span class="Style9"><?php echo $ligne->COMPTEUR; ?></span></div></td>
<td width="11%"><div align="center"><span class="Style9">
<a href="<?php print "admin_click.php?pass=$mysql_pass&action=modifier&id=$ligne->ID"; ?>" class="verdana12">Modifier</a></span></div></td>
<td width="12%"><div align="center"><span class="Style9">
<a href="<?php print "admin_click.php?pass=$mysql_pass&action=supprimer&id=$ligne->ID"; ?>" target="_parent" class="verdana12">Supprimer</a></span></div></td>
</tr>
<?php }?>
</table>
<table width="100%" border="1" cellspacing="0" bordercolor="#000000">
<tr>
<td bordercolor="#FFFFFF"><form name="form2" method="post" action="">
<div align="center"><span class="Style12">URL par défaut</span>:
<input name="text_url_default" type="text" id="text_url_default3" value="<?php echo $url_default; ?>" size="80">
<input type="submit" name="Submit3" value="modifier">
<input name="pass" type="hidden" id="pass" value="<?php echo $mysql_pass ?>">
<input name="action" type="hidden" id="action5" value="modifier_url_default">
</div>
</form></td>
</tr>
</table>
</td></tr></table>
<?php //Demo Code a ajouter *******************************************************************************
if ($action=="demo")
{
$sql_click="select * from compteur_click where ID='$id'";
$res=mysql_query($sql_click, $db);
$ligne = mysql_fetch_object ($res);
?>
</body>
</html> |
Partager