L
Lukasz
Hallo ich muss meinen Script noch um 2 Auflistungs Arten aus der Datenbank erweitern. Jegliche versuche fehlgeschlagen.
Ich brauche eine IF anweisung auszulösen dieses mal durch
include.php?path=downloads/overview.php&type=4&catid=today
Dadurch sollen nur der type 4 mit den Datensätzen des aktuellen Tages ausgegeben werden.
Also praktisch files today.
Das einzige Problem noch liegt darin, dass die Zeit in der DB Binär gespeichert ist. Ich weis nicht wie ich da erst anfangen soll.
Zum anderen Problem komme ich dan doch lieber hinterher.
Wäre super wenn mir jemand einen Lösungsvorschlag machen könnte.
Gruss Lukasz!
Ich brauche eine IF anweisung auszulösen dieses mal durch
include.php?path=downloads/overview.php&type=4&catid=today
Dadurch sollen nur der type 4 mit den Datensätzen des aktuellen Tages ausgegeben werden.
Also praktisch files today.
Das einzige Problem noch liegt darin, dass die Zeit in der DB Binär gespeichert ist. Ich weis nicht wie ich da erst anfangen soll.
PHP:
<?php
if (isset($_REQUEST['entries'])) $entries=$_REQUEST['entries'];
else $entries=0;
if (isset($_REQUEST['type'])) $type=$_REQUEST['type'];
if (isset($_REQUEST['contentid'])) $contentid=$_REQUEST['contentid'];
if (isset($_REQUEST['catid'])) $catid=$_REQUEST['catid'];
if (isset($_REQUEST['themeid'])) $themeid=$_REQUEST['themeid'];
if (isset($_REQUEST['letter'])) $letter=$_REQUEST['letter'];
if (isset($_REQUEST['order'])) $order=$_REQUEST['order'];
if ($type==2) {$content_type=$lang['news']; $epp=$config['content_epp2']; $type=2; $content_page="news";}
elseif ($type==3) {$content_type=$lang['links']; $epp=$config['content_epp3']; $type=3; $content_page="overview";}
elseif ($type==4) {$content_type=$lang['downloads']; $epp=$config['content_epp4']; $type=4; $content_page="download";}
else {$type=1; $content_type=$lang['articles']; $epp=$config['content_epp1']; $type=1; $content_page="articles";}
if ($epp<1) {$epp=12;}
$contentcat_cache=contentcats();
$contentcat_cache=$contentcat_cache[0];
$sqlcommand="WHERE ".$db_tab['content'].".content_status=1 AND ".$db_tab['content'].".content_option='".$type."' AND ".$db_tab['content'].".content_time<'".time()."' AND (".$db_tab['content'].".content_expire>'".time()."' OR ".$db_tab['content'].".content_expire=0)";
if (intval($catid)>0) $sqlcommand.=" AND ".$db_tab['content'].".content_cat='".$catid."'";
if (intval($themeid)>0) $sqlcommand.=" AND ".$db_tab['content'].".content_themeid='".$themeid."'";
if (intval($contentid)>0) $sqlcommand.=" AND ".$db_tab['content'].".content_id='".$contentid."'";
if ($letter=='all') unset($letter);
elseif ($letter=='0-9') {
$sqlcommand.=" AND (".$db_tab['content'].".content_title LIKE '0%'";
$i=range(1,9);
foreach($i as $h) {
$sqlcommand.=" OR ".$db_tab['content'].".content_title LIKE '".$h."%'";
}
$sqlcommand.=")";
}
else $sqlcommand.=" AND ".$db_tab['content'].".content_title LIKE '".$letter."%'";
$sqlcommand="FROM ".$db_tab['content']." LEFT JOIN ".$db_tab['contentcat']." ON ".$db_tab['contentcat'].".contentcat_id=".$db_tab['content'].".content_cat ".$sqlcommand." AND ".sqlrights($db_tab['contentcat'].".contentcat_rights");
if ($order=="rate") $sqlorder="ORDER by ".$db_tab['content'].".content_rating DESC";
elseif ($order=="rated") $sqlorder="ORDER by ".$db_tab['content'].".content_rating ASC";
elseif ($order=="title") $sqlorder="ORDER by ".$db_tab['content'].".content_title ASC";
elseif ($order=="titled") $sqlorder="ORDER by ".$db_tab['content'].".content_title DESC";
elseif ($order=="dated") $sqlorder="ORDER by ".$db_tab['content'].".content_time ASC";
else $sqlorder="ORDER by ".$db_tab['content'].".content_time DESC";
$counter=$DB->num_rows($DB->query("SELECT ".$db_tab['content'].".* ".$sqlcommand));
if ($counter<$entries) $entries=0;
if ($counter==0) eval ("\$content_articles= \"".getTemplate("content/overview_notfound".$type."")."\";");
else {
$content_side=sidelinkfull($counter,$epp,$entries,'include.php?path=downloads/overview.php&letter='.$letter.'&catid='.$catid.'&themeid='.$themeid.'&type='.$type.'&order='.$order,"headssmall");
eval ("\$content_side= \"".getTemplate("content/overview_sidelink")."\";");
$getcontentinfo=$DB->query("SELECT ".$db_tab['content'].".* ".$sqlcommand." ".$sqlorder." LIMIT ".$entries.",".$epp);
while ($contentinfo=$DB->fetch_array($getcontentinfo)) {
if ($type==1 or $type==2) $row=rowcolor2($row);
else $row=rowcolor($row);
if (intval($contentinfo['content_autorid'])>0) {
if (!$userinfo_hash[$contentinfo['content_autorid']]) {
$userinfo=$DB->fetch_array($DB->query("SELECT user_id, user_nick FROM ".$db_tab['user']." WHERE user_id='".$contentinfo['content_autorid']."' LIMIT 1"));
$userinfo_hash[$userinfo['user_id']]=$userinfo;
}
else $userinfo=$userinfo_hash[$contentinfo['content_autorid']];
eval ("\$autor_info= \"".getTemplate("member_showprofil_textlink","small")."\";");
}
else $autorinfo=$contentinfo['content_autor'];
$contentcatinfo=$contentcat_cache[$contentinfo['content_cat']];
$content_title=stripslashes($contentinfo['content_title']);
if (intval($contentinfo['content_themeid'])>0) {
$contentthemeinfo=$DB->fetch_array($DB->query("SELECT * FROM ".$db_tab['contenttheme']." WHERE contenttheme_id='".$contentinfo['content_themeid']."'"));
eval ("\$contenttheme_info= \"".getTemplate("content/article_theme_textlink")."\";");
}
$content_time=formattime($contentinfo['content_time'],'','date');
$content_time_full=formattime($contentinfo['content_time']);
eval ("\$content_link= \"".getTemplate("content/overview_article_title")."\";");
if ($contentinfo['content_teaser']!='') {
$catimage_dimension=@getimagesize($contentinfo['content_teaser']);
eval ("\$content_catimage= \"".getTemplate("content/overview_teaser")."\";");
}
elseif ($contentcatinfo['contentcat_symbol']!='blank.gif' && $contentcatinfo['contentcat_symbol']!='' && filecheck("images/catimages/".$contentcatinfo['contentcat_symbol'])) {
$catimage_dimension=@getimagesize('images/catimages/'.$contentcatinfo['contentcat_symbol']);
eval ("\$content_catimage= \"".getTemplate("content/cat_image_left")."\";");
}
if ($type==1) $cut=$config['content_length1'];
elseif ($type==2) $cut=$config['content_length2'];
elseif ($type==3) $cut=$config['content_length3'];
elseif ($type==4) $cut=$config['content_length4'];
$content_headline=substr(strip_tags($PARSE->parse($contentinfo['content_header'].' '.$contentinfo['content_text'],1,1,1,1)),0,$cut);
if ($type==1) {
if ($row=='odd' || $row=='even2') eval ("\$content_articles.= \"".getTemplate("content/overview_article_linkbox_left")."\";");
else eval ("\$content_articles.= \"".getTemplate("content/overview_article_linkbox_right")."\";");
}
elseif ($type==2) {
if ($row=='odd' || $row=='even2') eval ("\$content_articles.= \"".getTemplate("content/overview_news_linkbox_left")."\";");
else eval ("\$content_articles.= \"".getTemplate("content/overview_news_linkbox_right")."\";");
}
elseif ($type==3) {
if ($contentinfo['content_comment_status']==1) {
$ccounter=$DB->fetch_array($DB->query("SELECT COUNT(*) FROM ".$db_tab['comment']." WHERE comment_cat='cont' AND comment_subid='".$contentinfo['content_id']."'"));
eval ("\$content_comment= \"".getTemplate("content/link_comment_link")."\";");
}
if ($contentinfo['content_rating_status']==1) {
if (intval($contentinfo['content_rating_total'])>0) {
$content_rating_d=number_format($contentinfo['content_rating'],2,",",".");
$content_rating_votes=$contentinfo['content_rating_total'];
eval ("\$content_rating_info= \"".getTemplate("content/link_rating_info")."\";");
}
eval ("\$content_rate= \"".getTemplate("content/link_rating_link")."\";");
}
$content_description=$PARSE->parse($contentinfo['content_header'].' '.$contentinfo['content_text'],$contentinfo['content_html'],$contentinfo['content_ubb'],$contentinfo['content_smilies'],1);
eval ("\$content_articles.= \"".getTemplate("content/overview_links_linkbox")."\";");
}
elseif ($type==4) {
if ($contentinfo['content_rating_status']==1 && intval($contentinfo['content_rating_total'])>0) {
$content_rating=number_format($contentinfo['content_rating'],2,",",".");
eval ("\$content_rating= \"".getTemplate("content/overview_downloads_linkbox_rating")."\";");
}
$dl=explode("\n",$contentinfo['content_altdat']);
foreach($dl as $d) {
$d=trim($d);
$file_size=FileSizeExt($config['content_downloadpath'].'/'.$d,'B');
if ($file_size!='') break;
}
if ($file_size=='') $file_size=FileSizeExt('','B',$contentinfo['content_filesize']*1024);
if ($file_size=="" || $file_size==0) $file_size=' - ';
eval ("\$content_articles.= \"".getTemplate("content/overview_downloads_linkbox")."\";");
}
unset($content_rating);
unset($file_size);
unset($content_rating_info);
unset($contenttheme_info);
unset($content_catimage);
unset($content_rate);
unset($content_rating_info);
unset($content_comment);
unset($ccounter);
unset($content_comment_count);
}
}
if (($type==1 || $type==2) && ($row=='odd' || $row=='even2')) {
if ($row=='odd') $row="even";
else $row="odd2";
eval ("\$content_articles.= \"".getTemplate("content/overview_article_spacer_right")."\";");
unset($row);
}
$getcontentcatinfo=$DB->query("SELECT * FROM ".$db_tab['contentcat']." WHERE ".sqlrights("contentcat_rights")." AND contentcat_type".$type."=1 ORDER by contentcat_order, contentcat_name ASC");
while ($contentcatinfo=$DB->fetch_array($getcontentcatinfo)) {
unset($selected);
if ($contentcatinfo['contentcat_id']==$catid) {
eval ("\$content_cat= \"".getTemplate("content/overview_cat_link")."\";");
$selected=" selected";
}
elseif ($content_cat=='') $content_cat='Übersicht';
eval ("\$overview_cats.= \"".getTemplate("content/overview_cat_option")."\";");
}
if ($type==1 && getrights($config['content_submit1'])=="true") eval ("\$submit_link= \"".getTemplate("content/overview_submitlink")."\";");
elseif ($type==2 && getrights($config['content_submit2'])=="true") eval ("\$submit_link= \"".getTemplate("content/overview_submitlink")."\";");
elseif ($type==3 && getrights($config['content_submit3'])=="true") {
$content_type=$lang['links'];
eval ("\$submit_link= \"".getTemplate("content/overview_submitlink")."\";");
}
elseif ($type==4 && getrights($config['content_submit4'])=="true") {
$content_type=$lang['download'];
eval ("\$submit_link= \"".getTemplate("content/overview_submitdownload")."\";");
}
eval ("\$site_body.= \"".getTemplate("content/Menu")."\";");
eval ("\$site_body.= \"".getTemplate("content/overview_page".$type)."\";");
?>
Wäre super wenn mir jemand einen Lösungsvorschlag machen könnte.
Gruss Lukasz!
Zuletzt bearbeitet von einem Moderator: