View file foto/inc/user_gallery.php

File size: 2.53Kb
  1. <?
  2. if (!isset($user) && !isset($_GET['id_user'])){header("Location: /foto/?".SID);exit;}
  3. if (isset($user))$ank['id']=$user['id'];
  4. if (isset($_GET['id_user']))$ank['id']=intval($_GET['id_user']);
  5. $ank=get_user($ank['id']);
  6. if (!$ank){header("Location: /foto/?".SID);exit;}
  7.  
  8. $set['title']=$ank['nick'].' - Фотоальбомы'; // заголовок страницы
  9.  
  10. include_once '../sys/inc/thead.php';
  11. title();
  12.  
  13. include 'inc/gallery_act.php';
  14. err();
  15. aut();
  16.  
  17.  
  18.  
  19.  
  20. $k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `id_user` = '$ank[id]'"),0);
  21. $k_page=k_page($k_post,$set['p_str']);
  22. $page=page($k_page);
  23. $start=$set['p_str']*$page-$set['p_str'];
  24. echo "<table class='post'>\n";
  25. if ($k_post==0)
  26. {
  27. echo " <tr>\n";
  28. echo " <td class='p_t'>\n";
  29. echo "Нет фотоальбомов\n";
  30. echo " </td>\n";
  31. echo " </tr>\n";
  32.  
  33. }
  34.  
  35. $q=mysql_query("SELECT * FROM `gallery` WHERE `id_user` = '$ank[id]' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
  36. while ($post = mysql_fetch_assoc($q))
  37. {
  38.  
  39. echo " <tr>\n";
  40. if ($set['set_show_icon']==2){
  41. echo " <td class='icon48' rowspan='2'>\n";
  42.  
  43. $foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id_gallery` = '$post[id]' ORDER BY RAND()"));
  44. if ($foto==null){
  45. echo "<img src='/foto/foto48/0.png' alt='Нет фото' />";
  46. }
  47. else
  48. {
  49. echo "<img src='/foto/foto48/$foto[id].$foto[ras]' alt='Фото_$foto[id]' />";
  50. }
  51.  
  52.  
  53. echo " </td>\n";
  54. }
  55. elseif ($set['set_show_icon']==1)
  56. {
  57. echo " <td class='icon14'>\n";
  58. echo "<img src='/style/themes/$set[set_them]/user/$ank[pol].png' alt='' />";
  59. echo " </td>\n";
  60. }
  61.  
  62. echo " <td class='p_t'>\n";
  63. echo "<a href='/foto/$ank[id]/$post[id]/'>$post[name]</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'"),0)." фото)\n";
  64.  
  65.  
  66. echo " </td>\n";
  67. echo " </tr>\n";
  68. echo " <tr>\n";
  69. if ($set['set_show_icon']==1)echo " <td class='p_m' colspan='2'>\n"; else echo " <td class='p_m'>\n";
  70.  
  71. if ($post['opis']==null)
  72. echo "Без описания<br />\n";
  73. else
  74. echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($post['opis']))))))))."<br />\n";
  75. echo "Создан: ".vremja($post['time_create']);
  76. echo " </td>\n";
  77. echo " </tr>\n";
  78.  
  79. }
  80. echo "</table>\n";
  81.  
  82.  
  83.  
  84.  
  85. if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
  86.  
  87.  
  88. include 'inc/gallery_form.php';
  89.  
  90. echo "<div class=\"foot\">\n";
  91. echo "&laquo;<a href='/foto/'>Все альбомы</a><br />\n";
  92. echo "</div>\n";
  93.  
  94. include_once '../sys/inc/tfoot.php';
  95. exit;
  96. ?>