Torrentlister |
|
|
|
nazareth
Super Moderator
Dabei seit:
16.02.2006 Beiträge: 139 Herkunft: Wie soll
ich die Frage verstehen ??
Bewertung:
Level: 19
[?] Erfahrungspunkte:
22.553 Nächster Level: 22.851
| |
Hab mal ne Frage an die php Experten!!! Ich
tüftel mir gerade ein Script für einen
Torrentlister um und habe nun folgendes
Problem. Der Lister läuft eigentlich
perfekt, jedoch möchte ich in der Beschreibung des
Files ein Poster des Files einfügen, diese müsste
ich ja logischerweise in der upload.php mit
hochladen um es dann in der details.php anzeigen
zu lassen. Als sql Tabelle sollte folgendes
funzen.
code: |
1:
|
alter table torrents add( torrents.poster varchar(255) NOT NULL default 'poster.jpg') | | Die
upload.php
code: |
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:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
|
<?
require_once 'config.php';
connect ($dbhost, $dbuser, $dbpass, $database);
$result = mysql_query("SELECT * FROM ban WHERE ip = '$REMOTE_ADDR'");
if (mysql_num_rows($result) == 1)
{
stheader('You have been banned from this section!');
echo '<h1>Banned!</h1>You have been banned from this section of the site for a very very very good reason, if you think a mistake has been made feel free to contact one of the admins';
footer();
die;
}
// trigger the upload part of this script
if (isset($_FILES['torrent']))
{
// ALL VARS (i THINK)
$upfile = $_FILES['torrent']['tmp_name'];
$torrent = torrent_info_file($upfile);
$tracker = strip_tags($torrent['announce']);
$tracker = strip_tags(str_replace('announce', 'scrape', $tracker));
$infohash = strip_tags($torrent['hash']);
$stats = torrent_scrape_url($tracker, $torrent['hash']);
$seeds = strip_tags($stats['seeds']);
$peers = strip_tags($stats['peers']);
$size = strip_tags($torrent['size']);
$torrentname = trim(strip_tags($_POST['filename']));
$subcat = strip_tags($_POST['type']);
$description = strip_tags(trim($_POST['info']));
$registration = strip_tags($_POST['reg']);
$date = date('YmdHis');
$updated = date('YmdHis');
$maincat = mysql_query("SELECT catid FROM categories WHERE subid = '$subcat' LIMIT 1");
$maincat = mysql_fetch_row($maincat);
$maincat = $maincat[0];
if ($torrentname == '')
{
stheader($title);
echo '<div class="location"><a href="/index.php">Home</a> :: <a href="/upload.php">Upload a torrent</a></div>';
echo "Fill out the entire form!!";
@unlink($filename);
footer();
die;
}
if ($registration == '')
{
stheader($title);
echo '<div class="location"><a href="/index.php">Home</a> :: <a href="/upload.php">Upload a torrent</a></div>';
echo "Fill out the entire form!!";
@unlink($filename);
footer();
die;
}
if ($subcat == '')
{
stheader($title);
echo '<div class="location"><a href="/index.php">Home</a> :: <a href="/upload.php">Upload a torrent</a></div>';
echo "Fill out the entire form!!";
@unlink($filename);
footer();
die;
}
// check tracker url (remove if you want udp:// torrents to be allowed)
if (!substr($tracker, 0, 7) =='http://')
{
stheader($title);
echo '<div class="location"><a href="/index.php">Home</a> :: <a href="/upload.php">Upload a torrent</a></div>';
echo "This torrent does not have a valid tracker!!";
@unlink($filename);
footer();
die;
}
// check if torrent has tracker
if ($tracker == '')
{
stheader($title);
echo '<div class="location"><a href="/index.php">Home</a> :: <a href="/upload.php">Upload a torrent</a></div>';
echo "This torrent does not have a valid tracker!";
@unlink($filename);
footer();
die;
}
// check if torrent excists in the database
$result= mysql_query ("SELECT * FROM torrents WHERE hash = '$infohash'");
if (mysql_num_rows($result) == 1)
{
stheader($title);
echo '<div class="location"><a href="/index.php">Home</a> :: <a href="/upload.php">Upload a torrent</a></div>';
echo "This file already exists in our database...";
@unlink($filename);
footer();
die;
}
// Create flag for description
if (mb_strlen($description) == 0)
{
$desc_enum = 0;
}
else
{
$desc_enum = 1;
}
// no explenation needed here
move_uploaded_file($upfile , $btdir.'/'. $infohash .'.bogtor') or die("Error moving torrent...");
// Drop torrent stats into db
mysql_query("INSERT INTO torrents
(torrentname,hash,maincat,subcat,tracker,size,seeds,peers,added,updated,registration,description) VALUES
('$torrentname','$infohash','$maincat','$subcat','$tracker','$size','$seeds','$peers','$date','$updated','$registration','$desc_enum')") or die (mysql_error());
$desc_id = mysql_insert_id();
// Write description to a seperate table
mysql_query ("INSERT INTO description (id, descr) VALUES ('$desc_id','$description')") or die (mysql_error());
// Update stats
mysql_query("UPDATE categories SET torrents = torrents+1 WHERE subid = '$subcat'");
stheader('Upload done, thank you!');
echo '<div class="location"><a href="/index.php">Home</a> :: <a href="/upload.php">Upload a torrent</a></div>';
echo 'success';
footer();
}
// If nothing has been uploaded
else
{
stheader('Upload a torrent');
echo '<div class="location"><a href="/index.php">Home</a> :: <a href="/upload.php">Upload a torrent</a></div>';
?>
<style type="text/css">
<!--
.Stil1 {
color: #FFFFFF;
font-weight: bold;
}
.Stil2 {color: #FFFFFF}
-->
</style>
<form enctype="multipart/form-data" method="post" action="/upload.php">
<table width="100%" cellpadding="0" cellspacing="0" border="2">
<tr>
<td><span class="Stil1">Torrentfile aussuchen </span></td>
<td><input type="file" name="torrent" size="40"/></td>
</tr>
<tr>
<td><span class="Stil2">Kategorie</span></td>
<td><select name="type">
<option value="">(Choose)</option>
<?
/* fetch the categories from sql */
$result = mysql_query("SELECT * FROM categories ORDER BY name, subname ASC") or sqlerr();
while ($row = mysql_fetch_assoc($result))
{
echo "<option value=\"";
echo $row['subid'];
echo "\">";
echo htmlentities ($row['name']);
echo " » ";
echo htmlentities ($row['subname']);
echo "</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td><span class="Stil2">Name des Files </span></td>
<td><input type="text" name="filename" onkeyup="this.value = this.value.slice(0, 100)" size="40" /></td>
</tr>
<tr>
<td><span class="Stil2">Registrierung nötig?? </span></td>
<td> <span class="Stil2">Ja</span>
<input name="reg" type="radio" value="1" />
<span class="Stil2">Nein</span>
<input name="reg" type="radio" value="0" /></td>
</tr>
<tr>
<td valign = "top"><span class="Stil2"><strong>Beschreibung</strong> (optional)</span></td>
<td><textarea name="info" rows="15" cols="60" onkeyup="this.value = this.value.slice(0, 2000)"></textarea></td>
</tr>
<tr>
<td></td>
<td>
<input name="submit" type="submit" value="Upload Torrent" />
</td>
</tr>
</table>
</form>
<?
footer();
}
?>
| |
Vielleicht
bekommt das ja jemand auf die Reihe. Falls
jemand den Lister in
Aktion sehen will: http://torrent-nova.dl.am/
Bin
für jede Hilfe dankbar.
Andy
Teil 2
folgt im nächsten Post
__________________
Was sich heute HipHop nennt,
hieß früher "Stottern" und war
heilbar!!
| |
24.04.2006 00:43 |
| |
|
|
|
|
|
|
nazareth
Super Moderator
Dabei seit:
16.02.2006 Beiträge: 139 Herkunft: Wie soll
ich die Frage verstehen ??
Bewertung:
Level: 19
[?] Erfahrungspunkte:
22.553 Nächster Level: 22.851
Themenstarter
| |
Dann mal die details.php
code: |
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:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
|
<?
require_once "config.php";
connect ($dbhost, $dbuser, $dbpass, $database);
// Check if a comment was posted
if ($_POST['submitted'] == '')
{
// The details query
$result = mysql_query("SELECT * FROM torrents LEFT JOIN categories ON torrents.subcat = categories.subid WHERE torrents.id ='".strip_tags(trim($_GET['id']))."'") or die (mysql_error());
$count = mysql_num_rows($result);
if ($count == 0)
{
stheader('Torrent Not Found');
echo '<br /><h1>Torrent nicht gefunden</h1>';
footer();
die;
}
// extract data from sql
while ($row = mysql_fetch_array($result))
{
extract($row);
stheader('Torrentdetails für: '.htmlentities($torrentname));
?>
<script type="text/javascript">
function expandcontract(tbodyid,dis) {
document.getElementById(tbodyid).style.display = dis;
}
</script>
<?
$tracker = parse_url($tracker);
// Display upload description
if ($description == 1)
{
$result_desc = mysql_query("SELECT descr FROM description where id = '".strip_tags(trim($_GET['id']))."' LIMIT 1");
while ($row = mysql_fetch_array($result_desc))
{
extract($row);
$description = '<tr><td colspan="2"><center><br /><h1>Description</h1><div id="desc">'.nl2br(str_replace(' ',' ',$descr)).'</div></center><br /></td></tr>';
}
}
else
{
$description = '';
}
echo '<div class="location"><a href="/index.php">Home</a> :: <a href="/cat.php?id='.$maincat.'">'.$name.'</a> :: <a href="/subcat.php?id='.$subid.'">'.$subname.'</a> :: <a href="/details.php?id='.$id.'">'.htmlentities($torrentname).'</a></div>';
// Display torrent details
echo '<h1>'.htmlentities($torrentname).'</h1>';
echo '<table class="det" cellpadding="0" cellspacing="0" border="0">';
echo '<tr><td width="15%">Download</td><td>: <a href="/download.php?id='.htmlentities($hash).'">'.htmlentities($torrentname).'</a> » (<a href="magnet:?xt=urn:btih:'. strtoupper(base32_encode(pack("H*", $hash))).'">Magnet Link</a>)</td></tr>';
echo '<tr><td>Kategorie</td><td>: <a href="/cat.php?id='.$maincat.'">'.$name.'</a> » <a href="/subcat.php?id='.$subid.'">'.$subname.'</a></td></tr>';
echo '<tr><td>Grösse</td><td>: '.torsize($size).'</td></tr>';
echo '<tr><td>Seeder</td><td>: '.getpeer($seeds).'</td></tr>';
echo '<tr><td>Peers</td><td>: '.getpeer($peers).'</td></tr>';
echo '<tr><td>Tracker</td><td>: http://'.htmlentities($tracker['host']).' ('.detreg($registration).')</td></tr>';
echo '<tr><td>Hinzugefügt</td><td>: '.$added.'</td></tr>';
echo '<tr><td>Updated</td><td>: '.$updated.'</td></tr>';
echo '<tr><td>Hash</td><td>: '.htmlentities($hash).'</td></tr>';
echo '<tr><td>Alternative</td><td>: The file <em>'.htmlentities($torrentname).'</em> might also be available on UseNeXT <strong><a href="http://www.usenext.de/index.cfm?TD=377528">Click here to download the UseneXT client</strong></a></td></tr>'.$description;
echo '</table>';
// Display toggle files link
echo '<br /><a href="#det" onclick="expandcontract(\'files\',\'\')">Alle Files anzeigen</a> :: <a href="#" onclick="expandcontract(\'files\',\'none\')">Alle Files verstecken</a><br /><br />';
// Display internal files
echo '<a name="det"></a>';
echo '<table class="det" cellpadding="0" cellspacing="0" border="0">';
echo '<tbody id="files" style="display:none">';
@showfiles($hash);
echo '</tbody></table>';
// Fetch comments from sql
$result = mysql_query("SELECT * FROM comments WHERE id ='".strip_tags(trim($_GET['id']))."'");
$comment_count = mysql_num_rows($result);
// div colors
$color1 = 'class="light"';
$color2 = 'class="dark"';
$row_count = 0;
echo '<br /><h1>Kommentare ('.$comment_count.')</h1>';
if (!$comment_count == 0)
{
echo '<div class="commentwrapper">';
while ($row = mysql_fetch_array($result))
{
extract($row);
$row_color = ($row_count % 2) ? $color1 : $color2;
echo '<div '.$row_color.'><strong>'.htmlentities($name).'</strong> On <strong>'.$date.'</strong><br /><br />'.nl2br(htmlentities($post)).'</div><br /><br />';
$row_count++;
}
}
$result = mysql_query("SELECT * FROM ban WHERE ip = '$REMOTE_ADDR'");
if (mysql_num_rows($result) == 1)
{
echo '<br /><h1>You cant add any comments!</h1>You cant add any comments because you where banned for some reason.';
footer();
die;
}
echo '<br /><form id="comment" action="/details.php?id='.strip_tags(trim($_GET['id'])).'" method="post">';
echo '<input name="user" value="name" onclick=\'value=""\' /><br /><br />';
echo '<textarea name="comment" cols="50" rows="7"></textarea><br />';
echo '<input type="submit" name="submitted" value="submit" /></form></div>';
}
footer();
}
// Handle posted comment
else
{
$result = mysql_query("SELECT * FROM ban WHERE ip = '$REMOTE_ADDR'");
if (mysql_num_rows($result) == 1)
{
stheader('You have been banned from this section!');
echo '<h1>Banned!</h1>You have been banned from this section of the site for a very very very good reason, if you think a mistake has been made feel free to contact one of the admins';
footer();
die;
}
$commentid = strip_tags(trim($_GET['id']));
$name = trim($_POST['user']);
$comment = trim($_POST['comment']);
$ip= $REMOTE_ADDR;
$date = date('YmdHis');
if ($comment == '' || $name = '')
{
stheader('Comment failed!');
echo '<h1>Please fill out the entire form!</h1>';
footer();
die;
}
stheader('Comment submitted');
mysql_query("INSERT INTO comments (id,ip,date,name,post) VALUES ('$commentid','$ip','$date','$name','$comment')");
echo '<center><h1>Comment posted! Thanks.</h1><a href="/details.php?id='.strip_tags($_GET['id']).'">Click here to view your posting</a></center>';
footer();
}
?> | |
Und
mal als Anregung, sollten wir hier mal den bb_code
für die Codebox einsetzen, damit die Postings net
so ellenlang werden.
[codebox][/codebox]<<<Den meine
ich!!
Andy
__________________
Was sich heute HipHop nennt,
hieß früher "Stottern" und war
heilbar!!
| |
24.04.2006 00:46 |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Firestarter
Doppel-As
Dabei seit:
09.04.2006 Beiträge: 129
Bewertung:
Level: 18
[?] Erfahrungspunkte:
14.296 Nächster Level: 17.484
| |
So dann versuch ich mich mal dran...
als
SQL-Table wurde ich folgendes nehmen:
code: |
1:
|
ALTER TABLE `torrents` ADD `poster` varchar(255) NOT NULL default 'poster.jpg'; | |
in
der upload.php würde ich folgendes
machen:
über:
code: |
1:
2:
|
<tr>
<td valign = "top"><span class="Stil2"><strong>Beschreibung</strong> (optional)</span></td> | |
das
hier einfügen:
code: |
1:
2:
3:
4:
|
<tr>
<td valign = "top"><span class="Stil2"><strong>Poster</strong> (Direkter Link zu einem Bild, das in den Details des Torrents angezeigt werden soll)</span></td>
<td><input type=text name=poster size=80></td>
</tr> | |
die
mysql query mit dem poster erweitern:
code: |
1:
2:
3:
4:
5:
|
// Drop torrent stats into db
mysql_query("INSERT INTO torrents
(torrentname,hash,maincat,subcat,tracker,size,seeds,peers,added,updated,registration,description,poster) VALUES
('$torrentname','$infohash','$maincat','$subcat','$tracker','$size','$seeds','$peers','$date','$updated','$registration','$desc_enum', '$poster')") or die (mysql_error());
| |
unter:
code: |
1:
|
$maincat = $maincat[0]; | |
das
hier einfügen:
code: |
1:
|
$poster = strip_tags($_POST['poster']); | |
in
der details.php:
füge die folgende Abfrage
ein (musste ich erstellen, da ich nicht erkennen
konnte, wie die anderen Werte geholt
werden):
code: |
1:
2:
3:
|
$res = mysql_query("SELECT torrents.poster WHERE torrents.id ='".strip_tags(trim($_GET['id']))."'")
or sqlerr();
$row = mysql_fetch_array($res); | |
und
dann zum Abschluss noch den folgenden Code dort
einbauen, wo du das Poster angezeigt haben
willst:
code: |
1:
2:
3:
4:
|
if (!empty($row["poster"]))
echo '<tr><td>Poster</td><td><center><img src='".$row["poster"]."'></center></td></tr>';
else
echo '<tr><td>Poster</td><td><center><img src='poster.jpg'></center></td></tr>'; | |
Für
etwaige Schäden übernehme ich keine Haftung
*wegrenn* | |
30.04.2006 14:18 |
| |
|
|
|
|
|
|
nazareth
Super Moderator
Dabei seit:
16.02.2006 Beiträge: 139 Herkunft: Wie soll
ich die Frage verstehen ??
Bewertung:
Level: 19
[?] Erfahrungspunkte:
22.553 Nächster Level: 22.851
Themenstarter
| |
|
30.04.2006 21:35 |
| |
|
|
|
|
|
|
nazareth
Super Moderator
Dabei seit:
16.02.2006 Beiträge: 139 Herkunft: Wie soll
ich die Frage verstehen ??
Bewertung:
Level: 19
[?] Erfahrungspunkte:
22.553 Nächster Level: 22.851
Themenstarter
| |
Parse error: parse error, unexpected '\"',
expecting ',' or ';' in
/var/www/vhosts/torrent-portal.biz/subdomains/torrent/httpdocs/details.php
on line 63
echo
'<tr><td>Poster</td><td><center><img
src='".$row["poster"]."'></center></td></tr>';
Mmmmhh, watt kann das
sein???
Upload der URL für das Poster funzt
einwandfrei, nur die Abfrage und Ausgabe in der
details.php will nicht wirklich so wie
ich.
Andy
Jetzige
details.php
code: |
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:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
|
<?
require_once "config.php";
connect ($dbhost, $dbuser, $dbpass, $database);
// Check if a comment was posted
if ($_POST['submitted'] == '')
{
// The details query
$result = mysql_query("SELECT * FROM torrents LEFT JOIN categories ON torrents.subcat = categories.subid WHERE torrents.id ='".strip_tags(trim($_GET['id']))."'") or die (mysql_error());
$count = mysql_num_rows($result);
if ($count == 0)
{
stheader('Torrent Not Found');
echo '<br /><h1>Torrent nicht gefunden</h1>';
footer();
die;
}
// extract data from sql
while ($row = mysql_fetch_array($result))
{
extract($row);
stheader('Torrentdetails für: '.htmlentities($torrentname));
$res = mysql_query("SELECT torrents.poster WHERE torrents.id ='".strip_tags(trim($_GET['id']))."'")
or sqlerr();
$row = mysql_fetch_array($res);
?>
<script type="text/javascript">
function expandcontract(tbodyid,dis) {
document.getElementById(tbodyid).style.display = dis;
}
</script>
<?
$tracker = parse_url($tracker);
// Display upload description
if ($description == 1)
{
$result_desc = mysql_query("SELECT descr FROM description where id = '".strip_tags(trim($_GET['id']))."' LIMIT 1");
while ($row = mysql_fetch_array($result_desc))
{
extract($row);
$description = '<tr><td colspan="2"><center><br /><h1>Description</h1><div id="desc">'.nl2br(str_replace(' ',' ',$descr)).'</div></center><br /></td></tr>';
}
}
else
{
$description = '';
}
echo '<div class="location"><a href="/index.php">Home</a> :: <a href="/cat.php?id='.$maincat.'">'.$name.'</a> :: <a href="/subcat.php?id='.$subid.'">'.$subname.'</a> :: <a href="/details.php?id='.$id.'">'.htmlentities($torrentname).'</a></div>';
// Display torrent details
echo '<h1>'.htmlentities($torrentname).'</h1>';
if (!empty($row["poster"]))
echo '<tr><td>Poster</td><td><center><img src='".$row["poster"]."'></center></td></tr>';
else
echo '<tr><td>Poster</td><td><center><img src='poster.jpg'></center></td></tr>';
echo '<table class="det" cellpadding="0" cellspacing="0" border="0">';
echo '<tr><td width="15%">Download</td><td>: <a href="/download.php?id='.htmlentities($hash).'">'.htmlentities($torrentname).'</a> » (<a href="magnet:?xt=urn:btih:'. strtoupper(base32_encode(pack("H*", $hash))).'">Magnet Link</a>)</td></tr>';
echo '<tr><td>Kategorie</td><td>: <a href="/cat.php?id='.$maincat.'">'.$name.'</a> » <a href="/subcat.php?id='.$subid.'">'.$subname.'</a></td></tr>';
echo '<tr><td>Grösse</td><td>: '.torsize($size).'</td></tr>';
echo '<tr><td>Seeder</td><td>: '.getpeer($seeds).'</td></tr>';
echo '<tr><td>Peers</td><td>: '.getpeer($peers).'</td></tr>';
echo '<tr><td>Tracker</td><td>: http://'.htmlentities($tracker['host']).' ('.detreg($registration).')</td></tr>';
echo '<tr><td>Hinzugefügt</td><td>: '.$added.'</td></tr>';
echo '<tr><td>Updated</td><td>: '.$updated.'</td></tr>';
echo '<tr><td>Hash</td><td>: '.htmlentities($hash).'</td></tr>';
echo '<tr><td>Alternative</td><td>: The file <em>'.htmlentities($torrentname).'</em> might also be available on UseNeXT <strong><a href="http://www.usenext.de/index.cfm?TD=377528">Click here to download the UseneXT client</strong></a></td></tr>'.$description;
echo '</table>';
// Display toggle files link
echo '<br /><a href="#det" onclick="expandcontract(\'files\',\'\')">Alle Files anzeigen</a> :: <a href="#" onclick="expandcontract(\'files\',\'none\')">Alle Files verstecken</a><br /><br />';
// Display internal files
echo '<a name="det"></a>';
echo '<table class="det" cellpadding="0" cellspacing="0" border="0">';
echo '<tbody id="files" style="display:none">';
@showfiles($hash);
echo '</tbody></table>';
// Fetch comments from sql
$result = mysql_query("SELECT * FROM comments WHERE id ='".strip_tags(trim($_GET['id']))."'");
$comment_count = mysql_num_rows($result);
// div colors
$color1 = 'class="light"';
$color2 = 'class="dark"';
$row_count = 0;
echo '<br /><h1>Kommentare ('.$comment_count.')</h1>';
if (!$comment_count == 0)
{
echo '<div class="commentwrapper">';
while ($row = mysql_fetch_array($result))
{
extract($row);
$row_color = ($row_count % 2) ? $color1 : $color2;
echo '<div '.$row_color.'><strong>'.htmlentities($name).'</strong> On <strong>'.$date.'</strong><br /><br />'.nl2br(htmlentities($post)).'</div><br /><br />';
$row_count++;
}
}
$result = mysql_query("SELECT * FROM ban WHERE ip = '$REMOTE_ADDR'");
if (mysql_num_rows($result) == 1)
{
echo '<br /><h1>You cant add any comments!</h1>You cant add any comments because you where banned for some reason.';
footer();
die;
}
echo '<br /><form id="comment" action="/details.php?id='.strip_tags(trim($_GET['id'])).'" method="post">';
echo '<input name="user" value="name" onclick=\'value=""\' /><br /><br />';
echo '<textarea name="comment" cols="50" rows="7"></textarea><br />';
echo '<input type="submit" name="submitted" value="submit" /></form></div>';
}
footer();
}
// Handle posted comment
else
{
$result = mysql_query("SELECT * FROM ban WHERE ip = '$REMOTE_ADDR'");
if (mysql_num_rows($result) == 1)
{
stheader('You have been banned from this section!');
echo '<h1>Banned!</h1>You have been banned from this section of the site for a very very very good reason, if you think a mistake has been made feel free to contact one of the admins';
footer();
die;
}
$commentid = strip_tags(trim($_GET['id']));
$name = trim($_POST['user']);
$comment = trim($_POST['comment']);
$ip= $REMOTE_ADDR;
$date = date('YmdHis');
if ($comment == '' || $name = '')
{
stheader('Comment failed!');
echo '<h1>Please fill out the entire form!</h1>';
footer();
die;
}
stheader('Comment submitted');
mysql_query("INSERT INTO comments (id,ip,date,name,post) VALUES ('$commentid','$ip','$date','$name','$comment')");
echo '<center><h1>Comment posted! Thanks.</h1><a href="/details.php?id='.strip_tags($_GET['id']).'">Click here to view your posting</a></center>';
footer();
}
?>
| |
__________________
Was sich heute HipHop nennt,
hieß früher "Stottern" und war
heilbar!!
| |
30.04.2006 22:45 |
| |
|
|
|
|
|
|
ThaKilla
Eroberer
Dabei seit:
30.03.2006 Beiträge: 55 Herkunft:
Ka....
Mitglied
bewerten
Level: 15
[?] Erfahrungspunkte:
6.604 Nächster Level: 7.465
| |
Zitat: |
Parse
error: parse error, unexpected '\"', expecting
',' or ';' in
/var/www/vhosts/torrent-portal.biz/subdomains/torrent/httpdocs/details.php
on line 63
echo
'<tr><td>Poster</td><td><center><img
src='".$row["poster"]."'></center></td></tr>';
|
versuchs
mal so
php: |
1:
|
echo '<tr><td>Poster</td><td><center><img src=\"".$row["poster"]."\"></center></td></tr>'; | |
__________________
| |
01.05.2006 11:13 |
| |
|
hast du in Zeile 65 am Ende ein ; ??
| |
01.05.2006 14:52 |
| |
|
|
|
|
|
|
ThaKilla
Eroberer
Dabei seit:
30.03.2006 Beiträge: 55 Herkunft:
Ka....
Mitglied
bewerten
Level: 15
[?] Erfahrungspunkte:
6.604 Nächster Level: 7.465
| |
Also ich versuch jetzt die poster funktion
zusammen zu basteln:
php: |
1:
2:
3:
4:
5:
6:
7:
8:
|
if(!$row["poster"])
{
echo '<tr><td>Poster</td><td><center><img src=\"poster.jpg\"></center></td></tr>';
}
else
{
echo '<tr><td>Poster</td><td><center><img src=\"".$row["poster"]."\"></center></td></tr>';
} | |
ich
hoffe das passt so
__________________
| |
01.05.2006 21:41 |
| |
|
|
|
|
|
|
|
|
|
|
|
|
nazareth
Super Moderator
Dabei seit:
16.02.2006 Beiträge: 139 Herkunft: Wie soll
ich die Frage verstehen ??
Bewertung:
Level: 19
[?] Erfahrungspunkte:
22.553 Nächster Level: 22.851
Themenstarter
| |
Zitat: |
Original von
ThaKilla Also ich versuch jetzt die
poster funktion zusammen zu basteln:
php: |
1:
2:
3:
4:
5:
6:
7:
8:
|
if(!$row["poster"])
{
echo '<tr><td>Poster</td><td><center><img src=\"poster.jpg\"></center></td></tr>';
}
else
{
echo '<tr><td>Poster</td><td><center><img src=\"".$row["poster"]."\"></center></td></tr>';
} | |
ich
hoffe das passt
so |
Also die
Tabelle für das Poster wird jetzt einwandfrei
angezeigt, allerdings doppelt. Nur wird das Poster
nicht angezeigt, d.h die DB Abfrage haut noch
nicht hin. Ich habe auch schon in diesem
WirrWarr versucht die mysql Abfrage für den Rest
der Tabellen zu finden, aber das scheint alles
einzelnd abgefragt zu werden.
Fakt ist: Die
DB Abfrage für das Poster funzt noch
nicht.
Andy
P.S. Den Bug mit der
doppelten Anzeige hab ich gefixt.
Wenn wir
jetzt noch die DB Abfrage hinbekommen bin ich
glücklich.
Jetzige details.php
code: |
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:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
|
<?
require_once "config.php";
connect ($dbhost, $dbuser, $dbpass, $database);
// Check if a comment was posted
if ($_POST['submitted'] == '')
{
// The details query
$result = mysql_query("SELECT * FROM torrents LEFT JOIN categories ON torrents.subcat = categories.subid WHERE torrents.id ='".strip_tags(trim($_GET['id']))."'") or die (mysql_error());
$count = mysql_num_rows($result);
if ($count == 0)
{
stheader('Torrent Not Found');
echo '<br /><h1>Torrent nicht gefunden</h1>';
footer();
die;
}
// extract data from sql
while ($row = mysql_fetch_array($result))
{
extract($row);
stheader('Torrentdetails für: '.htmlentities($torrentname));
?>
<script type="text/javascript">
function expandcontract(tbodyid,dis) {
document.getElementById(tbodyid).style.display = dis;
}
</script>
<?
$tracker = parse_url($tracker);
// Display upload description
if ($description == 1)
{
$result_desc = mysql_query("SELECT descr FROM description where id = '".strip_tags(trim($_GET['id']))."' LIMIT 1");
while ($row = mysql_fetch_array($result_desc))
{
extract($row);
$description = '<tr><td colspan="2"><center><br /><h1>Description</h1><div id="desc">'.nl2br(str_replace(' ',' ',$descr)).'</div></center><br /></td></tr>';
}
}
else
{
$description = '';
}
echo '<div class="location"><a href="/index.php">Home</a> :: <a href="/cat.php?id='.$maincat.'">'.$name.'</a> :: <a href="/subcat.php?id='.$subid.'">'.$subname.'</a> :: <a href="/details.php?id='.$id.'">'.htmlentities($torrentname).'</a></div>';
// Display torrent details
echo '<h1>'.htmlentities($torrentname).'</h1>';
echo '<table class="det" cellpadding="0" cellspacing="0" border="0">';
if(!$row["poster"])
echo '<tr><td>Poster</td><td><center><img src=\"".$row["poster"]."\"></center></td></tr>';
echo '<tr><td width="15%">Download</td><td>: <a href="/download.php?id='.htmlentities($hash).'">'.htmlentities($torrentname).'</a> » (<a href="magnet:?xt=urn:btih:'. strtoupper(base32_encode(pack("H*", $hash))).'">Magnet Link</a>)</td></tr>';
echo '<tr><td>Kategorie</td><td>: <a href="/cat.php?id='.$maincat.'">'.$name.'</a> » <a href="/subcat.php?id='.$subid.'">'.$subname.'</a></td></tr>';
echo '<tr><td>Grösse</td><td>: '.torsize($size).'</td></tr>';
echo '<tr><td>Seeder</td><td>: '.getpeer($seeds).'</td></tr>';
echo '<tr><td>Peers</td><td>: '.getpeer($peers).'</td></tr>';
echo '<tr><td>Tracker</td><td>: http://'.htmlentities($tracker['host']).' ('.detreg($registration).')</td></tr>';
echo '<tr><td>Hinzugefügt</td><td>: '.$added.'</td></tr>';
echo '<tr><td>Updated</td><td>: '.$updated.'</td></tr>';
echo '<tr><td>Hash</td><td>: '.htmlentities($hash).'</td></tr>';
echo '<tr><td>Alternative</td><td>: The file <em>'.htmlentities($torrentname).'</em> might also be available on UseNeXT <strong><a href="http://www.usenext.de/index.cfm?TD=377528">Click here to download the UseneXT client</strong></a></td></tr>'.$description;
echo '</table>';
// Display toggle files link
echo '<br /><a href="#det" onclick="expandcontract(\'files\',\'\')">Alle Files anzeigen</a> :: <a href="#" onclick="expandcontract(\'files\',\'none\')">Alle Files verstecken</a><br /><br />';
// Display internal files
echo '<a name="det"></a>';
echo '<table class="det" cellpadding="0" cellspacing="0" border="0">';
echo '<tbody id="files" style="display:none">';
@showfiles($hash);
echo '</tbody></table>';
// Fetch comments from sql
$result = mysql_query("SELECT * FROM comments WHERE id ='".strip_tags(trim($_GET['id']))."'");
$comment_count = mysql_num_rows($result);
// div colors
$color1 = 'class="light"';
$color2 = 'class="dark"';
$row_count = 0;
echo '<br /><h1>Kommentare ('.$comment_count.')</h1>';
if (!$comment_count == 0)
{
echo '<div class="commentwrapper">';
while ($row = mysql_fetch_array($result))
{
extract($row);
$row_color = ($row_count % 2) ? $color1 : $color2;
echo '<div '.$row_color.'><strong>'.htmlentities($name).'</strong> On <strong>'.$date.'</strong><br /><br />'.nl2br(htmlentities($post)).'</div><br /><br />';
$row_count++;
}
}
$result = mysql_query("SELECT * FROM ban WHERE ip = '$REMOTE_ADDR'");
if (mysql_num_rows($result) == 1)
{
echo '<br /><h1>You cant add any comments!</h1>You cant add any comments because you where banned for some reason.';
footer();
die;
}
echo '<br /><form id="comment" action="/details.php?id='.strip_tags(trim($_GET['id'])).'" method="post">';
echo '<input name="user" value="name" onclick=\'value=""\' /><br /><br />';
echo '<textarea name="comment" cols="50" rows="7"></textarea><br />';
echo '<input type="submit" name="submitted" value="submit" /></form></div>';
}
footer();
}
// Handle posted comment
else
{
$result = mysql_query("SELECT * FROM ban WHERE ip = '$REMOTE_ADDR'");
if (mysql_num_rows($result) == 1)
{
stheader('You have been banned from this section!');
echo '<h1>Banned!</h1>You have been banned from this section of the site for a very very very good reason, if you think a mistake has been made feel free to contact one of the admins';
footer();
die;
}
$commentid = strip_tags(trim($_GET['id']));
$name = trim($_POST['user']);
$comment = trim($_POST['comment']);
$ip= $REMOTE_ADDR;
$date = date('YmdHis');
if ($comment == '' || $name = '')
{
stheader('Comment failed!');
echo '<h1>Please fill out the entire form!</h1>';
footer();
die;
}
stheader('Comment submitted');
mysql_query("INSERT INTO comments (id,ip,date,name,post) VALUES ('$commentid','$ip','$date','$name','$comment')");
echo '<center><h1>Comment posted! Thanks.</h1><a href="/details.php?id='.strip_tags($_GET['id']).'">Click here to view your posting</a></center>';
footer();
}
?>
| |
__________________
Was sich heute HipHop nennt,
hieß früher "Stottern" und war
heilbar!!
| |
02.05.2006 19:57 |
| |
|
|
|
|
|
|
binnett69
Moderator
Dabei seit:
27.04.2006 Beiträge: 222
Bewertung:
Level: 19
[?] Erfahrungspunkte:
20.429 Nächster Level: 22.851
| |
|
02.05.2006 20:07 |
| |
|
|
|
|
|
|
nazareth
Super Moderator
Dabei seit:
16.02.2006 Beiträge: 139 Herkunft: Wie soll
ich die Frage verstehen ??
Bewertung:
Level: 19
[?] Erfahrungspunkte:
22.553 Nächster Level: 22.851
Themenstarter
| |
Habe die sql Abfrage in der jetzigen details.php
rausgenommen. Wenn ich sie reinsetze dann
erscheint folgender Fehler.
Fatal error:
Call to undefined function: sqlerr() in
/var/www/vhosts/torrent-portal.biz/subdomains/torrent/httpdocs/details.php
on line 39
details.php bei der dieser
Fehler erscheint:
code: |
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:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
|
<?
require_once "config.php";
connect ($dbhost, $dbuser, $dbpass, $database);
// Check if a comment was posted
if ($_POST['submitted'] == '')
{
// The details query
$result = mysql_query("SELECT * FROM torrents LEFT JOIN categories ON torrents.subcat = categories.subid WHERE torrents.id ='".strip_tags(trim($_GET['id']))."'") or die (mysql_error());
$count = mysql_num_rows($result);
if ($count == 0)
{
stheader('Torrent Not Found');
echo '<br /><h1>Torrent nicht gefunden</h1>';
footer();
die;
}
// extract data from sql
while ($row = mysql_fetch_array($result))
{
extract($row);
stheader('Torrentdetails für: '.htmlentities($torrentname));
?>
<script type="text/javascript">
function expandcontract(tbodyid,dis) {
document.getElementById(tbodyid).style.display = dis;
}
</script>
<?
$tracker = parse_url($tracker);
$res = mysql_query("SELECT torrents.poster WHERE torrents.id ='".strip_tags(trim($_GET['id']))."'")
or sqlerr();
$row = mysql_fetch_array($res);
// Display upload description
if ($description == 1)
{
$result_desc = mysql_query("SELECT descr FROM description where id = '".strip_tags(trim($_GET['id']))."' LIMIT 1");
while ($row = mysql_fetch_array($result_desc))
{
extract($row);
$description = '<tr><td colspan="2"><center><br /><h1>Description</h1><div id="desc">'.nl2br(str_replace(' ',' ',$descr)).'</div></center><br /></td></tr>';
}
}
else
{
$description = '';
}
echo '<div class="location"><a href="/index.php">Home</a> :: <a href="/cat.php?id='.$maincat.'">'.$name.'</a> :: <a href="/subcat.php?id='.$subid.'">'.$subname.'</a> :: <a href="/details.php?id='.$id.'">'.htmlentities($torrentname).'</a></div>';
// Display torrent details
echo '<h1>'.htmlentities($torrentname).'</h1>';
echo '<table class="det" cellpadding="0" cellspacing="0" border="0">';
if(!$row["poster"])
echo '<tr><td>Poster</td><td><center><img src=\"".$row["poster"]."\"></center></td></tr>';
echo '<tr><td width="15%">Download</td><td>: <a href="/download.php?id='.htmlentities($hash).'">'.htmlentities($torrentname).'</a> » (<a href="magnet:?xt=urn:btih:'. strtoupper(base32_encode(pack("H*", $hash))).'">Magnet Link</a>)</td></tr>';
echo '<tr><td>Kategorie</td><td>: <a href="/cat.php?id='.$maincat.'">'.$name.'</a> » <a href="/subcat.php?id='.$subid.'">'.$subname.'</a></td></tr>';
echo '<tr><td>Grösse</td><td>: '.torsize($size).'</td></tr>';
echo '<tr><td>Seeder</td><td>: '.getpeer($seeds).'</td></tr>';
echo '<tr><td>Peers</td><td>: '.getpeer($peers).'</td></tr>';
echo '<tr><td>Tracker</td><td>: http://'.htmlentities($tracker['host']).' ('.detreg($registration).')</td></tr>';
echo '<tr><td>Hinzugefügt</td><td>: '.$added.'</td></tr>';
echo '<tr><td>Updated</td><td>: '.$updated.'</td></tr>';
echo '<tr><td>Hash</td><td>: '.htmlentities($hash).'</td></tr>';
echo '<tr><td>Alternative</td><td>: The file <em>'.htmlentities($torrentname).'</em> might also be available on UseNeXT <strong><a href="http://www.usenext.de/index.cfm?TD=377528">Click here to download the UseneXT client</strong></a></td></tr>'.$description;
echo '</table>';
// Display toggle files link
echo '<br /><a href="#det" onclick="expandcontract(\'files\',\'\')">Alle Files anzeigen</a> :: <a href="#" onclick="expandcontract(\'files\',\'none\')">Alle Files verstecken</a><br /><br />';
// Display internal files
echo '<a name="det"></a>';
echo '<table class="det" cellpadding="0" cellspacing="0" border="0">';
echo '<tbody id="files" style="display:none">';
@showfiles($hash);
echo '</tbody></table>';
// Fetch comments from sql
$result = mysql_query("SELECT * FROM comments WHERE id ='".strip_tags(trim($_GET['id']))."'");
$comment_count = mysql_num_rows($result);
// div colors
$color1 = 'class="light"';
$color2 = 'class="dark"';
$row_count = 0;
echo '<br /><h1>Kommentare ('.$comment_count.')</h1>';
if (!$comment_count == 0)
{
echo '<div class="commentwrapper">';
while ($row = mysql_fetch_array($result))
{
extract($row);
$row_color = ($row_count % 2) ? $color1 : $color2;
echo '<div '.$row_color.'><strong>'.htmlentities($name).'</strong> On <strong>'.$date.'</strong><br /><br />'.nl2br(htmlentities($post)).'</div><br /><br />';
$row_count++;
}
}
$result = mysql_query("SELECT * FROM ban WHERE ip = '$REMOTE_ADDR'");
if (mysql_num_rows($result) == 1)
{
echo '<br /><h1>You cant add any comments!</h1>You cant add any comments because you where banned for some reason.';
footer();
die;
}
echo '<br /><form id="comment" action="/details.php?id='.strip_tags(trim($_GET['id'])).'" method="post">';
echo '<input name="user" value="name" onclick=\'value=""\' /><br /><br />';
echo '<textarea name="comment" cols="50" rows="7"></textarea><br />';
echo '<input type="submit" name="submitted" value="submit" /></form></div>';
}
footer();
}
// Handle posted comment
else
{
$result = mysql_query("SELECT * FROM ban WHERE ip = '$REMOTE_ADDR'");
if (mysql_num_rows($result) == 1)
{
stheader('You have been banned from this section!');
echo '<h1>Banned!</h1>You have been banned from this section of the site for a very very very good reason, if you think a mistake has been made feel free to contact one of the admins';
footer();
die;
}
$commentid = strip_tags(trim($_GET['id']));
$name = trim($_POST['user']);
$comment = trim($_POST['comment']);
$ip= $REMOTE_ADDR;
$date = date('YmdHis');
if ($comment == '' || $name = '')
{
stheader('Comment failed!');
echo '<h1>Please fill out the entire form!</h1>';
footer();
die;
}
stheader('Comment submitted');
mysql_query("INSERT INTO comments (id,ip,date,name,post) VALUES ('$commentid','$ip','$date','$name','$comment')");
echo '<center><h1>Comment posted! Thanks.</h1><a href="/details.php?id='.strip_tags($_GET['id']).'">Click here to view your posting</a></center>';
footer();
}
?>
| |
__________________
Was sich heute HipHop nennt,
hieß früher "Stottern" und war
heilbar!!
| |
02.05.2006 20:10 |
| |
|
|
|
|
|
|
|
|
|
Views heute: 3.794 | Views gestern:
3.284 | Views gesamt: 562.985
|