Jump to content
php.lv forumi

SKuLs

Reģistrētie lietotāji
  • Posts

    4
  • Joined

  • Last visited

Posts posted by SKuLs

  1. Tātad dabūju scriptu ,brt man met erroru uz php-fusion jo scripts nav ar database conection un vai to varētu izveidot uz šī scripta? Šis scripts izvelk jaunumus no foruma galvenajā lapā!

    <?php

    ############################

    ### SCRIPT CONFIGURATION ###

    ############################

    //Server Path to The Forum

    $cfg['forum_path'] = "./forums"; //DO NOT ADD A TRAILING SLASH!!

    //Which Forum to Read from (You can have multiple of these)

    $cfg['forums_id'][] = "16";

    //$cfg['forums_id'][] = "1";

    //$cfg['forums_id'][] = "1";

    //$cfg['forums_id'][] = "1";

    //Position of the Newest Post (DESC = Top, ASC = Bottom)

    $cfg['latest_pos'] = "DESC";

    //Display News per Page

    $cfg['per_page'] = "4";

    //News Limit - Global Limit (0 - No Limit)

    $cfg['news_limit'] = "60";

    //Message to Display when there are no News

    $cfg['no_news'] = "There is currently no News.";

    //Show page selector (true, false)

    $cfg['page_select'] = "true";

    //DEBUG MODE -- MAKE SURE YOU KNOW WHAT YOU ARE DOING

    $cfg['debug'] = "false";

     

    ##############

    ### SCRIPT ###

    ##############

    require_once( $cfg['forum_path'] . "/conf_global.php" );

     

    $mysql = mysql_connect( $INFO['sql_host'], $INFO['sql_user'], $INFO['sql_pass'] /*, $INFO['sql_driver'] */ );

    if ( !$mysql ) {

    die( "<b>mysql_connect()</b>: ". mysql_error() );

    }

     

    $select_db = mysql_select_db( $INFO['sql_database'], $mysql );

    if ( !$select_db ) {

    die( "<b>mysql_select_db()</b>: ". mysql_error() );

    }

     

    for ($i = 0; $i < count( $cfg['forums_id'] ); $i++ ) {

    $cfg['forum_id'] = $cfg['forums_id'][$i];

     

    if ( $cfg['news_limit'] != "0" ) {

    $query = mysql_query( "SELECT t.tid, t.title, t.topic_firstpost, p.pid, p.topic_id, p.post_date, p.author_id, m.id, m.name, p.post, t.posts

    FROM ". $INFO['sql_tbl_prefix'] ."topics t, ". $INFO['sql_tbl_prefix'] ."posts p, ". $INFO['sql_tbl_prefix'] ."members m

    WHERE t.forum_id = '". $cfg['forum_id'] ."'

    AND t.tid = p.topic_id

    AND p.author_id = m.id

    AND p.pid = t.topic_firstpost

    ORDER BY p.post_date ". $cfg['latest_pos'] ."

    LIMIT ". $cfg['news_limit'] );

    } else {

    $query = mysql_query( "SELECT t.tid, t.title, t.topic_firstpost, p.pid, p.topic_id, p.post_date, p.author_id, m.id, m.name, p.post, t.posts

    FROM ". $INFO['sql_tbl_prefix'] ."topics t, ". $INFO['sql_tbl_prefix'] ."posts p, ". $INFO['sql_tbl_prefix'] ."members m

    WHERE t.forum_id = '". $cfg['forum_id'] ."'

    AND t.tid = p.topic_id

    AND p.author_id = m.id

    AND p.pid = t.topic_firstpost

    ORDER BY p.post_date ". $cfg['latest_pos'] );

    }

     

    if ( !$query ) {

    die( "<b>mysql_query()</b>: ". mysql_error() );

    }

     

    $iNews = mysql_num_rows( $query );

    $iRun = 0;

    $iCurrent = 0;

     

    if ( $iNews == 0 ) {

    echo "<center><span style=\"font-family: Tahoma; font-size: 13px\">". $cfg['no_news'] ."</span></center><br>";

    }

     

    while ( $row = mysql_fetch_array( $query, MYSQL_NUM ) ) {

    if ( $cfg['debug'] == "true" ) {

    print_r( $row );

    }

     

    $iRun++;

    if ( $iRun > ( $_GET['pg'] - 1 ) * $cfg['per_page'] && $iCurrent < $cfg['per_page'] ) {

     

    /* EDIT THE DISPLAY DESIGN BELOW - CAREFUL (BEGIN) */

    $sTemplate = <<<EOT

    <table width="100%" cellpadding="3" cellspacing="3" border="0" class="forumline">

    <tr>

    <th class="thTop" height="20"><A NAME="<!-- TOPIC -->" title="<!-- TITLE -->"><FONT class="topic_title"><!-- TITLE --></FONT></a></th>

    </tr>

    <tr>

    <td class="row1" style="font-size:11px;align:left;width:100%;">

    Pievienoja <a href="<!-- FORUM -->/index.php?showuser=<!-- USER -->" target="_blank" title="Click Here For <!-- AUTHOR -->'s Profile!"><B><!-- AUTHOR --></B></a>

    <DIV style="text-align:left;font-size:10px;">

    <br>

    <!-- POST -->

    </DIV>

    <br>

    <DIV style="text-align:right;font-size:10px;">

    <a href="<!-- FORUM -->/index.php?showtopic=<!-- TOPIC -->" title="View This Topic" target="_blank"> Apskat?t /koment?ri</a> [<!-- REPLIES -->

    ]</DIV>

    </td>

    </tr>

    </table>

    <BR />

    EOT;

     

    /* EDIT THE DISPLAY DESIGN BELOW - CAREFUL (END) */

     

    $sParsed = str_replace( array( "<!-- TITLE -->",

    "<!-- POST -->",

    "<!-- TIME -->",

    "<!-- AUTHOR -->",

    "<!-- REPLIES -->",

    "<!-- FORUM -->",

    "<!-- TOPIC -->",

    "style_emoticons/<#EMO_DIR#>", //SMILEY FIX

    "<!-- USER -->",

    "

    ",

    "

    ",

    "class='quotetop'",

    "class='quotemain'",

    "class='codetop'",

    "class='codemain'" ),

    array( $row[1],

    $row[9],

    //Begin NuclearGeneral Custom Date

    date( "l, F j, Y h:i A", $row[5] ),

    //End NuclearGeneral Custom Date

    //Begin Orginal Date

    //date( "F m, Y", $row[5] ),

    //End Orginal Date

    $row[8],

    $row[10],

    $cfg['forum_path'],

    $row[0],

    $cfg['forum_path'] ."/style_emoticons/default",

    $row[7],

    "<blockquote>",

    "</blockquote>",

    "style='background: #E4EAF2; border: 1px dotted #000; border-bottom: 0; border-left: 4px solid #8394B2; color: #000; font-weight: bold; font-size: 10px; margin: 8px auto 0 auto; padding: 3px;'",

    "style='background: #FAFCFE; border: 1px dotted #000; border-left: 4px solid #8394B2; border-top: 0; color: #465584; padding: 4px; margin: 0 auto 8px auto;'",

    "style='background: #FDDBCC; color: #000; font-weight: bold; margin: 0 auto 0 auto; padding: 3px; width: 98%;'",

    "style='background: #FAFCFE; border: 1px dotted #000; color: #465584; font-family: Courier, Courier New, Verdana, Arial; margin: 0 auto 0 auto; padding: 2px; width: 98%;'" ),

    $sTemplate );

     

    if ( $cfg['debug'] != "true" ) {

    echo $sParsed;

    }

     

    $iCurrent++;

    }

    }

     

    mysql_free_result( $query );

    }

     

    mysql_close( $mysql );

     

    if ( $cfg['page_select'] == "true" ) {

    if ( $_GET['pg'] == "1" || $_GET['pg'] == "" ) {

    echo "<span style=\"font-family: Tahoma; font-size: 13px\"><center><b><a style=\"text-decoration: none\" href=\"". $_SERVER['PHP_SELF'] ."?pg=1\"><<</a></b>";

    } else {

    echo "<span style=\"font-family: Tahoma; font-size: 13px\"><center><b><a style=\"text-decoration: none\" href=\"". $_SERVER['PHP_SELF'] ."?pg=". ( $_GET['pg'] - 1 ) ."\"><<</a></b>";

    }

     

    for ( $i = 0; $i < $iNews / $cfg['per_page']; $i++ ) {

    if ( $i == $_GET['pg'] - 1 || ( $i == 0 && $_GET['pg'] == "" ) ) {

    echo " <u>". ( $i + 1 ) ."</u> ";

    } else {

    echo " <a style=\"text-decoration: none\" href=\"". $_SERVER['PHP_SELF'] ."?pg=". ( $i + 1 ) ."\">". ( $i + 1 ) ."</a> ";

    }

    }

     

    if ( $_GET['pg'] == $i ) {

    echo "<b><a style=\"text-decoration: none\" href=\"". $_SERVER['PHP_SELF'] ."?pg=". $_GET['pg'] ."\">>></a></b>";

    } else if ( $i > 1 && $_GET['pg'] == "" ) {

    echo "<b><a style=\"text-decoration: none\" href=\"". $_SERVER['PHP_SELF'] ."?pg=". ( $_GET['pg'] + 2 ) ."\">>></a></b>";

    } else if ( $i <= 1 && $_GET['pg'] == "" ) {

    echo "<b><a style=\"text-decoration: none\" href=\"". $_SERVER['PHP_SELF'] ."?pg=". ( $_GET['pg'] + 1 ) ."\">>></a></b>";

    } else {

    echo "<b><a style=\"text-decoration: none\" href=\"". $_SERVER['PHP_SELF'] ."?pg=". ( $_GET['pg'] + 1 ) ."\">>></a></b>";

    }

    }

    echo "";

    ?>

    Ja var izpalīdzat!

×
×
  • Create New...