-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay.php
62 lines (52 loc) · 1.05 KB
/
display.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
<HTML>
<BODY>
<?
$connection = mysql_connect("localhost","rcats","meoow");
$db = mysql_select_db("rcats");
$id = $_GET["id"];
if (! $id ) {
$id = $_GET["ID"];
}
$uid = $_GET["uid"];
if (! $uid ) {
$uid = $_GET["UID"];
}
$handle = $_GET["handle"];
if (! $handle ) {
$handle = $_GET["HANDLE"];
}
$table = $_GET["table"];
if (! $table) {
$table = $_GET["TABLE"];
}
$fields = $_GET["fields"];
if (! $fields) {
$fields = $_GET["FIELDS"];
}
if (! $fields) {
$fields = 'content,type';
}
if ($id) {
$q = "SELECT $fields from $table where ID = $id";
}
else {
if ($uid) {
$q = "SELECT $fields from $table where UID = $uid";
}
}
print "<!-- query is $q -->\n";
$sth = mysql_query($q, $connection);
while ($row = mysql_fetch_row($sth)) {
$content = $row[0];
$type = $row[1];
if (($type == 'text')||($type == '')) {
$content = preg_replace("/(https?:\/\/[^\s]+)/","<A HREF='$1'>$1</A>",$content);
# preserve hard returns, or try to
$content = preg_replace("/\n/","<p>\n",$content);
}
print($content.'<hr>');
}
mysql_close($connection);
?>
</BODY>
</HTML>