[EF IV] Download dla zarejestrowanych
|
LeitoPL02 |
Dodany dnia 31.01.2009 16:18:37
|
Przedszkolak
Postów: 14
Data rejestracji: 29.01.2009 00:22
|
Siemka! Mam problemik, ponieważ chcę zrobić download tylko dla zalogowanych, ale mi wywala błąd, oto kod całego downloadu jak to wykonałem:
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2005 Nick Jones
| http://www.php-fu...
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "maincore.php";
include LOCALE.LOCALESET."downloads.php";
if(iMEMBER} {
if (!isset($cat_id)) {
$meta_title = " : ".$locale['400'];
}
if (isset($cat_id)) {
$result = dbquery("SELECT download_cat_name,download_cat_up FROM ".$db_prefix."download_cats WHERE download_cat_id='$cat_id'");
$cdata = dbarray($result);
$ddata = dbarray(dbquery("SELECT download_cat_name from ".$db_prefix."download_cats WHERE download_cat_id='".$cdata['download_cat_up']."'"));
$meta_title = " : ".$locale['400']." : ".$ddata['download_cat_name']." : ".$cdata['download_cat_name'];
}
require_once "subheader.php";
$table="panels_download";
require_once "side_left.php";
if (isset($download_id) && !isNum($download_id)) fallback("index.php");
if (!isset($cat_level)) $cat_level=0;
if (!isset($cat_up)) $cat_up=0;
if (isset($download_id)) {
$res = 0;
if ($data = dbarray(dbquery("SELECT download_url,download_cat FROM ".$db_prefix."downloads WHERE download_id='$download_id'"))) {
$cdata = dbarray(dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_cat_id='".$data['download_cat']."'"));
if (checkgroup($cdata['download_cat_access'])) {
$res = 1;
$result = dbquery("UPDATE ".$db_prefix."downloads SET download_count=download_count+1 WHERE download_id='$download_id'");
redirect($data['download_url']);
}
}
if ($res == 0) redirect("downloads.php");
}
if (!isset($cat_id)) {
opentable($locale['400']);
$result = dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_cat_up='-1' ORDER BY download_cat_name");
$rows = dbrows($result);
if ($rows != 0) {
$counter = 0; $columns = 1;
echo "<center><table width='80%' cellspacing='0' cellpadding='0' class='tbl'>\n";
while ($data = dbarray($result)) {
if (checkgroup($data['download_cat_access'])) {
if ($counter != 0 && ($counter % $columns == 0)) echo "</tr>\n<tr>\n";
$num = dbcount("(download_cat)", "downloads", "download_cat='".$data['download_cat_id']."'");
echo "<td align='left' valign='top' width='50%'>";
if ($data['download_cat_image'] != "") {
echo "<img src='".$data['download_cat_image']."' align='left' height='50'>";
} else {
echo "<img src='".IMAGES."download_cat.gif' align='left' height='50'>";
}
echo "<b><u>".$locale['D_018']."</u><br><b>".$data['download_cat_name']."</b>";
if ($data['download_cat_description'] != "") echo "<br>\n<span class='small'>".$data['download_cat_description']."</span>";
echo "</td><td width='2%'><img src='".IMAGES."download_table.gif' align='center' width='1'></td><td><td align='left' valign='top' width='48%'><b><u>".$locale['D_001']."</u></b><br>\n";
$r = dbquery("SELECT download_cat_id,download_cat_name from ".$db_prefix."download_cats WHERE download_cat_up='".$data['download_cat_id']."'");
$x=0;
$num = dbrows($r);
while ($d = dbarray($r))
{
$x++;
if ($x == $num) $p=""; else $p=", ";
$files = dbrows(dbquery("SELECT download_id from ".$db_prefix."downloads WHERE download_cat='".$d['download_cat_id']."'"));
echo "<a href='".FUSION_SELF."?cat_id=".$d['download_cat_id']."'>".$d['download_cat_name']." ($files)</a>".$p;
}
echo "</td>";
$counter++;
}
}
echo "</tr>\n</table></center><br><br>\n";
} else {
echo "<center><br>\n".$locale['430']."<br><br>\n</center>\n";
}
if (!isset($stext)) $stext="";
echo "<center><form name='searchform' method='post' action='".BASEDIR."search.php?stype=d'>
".$locale['D_003']."<input type='text' name='stext' value='$stext' class='textbox' style='width:150px'>
<input type='submit' name='search' value='".$locale['D_004']."' class='button'>
</form></center>";
$plikow = dbquery("SELECT count(download_id) FROM ".$db_prefix."downloads");
echo "<div align='right'>".$locale['D_002']."<b>".dbresult($plikow, 0)."</b> </div>";
closetable();
} else {
$res = 0;
if (!isNum($cat_id)) fallback(FUSION_SELF);
$t1 = dbarray(dbquery("SELECT * from ".$db_prefix."download_cats WHERE download_cat_id='".$cat_id."'"));
$t2 = dbarray(dbquery("SELECT download_cat_name from ".$db_prefix."download_cats WHERE download_cat_id='".$t1['download_cat_up']."'"));
echo "<a name='Download'></a>";
opentable($t2['download_cat_name']." - ".$t1['download_cat_name']);
echo "<script type='text/javascript' src='".INFUSIONS."user_info_panel/javascript/gpe.js' language='Javascript'></script>";
if (checkrights("DC")){
echo "<div align='right'>";
echo "[ <a href='".ADMIN."download_cats.php".$aidlink."&step=edit&cat_id=".$t1['download_cat_id']."'>".$locale['D_005']."</a>";
echo " | <a href='".ADMIN."downloads.php".$aidlink."&step=add&download_cat_id=".$t1['download_cat_id']."'>".$locale['D_006']."</a> ]";
}
echo "</div><center><table width='90%' cellspacing='0' cellpadding='0' class='tbl'>\n";
echo "<td align='left' valign='top' width='70%'>";
if ($t1['download_cat_image'] != "") {
echo "<img src='".$t1['download_cat_image']."' align='left' height='70'>";
} else {
echo "<img src='".IMAGES."subdownload_cat.gif' align='left' height='70'>";
}
echo "<table width='100%' cellspacing='0' cellpadding='0'><tr><td class='tbl2' > <strong>".$t1['download_cat_name']."</strong></td></tr>";
echo "<tr><td class='tbl1' height='100%'><span class='small'>".$t1['download_cat_description']."</span></td></tr></table>";
echo "</td></tr></table><table width='80%' cellspacing='0' cellpadding='0' class='tbl'>\n" ;
echo "<td align='center' valign='bottom' width='100%'>".$locale['D_007'];
$t3 = dbquery("SELECT download_cat_name,download_cat_id from ".$db_prefix."download_cats WHERE download_cat_up='".$t1['download_cat_up']."'");
$num = dbrows($t3);
$x=0;
while ($d = dbarray($t3))
{
$x++;
if ($d['download_cat_id'] != $cat_id) echo "<a href='".FUSION_SELF."?cat_id=".$d['download_cat_id']."'>".$d['download_cat_name']."</a>";
else echo "<font color='orange'><strong>".$d['download_cat_name']."</strong></font>";
if ($x != $num) echo ", ";
}
if (!isset($stext)) $stext="";
echo "</td></tr></table><br><table width='100%' cellspacing='0' cellpadding='0' class='tbl'><tr><td align='left'>";
echo "<form name='searchform' method='post' action='".BASEDIR."search.php?stype=d'>
".$locale['D_003']."<input type='text' name='stext' value='$stext' class='textbox' style='width:150px'>
<input type='submit' name='search' value='".$locale['D_004']."' class='button'>
</form>";
echo "</td><td align='right'>";
if ($t1['download_cat_datestamp'] !=0) echo $locale['D_008'].showdate("forumdate", $t1['download_cat_datestamp']);
echo "</td></tr></table></center>";
closetable();
$result = dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_cat_id='$cat_id'");
if (dbrows($result) != 0) {
$cdata = dbarray($result);
if (checkgroup($cdata['download_cat_access'])) {
$res = 1;
opentable($locale['400'].": ".$data['download_cat_name']);
$rows = dbcount("(*)", "downloads", "download_cat='$cat_id'");
if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0;
if ($rows != 0) {
$result = dbquery("SELECT * FROM ".$db_prefix."downloads WHERE download_cat='$cat_id' ORDER BY download_title LIMIT $rowstart,15");
$numrows = dbrows($result); $i = 1;
while ($data = dbarray($result)) {
if ($data['download_datestamp']+604800 > time()+($settings['timeoffset']*3600)) {
$new = " <span class='small'>".$locale['410']."</span>";
} else {
$new = "";
}
echo "<center><table width='520' cellspacing='0' cellpadding='0' class='tbl'><tr><td class='tbl2' width='75%'><img src='".THEME."images/bullet.gif'> <a href='".FUSION_SELF."?cat_id=$cat_id&download_id=".$data['download_id']."' target='_blank'><strong>".$data['download_title']."</strong></a> - ".$data['download_filesize']." $new</td><td class='tbl2' width='25%'> </td></tr><tr><td class='tbl1' valign='top'>\n";
if ($data['download_description'] != "") echo nl2br(parseubb($data['download_description']))."\n";
echo "</td><td class='tbl1' align='center' valign='top'>";
echo "<a href='$PHP_SELF?cat_id=$cat_id&download_id=".$data['download_id']."' target='_blank' onmouseover=\"gpe('text:<center><b>° ".$locale['D_009']." °</b><hr>".$locale['D_010']."<b></b></center>;')\"><img src='".IMAGES."download.gif' border='0'></a>";
if ($data['download_image'] != "") {
echo " <a href='".$data['download_image']."' target='_blank' onmouseover=\"gpe('text:<center><b>° ".$locale['D_009']." °</b><hr>".$locale['D_011']."<b></b></center>;')\"><img src='".IMAGES."preview.gif' border='0'></a>";
} else {
echo "\n";
}
echo " <a href='#' onmouseover=\"gpe('text:<center><b>° ".$locale['D_009']." °</b></center><hr><b>".$locale['D_016']."</b> ".$data['download_license']."<br><b>O/S:</b> ".$data['download_os']."<br><b>".$locale['D_014']."</b> ".$data['download_version']."<br><b>".$locale['D_012']."</b> ".showdate("%d.%m.%y", $data['download_datestamp'])."<br><b>".$locale['D_015']."</b> ".$data['download_filesize'].";')\" class='side'>
<img src='".IMAGES."info.gif' border='0'></a>";
if ($data['download_adres'] != "") {
echo " <a href='".$data[download_adres]."' target='_blank' onmouseover=\"gpe('text:<center><b>° ".$locale['D_009']." °</b><hr>".$locale['D_017']."<b></b></center>;')\"><img src='".IMAGES."www.gif' border='0'></a>";
} else {
echo "\n";
}
echo "<a href='".BASEDIR."contact.php?subject=".$locale['RContact01'].$data['download_title']."&message=".$locale['RContact02'].$data['download_title'].$locale['RContact03'].$data['download_id']."' onmouseover=\"gpe('text:<center><b>° ".$locale['D_009']." °</b><hr>".$locale['RContact04']."<b></b></center>;')\"><img src='".IMAGES."error.gif' border='0'></a>";
echo "<br><span class='small'>".$locale['D_013']."</span><br><b>".$data['download_count']."</b></center>";
echo "</span></td></tr></table></center><br>";
echo ($i != $numrows ? "\n" : "\n"); $i++;
}
echo "<center><table width='520' cellspacing='0' cellpadding='0'><tr><td width='50%'><a href=\"javascript:history.go(-1)\"><img src='".IMAGES."back.gif' align='left' border='0'></td><td width='50%'><a href='#Download'><img src='".IMAGES."top.gif' align='right' border='0'></a></td></tr></table></center>";
closetable();
echo "<div align='center' style='margin-top:5px;'>\n".makePageNav($rowstart,15,$rows,3,FUSION_SELF."?cat_id=$cat_id&")."\n</div>\n";
} else {
echo $locale['431']."\n";
closetable();
}
}
}
if ($res == 0) redirect(FUSION_SELF);
}
} else {
opentable('Brak dostępu!');
echo "Nie masz tutaj dostępu, zaloguj się lub zarejestruj!";
closetable();
require_once "side_right.php";
require_once "footer.php";
?> Kliknij i zaczekaj na załadowanie kodu ...
Edytowane przez Pieka dnia 31.01.2009 17:11:50
|
|
|
|
Wścibski Gość |
Dodany dnia 25.11.2024 05:48:12
|
Pan Kontekstualny
Postów: n^x
Data rejestracji: Zawsze
|
|
IP: localhost |
|
|
kefirek |
Dodany dnia 31.01.2009 16:25:50
|
Zaawansowany
Postów: 1191 Pomógł: 418 Ostrzeżeń: 1
v6.00.xxx Data rejestracji: 06.04.2008 21:59
|
Na samym końcu po closetable(); brakuje chyba } |
|
|
|
LeitoPL02 |
Dodany dnia 31.01.2009 19:13:11
|
Przedszkolak
Postów: 14
Data rejestracji: 29.01.2009 00:22
|
Niestety, zrobiłem tak jak napisałeś, lecz dalej wyskakuje błąd. Jakieś pomysły? |
|
|
|
kefirek |
Dodany dnia 31.01.2009 19:21:30
|
Zaawansowany
Postów: 1191 Pomógł: 418 Ostrzeżeń: 1
v6.00.xxx Data rejestracji: 06.04.2008 21:59
|
W załaczniku gotowy plik
kefirek dodał/a następującą plik:
Edytowane przez kefirek dnia 31.01.2009 19:21:43
|
|
|
|
LeitoPL02 |
Dodany dnia 01.02.2009 11:10:30
|
Przedszkolak
Postów: 14
Data rejestracji: 29.01.2009 00:22
|
Dalej nic, błąd się wyświetla. |
|
|