-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
executable file
·67 lines (61 loc) · 1.87 KB
/
search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
include 'header.php';
include 'config.php';
mysql_set_charset('utf-8');
if ($_GET['search']){
if (!$_GET['page']){
$currpage = 1;
}
else{
$currpage = $_GET['page'];
}
$search=$_GET['search'];
$c = $currpage*20 - 20;
$query ="SELECT * FROM quotes WHERE msg or id LIKE '%$search%'";
$k=mysql_num_rows($result);
$result = mysql_query($query);
$k=mysql_num_rows($result);
if (mysql_num_rows($result)>20){
$query ="SELECT * FROM quotes WHERE msg or id LIKE '%$search%' LIMIT $c, 20";
$result = mysql_query($query);
$nextpage = $currpage+1;
$prevpage = $currpage-1;
$c = $currpage*20 - 20;
echo "<br>";
echo "<a style=\"margin-left:600px;text-decoration:none;\" href=\"/parser/search.php?search=$search&page=$prevpage\"><</a>";
echo " "; echo $currpage; echo " ";
if ($c+20<$k){
echo "<a style=\"text-decoration:none;\" href=\"/parser/search.php?search=$search&page=$nextpage\">></a>";
}
}
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$id = $row['id'];
$url = $row['url'];
$rating = $row['rating'];
$msg = $row['msg'];
$date = $row['date'];
echo "<div id='header'>";
echo "<div id='idef'>$id </div>";
echo "<div id='rating'>";
echo "<div class=\"quotes\">";
echo "<a class='vote' href='#' id=\"$id\" name=\"down\"> - </a>";
echo "<span class=\"rating$id\">$rating</span>";
echo "<a class='vote' href='#' id=\"$id\" name=\"up\"> + </a>";
echo "</div>";
echo "</div>";
echo "<div id='link'>$url</div>";
echo "</div>";
echo "<div id='content'>";
echo "$msg";;
echo "</div>";
echo "<br>";
}
}
/*echo "<a style=\"margin-left:600px;text-decoration:none;\" href=\"/parser/index.php?page=$prevpage\"><</a>";
echo " "; echo $currpage; echo " ";
echo "<a style=\"text-decoration:none;\" href=\"/parser/index.php?page=$nextpage\">></a>";*/
}
?>