예제 #1
0
파일: biorss.php 프로젝트: adamd1/epj
}
// SQL query
$base_query = "SELECT ALL a.bio_id,a.section,a.bioyear,\n             a.date_entered,a.blab,a.showme,a.palm_posted,\n             DATE_FORMAT(a.date_entered, '%b. %D') AS outdate\n             FROM my_bio a\n             WHERE a.bioyear = {$p_yr}";
$nosho_query = " AND lower(a.showme) != 'n'";
$end_query = " ORDER BY a.section ASC,\n                      a.date_entered ASC;";
if ($pri != 'y') {
    $bio_query = $base_query . $nosho_query . $end_query;
} else {
    $bio_query = $base_query . $end_query;
}
fputs($fp, "<?xml version=\"1.0\"?>\r<!DOCTYPE rss SYSTEM \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\r<rss version=\"0.91\">\r<channel>\r   <copyright>Copyright 1997-{$yearout} Brainrub.com</copyright>\r   <pubDate>" . $formattedpubdate . "</pubDate>\r");
// connect to the database
$db = hookMeUp();
// headers
fputs($fp, "   <description>A website about personal technology.</description>\r   <link>http://brainrub.com/</link>\r   <title>Brainrub.com</title>\r<image>\r   <link>http://brainrub.com/</link>\r   <title>Brainrub.com</title>\r   <url>http://www.brainrub.com/images/brainrub_banner.jpg</url>\r   <height>65</height>\r   <width>470</width>\r</image>\r<webMaster>adam@brainrub.com (Adam D.)</webMaster>\r   <managingEditor>webmaster@brainrub.com (Adam D.)</managingEditor>\r<language>en-us</language>\r<skipHours>\r   <hour>1</hour>\r   <hour>2</hour>\r   <hour>3</hour>\r   <hour>4</hour>\r   <hour>5</hour>\r   <hour>6</hour>\r   <hour>7</hour>\r   <hour>8</hour>\r   <hour>23</hour>\r   <hour>24</hour>\r   </skipHours>\r   <skipDays>\r   <day>Saturday</day>\r   <day>Sunday</day>\r   </skipDays>\r");
$bio_res = mysql_query($bio_query, $db);
if ($bio_res) {
    while ($bio_row = mysql_fetch_array($bio_res)) {
        fputs($fp, "<item>\r<title>{$bio_row['outdate']}: {$bio_row['section']}");
        if ($array[author] != "") {
            fputs($fp, ", Adam D.");
        }
        fputs($fp, "</title>\r<link>http://ad4m.kicks-ass.net:8080/ad_bios/bioitem.epj?p_bio_id={$bio_row['bio_id']}</link>\r<description>Stuff!</description>\r</item>\r\r");
    }
    mysql_free_result($bio_res);
}
fputs($fp, "</channel>\r</rss>");
fclose($fp);
// Close the db connection
closeMeUp($db);
예제 #2
0
 function getPrevNextArticle($intID = 0, $strDirection = 'next')
 {
     global $sqli;
     $arrData = array();
     $intID = $sqli->real_escape_string($intID);
     $strDirection = $sqli->real_escape_string($strDirection);
     if ($strDirection == 'prev') {
         $sqlWhere = "`id` > {$intID}";
         $sqlDir = 'ASC';
     } else {
         $sqlWhere = "`id` < {$intID}";
         $sqlDir = 'DESC';
     }
     $sql = "SELECT `id`,`news_title` FROM `" . NEWS_TABLE . "` WHERE {$sqlWhere} AND `status`=1 ORDER BY `id` {$sqlDir} LIMIT 1;";
     $res = $sqli->query($sql) or die($sqli->error);
     $row = $res->fetch_assoc();
     $arrData['url'] = $row['news_title'];
     closeMeUp($res);
     return $arrData;
 }