Antiguo 03-jun-2006, 17:32   #1 (permalink)
Usuario activo
 
Fecha de Ingreso: junio-2006
Mensajes: 2
quevon24 sin puntos positivos o negativos
Smile Tutorial hacer sistema de afiliados con php y mysql

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
quevon24 está desconectado  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Antiguo 03-jun-2006, 18:46   #2 (permalink)
Usuario activo
 
Fecha de Ingreso: julio-2006
Ubicación: España
Mensajes: 1.460
AMateos sigue por muy buen camino
Enviar un mensaje por MSN a AMateos Enviar un mensaje por Skype™ a AMateos
Predeterminado

Muy buen tutorial, felicidades!

¿Cuando tienes pensado hacerlo compatible con banners mas grandes?
AMateos está desconectado  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Antiguo 03-jun-2006, 19:16   #3 (permalink)
Usuario activo
 
Fecha de Ingreso: abril-2006
Mensajes: 253
nandross sin puntos positivos o negativos
Predeterminado

Es un buen tutorial, una pregunta, no me importa mucho pero bueno, ¿es tuyo?
nandross está desconectado  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Antiguo 04-jun-2006, 16:10   #4 (permalink)
Usuario activo
 
Fecha de Ingreso: junio-2006
Mensajes: 2
quevon24 sin puntos positivos o negativos
Predeterminado Te respondo

en realidad este script me lo paso un amigo por messenger y lo quise compartir con todos ustedes,

si sabes si esto se encontraba en otra pagina diganme para poner los creditos de quien le pertenece pues no confio mucho que fuera de un amigo.:)
quevon24 está desconectado  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Tema Cerrado

Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

Los Códigos BB están Activado
Las Caritas están Activado
[IMG] está Activado
El Código HTML está Desactivado
Trackbacks are Activado
Pingbacks are Activado
Refbacks are Activado

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Hosting y dominio gratis por sistema de afiliados jorgeleo Hosting Gratuito 2 04-sep-2006 14:19
VIDEO TUTORIAL: Como hacer respaldo de Base de Datos via phpmyadmin JGRAM Programación y Diseño Web 2 07-may-2006 07:11
Tutorial MySQL DaNi Programación y Diseño Web 6 10-abr-2006 10:56
Tutorial para hacer una Scanline joanikus Programación y Diseño Web 1 21-oct-2005 18:16
Tutorial para hacer una Minifirma joanikus Programación y Diseño Web 5 21-oct-2005 18:05

Alojamiento web, Hosting Reseller, Servidores Dedicados - All in Hosting

La franja horaria es GMT. Ahora son las 07:24.

Rioserver
Web hosting y dominios
Planes de hosting desde 2.90 USD
Soporte 24/7

www.rioserver.com

Infranetworking.com
Hosting PHP-MySQL
desde $3,5 dólares al mes!
Servidores Dedicados Hosting Reseller
www.infranetworking.com

Hosting en Mexico
500 Mb de espacio 29 pesos al mes
Soporte 24 h, cpanel,
Solicite prueba gratuita.

www.albergueweb.com.mx

AQPhost es Hosting Reseller
Te asesoramos
Inicia tu empresa de Web Hosting
¡hoy mismo!

www.aqphost.com/revendedores.htm


     ComunidadHosting  

La más grande comunidad dedicada al web hosting en nuestro idioma.

Para anunciar en ComunidadHosting, o para información general, por favor utiliza el formulario de contacto.







Desarrollado por: vBulletin® Versión 3.7.5
Derechos de Autor ©2000 - 2009, Jelsoft Enterprises Ltd.
Traducido por mcloud de vBhispano.com

Search Engine Friendly URLs by vBSEO 3.2.0