forked from optikalus/rbp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrandom_image2.php
More file actions
124 lines (100 loc) · 3.15 KB
/
random_image2.php
File metadata and controls
124 lines (100 loc) · 3.15 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?
// message board image browser v.3.hong
// added new line between each image for better formatting when large images appear
// include the configuration file
require('config.inc.php');
// overwrite the title
$config[title] = "Riceboy Image Browser";
// establish a connection with the database or notify an admin with the error string
$mysql_link = mysql_connect($config[db_host],$config[db_user],$config[db_pass]) or error($config[db_errstr],$config[admin_email],"mysql_connect($config[db_host],$config[db_user],$config[db_pass])\n".mysql_error());
mysql_select_db($config[db_name],$mysql_link) or error($config[db_errstr],$config[admin_email],"mysql_select_db($config[db_name])\n".mysql_error());
// handle authentication if necessary
if ($config[auth_required] == true) {
// begin a session
session_start();
if (isset($_SESSION[username]) && isset($_SESSION[password])) {
$query = "select username from $locations[auth_table] where username = '$_SESSION[username]' and password = '$_SESSION[password]'";
$result = mysql_query($query,$mysql_link) or error($config[db_errstr],$config[admin_email],$query."\n".mysql_error());
if (mysql_num_rows($result) != 1) {
// destroy the erroneous session
session_destroy();
// leave
header("Location: $locations[login]");
exit();
}
} else {
// leave
header("Location: $locations[login]");
exit();
}
}
?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' lang='en' xml:lang='en'>
<head>
<title><?=$config[title]?></title>
<link rel="stylesheet" type="text/css" href="<?=$locations[css]?>">
<style type="text/css">
img {
float: left;
}
img:hover {
width: auto;
height: auto;
}
</style>
</head>
<body class='body'>
<?
$query = 'select * from rbp_images order by rand() limit 50';
$result = mysql_query($query,$mysql_link) or error($config[db_errstr],$config[admin_email],$query."\n".mysql_error());
if (mysql_num_rows($result) == 0) {
?>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td class='borderoutline'>
<table width='100%' border='0' cellspacing='1' cellpadding='4'>
<tr class='titlelarge'>
<td colspan='2'>No images to display.</td>
</tr>
<tr class='main'>
<td colspan='2'><a href='<?=$locations[forum]?>'>Back to the Forum</a></td>
</tr>
<tr class='main'>
<td colspan='2'>
<blockquote>
<?
} else {
?>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td class='borderoutline'>
<table width='100%' border='0' cellspacing='1' cellpadding='4'>
<tr class='main'>
<td colspan='2'>
<a href='<?=$locations[forum]?>'>Back to the Forum</a>
</td>
</tr>
<tr class='main'>
<td colspan='2'>
<?
while ($row = mysql_fetch_array($result)) {
?>
<a href='<? print "$locations[forum]?d=$row[id]&t=" . (strlen($row[t]) == 5 ? '0' . $row[t] : $row[t]); ?>'><img src='<?=$row[image_url]?>' border='0' alt=''></a>
<br clear="left">
<?
}
}
?>
</td>
</tr>
</blockquote>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>