Просмотр файла love/search.php

Размер файла: 3.98Kb
  1. <?
  2. include_once '../sys/inc/start.php';
  3. include_once '../sys/inc/compress.php';
  4. include_once '../sys/inc/sess.php';
  5. include_once '../sys/inc/home.php';
  6. include_once '../sys/inc/settings.php';
  7. include_once '../sys/inc/db_connect.php';
  8. include_once '../sys/inc/ipua.php';
  9. include_once '../sys/inc/fnc.php';
  10. include_once '../sys/inc/user.php';
  11.  
  12. $set['title']='Поиск анкет'; // заголовок страницы
  13. include_once '../sys/inc/thead.php';
  14. title();
  15. aut();
  16.  
  17.  
  18. ################## go поиск в базе ##################
  19. $pol=NULL;
  20. if (isset($_SESSION['pol']))$pol=$_SESSION['pol'];
  21. if (isset($_POST['pol']))$pol=$_POST['pol'];
  22. $_SESSION['pol']=$pol;
  23. $pol=ereg_replace("( ){1,}","",$pol);
  24.  
  25. $ank_city=NULL;
  26. if (isset($_SESSION['ank_city']))$ank_city=esc(stripcslashes(htmlspecialchars($_SESSION['ank_city'])));
  27. if (isset($_POST['ank_city']))$ank_city=esc(stripcslashes(htmlspecialchars($_POST['ank_city'])));
  28. $_SESSION['ank_city']=$ank_city;
  29. $ank_city=ereg_replace("( ){1,}","",$ank_city);
  30.  
  31.  
  32. $age=NULL;
  33. if (isset($_SESSION['age']))$age=esc(stripcslashes(htmlspecialchars($_SESSION['age'])));
  34. if (isset($_POST['age']))$age=esc(stripcslashes(htmlspecialchars($_POST['age'])));
  35. $_SESSION['age']=$age;
  36. $age=ereg_replace("( ){1,}","",$age);
  37.  
  38.  
  39. if (isset($_GET['go']) && $ank_city!=NULL)
  40. {
  41. $k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `pol` = '".$pol."' AND `ank_city` like '%".mysql_escape_string($ank_city)."%'"),0);
  42. $k_page=k_page($k_post,$set['p_str']);
  43. $page=page($k_page);
  44. $start=$set['p_str']*$page-$set['p_str'];
  45.  
  46. if ($k_post==0)
  47. echo "Извините, по Вашему запросу ничего не найдено";
  48.  
  49.  
  50.  
  51. $q=mysql_query("SELECT * FROM `user` WHERE `pol` = '".$pol."' AND `ank_city` like '%".mysql_escape_string($ank_city)."%' ORDER BY rating DESC LIMIT $start, $set[p_str]");
  52. while ($ank = mysql_fetch_array($q))
  53. {
  54. if($num==1){
  55. echo "<div class='rowdown'>";
  56. $num=0;
  57. }else{
  58. echo "<div class='rowup'>";
  59. $num=1;}
  60.  
  61. echo "".online($ank['id'])." \n";
  62. echo "<a href='/info.php?id=$ank[id]'><span style=\"color:$ank[ncolor]\">$ank[nick]</span></a>\n";
  63. include_once '../sys/inc/tfoot.php';
  64. echo "".adm($ank['id'])." \n";
  65.  
  66. if ($ank['ank_d_r']!=NULL && $ank['ank_m_r']!=NULL && $ank['ank_g_r']!=NULL){
  67. $ank['ank_age']=date("Y")-$ank['ank_g_r'];
  68. if (date("n")<$ank['ank_m_r'])$ank['ank_age']=$ank['ank_age']-1;
  69. elseif (date("n")==$ank['ank_m_r']&& date("j")<$ank['ank_d_r'])$ank['ank_age']=$ank['ank_age']-1;
  70. echo "<span class=\"ank_d\">$ank[ank_age] лет</span>\n";
  71. }
  72.  
  73. if ($ank['ank_city']!=NULL)echo ", <span class=\"ank_d\">$ank[ank_city]</span><br />\n";
  74. echo "</div>\n";
  75. }
  76.  
  77.  
  78.  
  79. if ($k_page>1)str("search.php?go&amp;",$k_page,$page); // Вывод страниц
  80. echo "<a href=\"search.php\" title=\"Поиск половинки\">Новый поиск</a><br/>";
  81. echo "<a href='/love/'>Знакомства</a>\n";
  82. include_once '../sys/inc/tfoot.php';
  83. }
  84.  
  85. else
  86.  
  87. { /////////// формы ввода критериев поиска /////////// формы ввода критериев поиска
  88.  
  89. echo "<form method=\"post\" action=\"search.php?go\">";
  90. //echo "<br />";
  91. echo "Искать:<br />\n";
  92. echo "<select name=\"pol\">\r\n";
  93. echo "<option value=\"1\">Парня</option>\r\n";
  94. echo "<option value=\"0\">Девушку</option>\r\n";
  95. echo "</select><br />\r\n";
  96.  
  97. echo "<br />";
  98.  
  99. echo "Город:<br/>";
  100. echo "<input type=\"text\" name=\"ank_city\" value=\"$ank_city\"/><br />\r\n";
  101.  
  102. echo "<br />";
  103. echo "Возраст:<br />\r\n";
  104. echo "От: <input type=\"text\" value=\"\" name=\"age\" size=\"2\" maxlength=\"2\" />";
  105. echo "<br />";
  106.  
  107. echo "<input type=\"checkbox\" name=\"$foto\" />C фото<br />\r\n";
  108.  
  109. echo "<input type=\"checkbox\" name=\"$online\" />Онлайн<br />\r\n";
  110.  
  111. echo "<br />";
  112.  
  113. echo "<input type=\"submit\" value=\"Найти\" />";
  114. echo "</form>\n";
  115.  
  116. echo "<a href='/love/'>Знакомства</a>\n";
  117.  
  118. include_once '../sys/inc/tfoot.php';}
  119. ?>