Este es el codigo
Código PHP:
<?
include('conectar.php'); //Conectamos con la base de datos
$ip = $_SERVER['REMOTE_ADDR']; //Recojemos la IP
$id = $_GET['id']; //Recojemos el ID de referencia
$sql = "SELECT id FROM users WHERE ip='".$ip."'";
$miid = mysql_query( $sql );
if( $miid2 = mysql_fetch_row( $miid ) ) echo 'Tu ID es: ' , $miid2 [0] , Tienes ;
$query = mysql_query("SELECT COUNT(*) AS cid FROM reffers WHERE user_id='".$miid2 [0]."'");
$result = mysql_fetch_assoc($query);
echo $result['cid'] , referidos ;
$result['cid']=1; //esta variable contiene la cantidad de referidos obtenidos desde la bd
//Añadir referido
$query = mysql_query("SELECT * FROM reffers WHERE ip='".$ip."' AND user_id='".$id."'");
//El usuario con IP XX.X.X.XX.X NUNCA ha visitado al usuario con ID XXXX asi que lo registramos
if(mysql_num_rows($query) == 0) {
mysql_query("INSERT INTO reffers (ip, user_id) VALUES ('".$ip."','".$id."')");
}
//El usuario con IP XX.X.X.XX.X ya ha visitado al usuario con ID XXXX asi que evitamos que lo registre nuevamente
else {
echo " | Ya has visitado a XX.XXX.XX.XXX ";
//Registramos la IP
$query = mysql_query("SELECT id FROM users WHERE ip='".$ip."'");
if(mysql_num_rows($query)>0) {
echo "| La IP ya está registrada...";
exit();
}
mysql_query("INSERT INTO users (ip) VALUES ('$ip')");
}
switch ($result['cid']) {
case 0:
// contenido para los que no tiene referidos
break;
case 1:
require('ver-fichas.php');
break;
case 20:
//contenido para los que tienen 20 referidos
break;
}
//$query = mysql_query("SELECT COUNT(*) AS cid FROM reffers WHERE user_id='".$rs."'");
//$result = mysql_fetch_assoc($query);
//echo $result['cid'];
//COMIENZO DEL CODIGO HTML
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"><head>
<title>Playstation Network Code Generator</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" type="text/css" href="index_files/web.css">
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="./lib/ie6.css" />
<![endif]-->
<script type="text/javascript" src="index_files/roster.js"></script>
<style type="text/css">
<!--
body {
background-color: #FFFFFF;
}
-->
</style></head><body>
<div id="container">
<!-- Column Wrapper -->
<div id="column-container">
<p>
<!-- Left Column -->
<img src="images/logo.png" alt="logo" width="388"
height="176"></p>
<div id="left-column">
<!-- Roster/Team -->
<div class="box">
<div class="content">
<ul id="team-members">
<li><a href="team/proof1.jpg"
onmouseover="ctRoster('Free PSN Code!');" onmouseout="ctRosterClean();"><img
src="index_files/1.png" alt="Click to expand" width="59" height="59"></a></li>
<li><a href="team/proof2.jpg"
onmouseover="ctRoster('Free PSN Code!');" onmouseout="ctRosterClean();"><img
src="index_files/2.png" alt="Click to expand" width="59" height="59"></a></li>
<li><a href="team/proof3.jpg"
onmouseover="ctRoster('Free PSN Code!');" onmouseout="ctRosterClean();"><img
src="index_files/3.png" alt="Click to expand"></a></li>
<li><a href="team/proof4.jpg"
onmouseover="ctRoster('Free PSN Code!');" onmouseout="ctRosterClean();"><img
src="index_files/4.png" alt="Click to expand"></a></li>
<li><a href="team/proof5.jpg"
onmouseover="ctRoster('Free PSN Code!');" onmouseout="ctRosterClean();"><img
src="index_files/5.png" alt="Click to expand" width="59" height="59" /></a></li>
</ul>
</div>
</div>
<!-- Latest News -->
</div>
</div>
<!-- Right Column -->
<div id="right-column">
<!-- Latest News -->
<div class="box">
<div class="content">
<!-- News Subject -->
<h3 align="center"> </h3>
<h3>URL:
<input value="http://www.psncodegenerator.com/?i=383982" size="50"
type="text">
</h3>
<center>
<h3><br>
</h3>
<center>
<div class="bubble">
<div class="rounded">
<blockquote>
<table width="300">
<tbody>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
</blockquote>
</div>
<br>
</div>
<h1> </h1>
<p><br>
<br>
</p>
</center>
</center>
</div>
</div>
</div>
</div>
</div>
<!-- Footer -->
<div id="footer">
<br>
<p>© 2010</p>
</div>
</body></html>
Gracias.