Sistema de Afiliados
1.-Crear una tabla en mysql
Cita:
CREATE TABLE links (
id int(11) NOT NULL auto_increment,
name char(20) NOT NULL,
web char(32) NOT NULL,
img char(80) NOT NULL,
webmaster char(20) default NULL,
PRIMARY KEY (id)
);
|
2.-Se pone un marquee donde saldran los afiliados
Cita:
<?
//Comienzo al marquee en donde estaran rodando todos los links..
echo"
<MARQUEE behavior= \"scroll\" align= \"center\" direction= \"up\" height=\"85\" scrollamount= \"1\" scrolldelay= \"20\" onmouseover='this.stop()' onmouseout='this.start()' width=\"103\">
<center>
";
//Incluyo alllinks.php que sera quien me dira cuales son todos los links.
include("alllinks.php");
//Cierro el marquee y cierro la centralización.
echo"
</center></marquee>
";
?>
|
3.-Crear el archivo alllinks.php
Cita:
<?
$dbhost="localhost"; // Aqui la url del BD,por default localhost
$dbuser="omar"; // Asigno el user.
$dbpass="***"; // Asigno la contraseña.
$db="omar"; // Asigo la BD
$conecta = mysql_connect($dbhost,$dbuser,$dbpass); // Conecto a MySQL.
mysql_select_db($db,$conecta); // Selecciono la ddb
$query = "select * from links order by id desc"; // Ordeno por ID todos los links
$resp = mysql_query($query); // Mando el query
while ($link = mysql_fetch_array($resp)) { //Un while que pondra todas los enlazes aqui.
// Aqui con este echo pongo el banner. Al poner el raton encima del banner saldra por ejemplo. Pkfuture - Quevon24 - WebMaster.
echo "
<a target=\"_blank\" href=\"$link[web]\"><img border=\"0\" src=\"links/$link[img]\" width=\"88\" height=\"31\" alt=\"$link[name] - $link[webmaster]\"></a><br><br>
";
} // Cierro el while que abri arriba
|
4.-Se crea el archivo admin.php
Cita:
<?
$dbhost="localhost"; // Aqui la url del BD,por default localhost
$dbuser="omar"; // Asigno el user.
$dbpass="***"; // Asigno la contraseña.
$db="omar"; // Asigo la ddb
$conecta = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($db,$conecta);
$a=mysql_query("select * from users where login='$_COOKIE[login]'");
$r=mysql_fetch_array($a);
// SOlo los usuarios que tengan en la tabla de users el nivel 10 en el apartado admins podran accesar a esta sección .
if (($_COOKIE[login] == $r[login]) && ($r[pass] == $_COOKIE[pass]) && ($r[admin] == "10")) { //Formula para añadir afiliado
echo"
<center>:: Añadir Afiliado ::</center><br>
<form method=\"post\" action=\"index.php?c=admin\">
<p align=\"center\">
Nombre Web:<br>
<input type=\"text\" name=\"nweb\" size=\"20\"><br>
Nombre Imagen:<br>
<input type=\"text\" name=\"nimg\" size=\"20\"><br>
Dirección:<br>
<input type=\"text\" name=\"dir\" size=\"20\"><br>
WebMaster:<br>
<input type=\"text\" name=\"wm\" size=\"20\"><br>
<br>
<input type=\"submit\" value=\"Añadir!\" name=\"afili\"></p>
</form>
";
$query = "select * from links order by id desc"; // Ordeno pro el id todos los enlazes
$resp = mysql_query($query); // Mando el query
// Aqui hacemos una tabla donde estara todos los links antiguos.
echo"
:: Afiliados ::<br><br>
<div align=\"center\">
<center>
<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-width:0; border-collapse: collapse\" bordercolor=\"#111111\" width=\"74%\" id=\"AutoNumber1\">
<tr>
<td width=\"10%\" align=\"center\" style=\"border-left-color: #111111; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1\">
ID</td>
<td width=\"25%\" align=\"center\" style=\"border-left-color: #111111; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1\">
WebMaster</td>
<td width=\"40%\" align=\"center\" style=\"border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1\">
Web</td>
<td width=\"25%\" align=\"center\" style=\"border-right-color: #111111; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1\">
Nombre Web</td>
</tr>
";
// Pongo en la tabla toda la info sobrbe los minibanners.
while ($link = mysql_fetch_array($resp)) {
echo"
<tr>
<td width=\"10%\" align=\"center\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium\">$link[id]</td>
<td width=\"25%\" align=\"center\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium\">$link[webmaster]</td>
<td width=\"40%\" align=\"center\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium\">$link[web]</td>
<td width=\"25%\" align=\"center\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium\">$link[name]</td></tr>
";
}
echo"</table></center></div><br><br><br>";
}
else {
echo"
<br>Accesso Denegado!!!<br><br>De que vas ??
";
}
?>
|
Por el momento solo acepta botones de 88x31