Permalink
Browse files

Home actualizado, usa las nueva función de clase.

  • Loading branch information...
1 parent 1535d52 commit 9205615bd3d34a15c10f10eca20c27b94e405aa2 cristomc committed Aug 7, 2011
Showing with 45 additions and 23 deletions.
  1. +12 −8 vdl-home/index.php
  2. +13 −14 vdl-includes/vdl-core/core_profile.class.php
  3. +20 −1 vdl-includes/vdl-core/core_user.class.php
View
20 vdl-home/index.php 100644 → 100755
@@ -1,8 +1,12 @@
<?php
include("vdl-includes/vdl-core/core_profile.class.php");
$prof = new CORE_PROFILE();
- $author = $prof->get_profile($_SESSION["user_id"],$visitor);
+ $author = $prof->get_home($_SESSION["user_id"]);
foreach ($author as $data){
+ $nick = $data['nickname'];
+ $p_visits = $data['prof_visits'];
+ $p_friends = $data['prof_friends'];
+ $p_nets = $data['prof_nets'];
$photo = $data['img_prof'];
}
?>
@@ -13,17 +17,17 @@
<?php echo '<img src="vdl-media/vdl-images/' . $photo . '.jpg">'; ?>
</div>
<div id="pr_card">
- Usuario de Muestra<br/>
- 0 visitas <br/>
- 0 Amigos<br/>
- 0 Redes<br/>
+ <?php echo $nick;?><br/>
+ <?php echo $p_visits;?> visitas <br/>
+ <?php echo $p_friends;?> Amigos<br/>
+ <?php echo $p_nets;?> Redes<br/>
</div>
</div>
</div>
<div class="grid_11">
<div class="basic">
<div class="home_titles">
- Estadísticas de Perfil
+ Cuadro vacio...
</div>
<p><h1>PROXIMAMENTE...</h1></p>
</div>
@@ -34,15 +38,15 @@
<div class="home_titles">
Actualizaciones amigos
</div>
- <br/><h2>Sin amigos todavia... :(</h2>
+ <br/><h2>No implementado</h2>
</div>
</div>
<div class="grid_8">
<div class="basic2">
<div class="home_titles">
Actualizaciones redes
</div>
- <br/><h2>Sin redes todavia... :(</h2>
+ <br/><h2>No implementado</h2>
</div>
</div>
<div class="clear"></div>
View
@@ -27,24 +27,24 @@ public function create($_user_id,$_passwd,$_nickname,$_name,$_location,$_genre,$
public function get_profile($_user,$_refer){
$connection = parent::connect();
-
$a_result1 = parent::get_user($_user, $_refer);
-
//necesitamos la idnet del user
- $query = sprintf("SELECT vdl_users.id FROM vdl_users WHERE vdl_users.user_id='%s'", $user);
+ $query = sprintf("SELECT vdl_users.id FROM vdl_users WHERE vdl_users.user_id='%s'", $_user);
$result=mysql_query($query,$connection);
$id = mysql_fetch_assoc($result);
-
//falta primero coger las redes de vdl_users_net y luego buscarlas en vdl_nets, pero eso se lo dejo al cristo del
//futuro...chocala!!
$a_result2 = array();
- $query = ("SELECT id,net_name,net_sdesc,net_desc,net_img FROM vdl_net WHERE vdl_net.id='$_idnet'");
- $result = mysql_query($query,$connection);
- while ($row = mysql_fetch_assoc($result)){
- array_push($a_result2,$row);
+ $query = sprintf("SELECT vdl_user_net.id_net FROM vdl_user_net WHERE vdl_user_net.id_user='%s'", $id["id"]);
+ $result=mysql_query($query,$connection);
+ while ($rowa = mysql_fetch_assoc($result)){
+ $query = ("SELECT net_name,net_sdesc,net_img FROM vdl_net WHERE vdl_net.id='".$rowa["id_net"]."'");
+ $result = mysql_query($query,$connection);
+ while ($row = mysql_fetch_assoc($result)){
+ array_push($a_result2,$row);
+ }
}
-
// $a_result3 = array();
// $query = ("SELECT id,net_name,net_sdesc,net_desc,net_img FROM vdl_net WHERE vdl_net.id='$_idnet'");
// $result = mysql_query($query,$connection);
@@ -54,7 +54,7 @@ public function get_profile($_user,$_refer){
///===>mostrar resultado
- //Calculamos la edad y la fecha del cumpleaños siguiente
+/* //Calculamos la edad y la fecha del cumplea�os siguiente
if ($client){
if(substr($a_result[0]['bday'], 5, 2) > date("n")){
$a_result[0]['age']= date("Y")-substr($a_result[0]['bday'], 0, 4)-1;
@@ -68,11 +68,10 @@ public function get_profile($_user,$_refer){
$a_result[0]['bday'] = substr($a_result[0]['bday'], 8, 2).'/'.substr($a_result[0]['bday'], 5, 2).'/'.(substr($a_result[0]['bday'], 0, 4)+$a_result[0]['age']+1);
}
}
- }
-
+ }*/
$result = array();
- array_push($result,a_result1);
- array_push($result,a_result2);
+ array_push($result,$a_result1);
+ array_push($result,$a_result2);
return $result;
}
View
@@ -73,10 +73,29 @@ public function set_user(){
}
+ public function get_home($_user){
+ $connection = parent::connect();
+ $user = htmlspecialchars(trim($_user));
+ $query = sprintf("SELECT
+ vdl_users.nickname,
+ vdl_users.img_prof,
+ vdl_users.prof_visits,
+ vdl_users.prof_friends,
+ vdl_users.prof_nets
+ FROM vdl_users WHERE vdl_users.user_id='%s'", $user);
+ $result=mysql_query($query,$connection);
+ $a_result = array();
+ while ($row = mysql_fetch_assoc($result)){
+ array_push($a_result,$row);
+ }
+ return $a_result;
+ }
+
public function get_user($_user1,$_refer){
+ $connection = parent::connect();
///===>Comprobar que es amigo
$client = htmlspecialchars(trim($_refer));
- $user = htmlspecialchars(trim($_user));
+ $user = htmlspecialchars(trim($_user1));
if (!$client){
///===>extraer informacion limitada si no lo es
$query = sprintf("SELECT

0 comments on commit 9205615

Please sign in to comment.