Visualizzazione risultati 1 fino 5 di 5

Discussione: [sNews] Se non sei loggato...non entri! -> Problema...

  1. #1
    Guest

    Post [sNews] Se non sei loggato...non entri! -> Problema...

    Allora sto sviluppando questo piccolo script per sNews...ma ho un problema:
    Codice PHP:
    <?php

    session_start
    ();

    include(
    'snews.php');

    if(
    $_SESSION[_SITE.'Logged_In']) {
    include(
    "template.php");
    } else {
    ?>
    <html>
    <head>
    <title>www.mysite.0fees.net</title>
    </head>
    <body>
    <h3>&laquo; Accedi a www.mysite.0fees.net &raquo;</h3>
    <form method="post" action="http://www.mysite.0fees.net/v2/administration/" id="post" accept-charset="UTF-8">

    <p><label for="uname">Username</label>:<br />
    <input type="text" name="uname" id="uname" class="text" value="" /></p>

    <p><label for="pass">Password</label>:<br />
    <input type="password" name="pass" id="pass" class="text" value="" /></p>

    <p><?=mathCaptcha();?></p>

    <p><input type="hidden" name="Loginform" id="Loginform" value="True" /><input type="submit" name="submit" id="submit" class="button" value="Accedi al Sito" /></p></form></div>
    </body>
    </html>
    <?php
    }
    ?>
    La mia versione di sNews è 1.7 (ultima)..in pratica lo script fa così:
    Devi accedere per vedere il sito fatto con sNews..le sessioni sono basate su quelle del CMS in questione..ma quando io clikko su "Home" e sono loggato mi spunta pagina bianca...perchè? Invece tutto il resto funziona!!
    Grazie 1000....ciao Davide! ^^

  2. #2
    Guest

    Predefinito

    La prima regola del debug (non io ma l'azione) è di stampare...
    Stampa tutto, tutte le variabili, le costanti, metti echo "A", echo "B", ecc. nei vari step dello script (cioè dopo le inclusioni, all'interno delle if, prima e dopo i cicli, ecc)


    ciao!

  3. #3
    Guest

    Predefinito

    Ho stampato tutto..ed è tutto ok!
    Quindi? E' un problema del file interno di sNews? xD
    Grazie e Ciao! ^____^

  4. #4
    Guest

    Predefinito

    Ok, ma qual è la parte che lascia la pagina bianca?
    Hai provato a metterci un die("ciao") in quel punto?


    ciao!

  5. #5
    Guest

    Predefinito

    Allora forse non hai capito com'è lo script..ho scaricato sNews..l'ho installato e qui tutto ok..dopo ho modificato il nome di "index.php" in "template.php" anche perchè contiene il template...dopo ho creato quello script basandomi su una sessione che viene registrata da sNews..tutto qui! io ho messo insieme i pezzi..ecco il contenuto di sNews
    Codice PHP:
    // ARTICLES
    function articles() {
    global
    $categorySEF, $subcatSEF, $articleSEF, $_ID, $_POS, $_catID, $_XNAME;
    $frontpage = s('display_page');
    $title_not_found = '<h2>'.l('none_yet').'</h2>';
    if (
    _ADMIN) {
    $visible='';
    $title_not_found .= '<p>'.l('create_new').'
    <a href="'
    ._SITE.'administration/" title="'.l('administration').'">'.l('administration').'</a></p>';
    } else {
    $visible =' AND a.visible=\'YES\' ';
    }
    if (
    $_ID || (!$_catID && $frontpage != 0)) {
    if (!
    $_ID) $_ID = $frontpage;
    // article or page, id as indentifier
    $query_articles = 'SELECT
    a.id AS aid,title,a.seftitle AS asef,text,a.date,
    a.displaytitle,a.displayinfo,a.commentable,a.visible
    FROM '
    ._PRE.'articles'.' AS a
    WHERE id ='
    .$_ID.$visible;
    } else {
    if (
    s('display_pagination') == 'on') $on = true; else $on = false;
    if (
    $on == true) {
    if (
    $articleSEF) {
    $SEF = $articleSEF;
    } elseif (
    $subcatSEF) {
    $SEF = $subcatSEF;
    } else {
    $SEF = $categorySEF;
    }
    // pagination
    $currentPage = strpos($SEF, l('paginator')) === 0 ? str_replace(l('paginator'), '', $SEF) : '';
    if (
    $_catID) {
    $count = 'SELECT COUNT(a.id) AS num
    FROM '
    ._PRE.'articles'.' AS a
    WHERE position = 1
    AND a.published =1
    AND category = '
    .$_catID.$visible.'
    GROUP BY category'
    ;
    } else {
    $count = 'SELECT COUNT(a.id) AS num
    FROM '
    ._PRE.'articles'.' AS a
    LEFT OUTER JOIN '
    ._PRE.'categories'.' as c
    ON category = c.id
    LEFT OUTER JOIN '
    ._PRE.'categories'.' as x
    ON c.subcat = x.id AND (x.published =\'YES\')
    WHERE show_on_home = \'YES\' '
    .$visible.'
    AND position = 1
    AND a.published =1
    AND c.published =\'YES\'
    GROUP BY show_on_home'
    ;
    }
    $count = mysql_query($count);
    if (
    $count) {
    $r = mysql_fetch_array($count);
    $num = $r['num'];
    }
    }
    if (
    $num === 0 ) {
    echo
    $title_not_found;
    } else {
    $articleCount = s('article_limit');
    $article_limit = (empty($articleCount) || $articleCount < 1) ? 100 : $articleCount;
    $totalPages = ceil($num/$article_limit);
    if (!isset(
    $currentPage) || !is_numeric($currentPage) || $currentPage < 1) {
    $currentPage = 1;
    }
    // get the rows for category
    if ($_catID) {
    $query_articles = 'SELECT
    a.id AS aid,title,a.seftitle AS asef,text,a.date,
    a.displaytitle,a.displayinfo,a.commentable,a.visible
    FROM '
    ._PRE.'articles'.' AS a
    WHERE position = 1
    AND a.published =1
    AND category = '
    .$_catID.$visible.'
    ORDER BY artorder ASC,date DESC
    LIMIT '
    .($currentPage - 1) * $article_limit.','.$article_limit;
    } else {
    $query_articles = 'SELECT
    a.id AS aid,title,a.seftitle AS asef,text,a.date,
    displaytitle,displayinfo,commentable,a.visible,
    c.name AS name,c.seftitle AS csef,
    x.name AS xname,x.seftitle AS xsef
    FROM '
    ._PRE.'articles'.' AS a
    LEFT OUTER JOIN '
    ._PRE.'categories'.' as c
    ON category = c.id
    LEFT OUTER JOIN '
    ._PRE.'categories'.' as x
    ON c.subcat = x.id AND x.published =\'YES\'
    WHERE show_on_home = \'YES\'
    AND position = 1
    AND a.published =1
    AND c.published =\'YES\''
    .$visible.'
    ORDER BY date DESC
    LIMIT '
    .($currentPage - 1) * $article_limit.','.$article_limit;
    }
    }
    }
    $result = mysql_query($query_articles);
    $numrows = mysql_num_rows($result);
    if (!
    $result || !$numrows) {
    if (
    _ADMIN) {
    echo
    $title_not_found;
    }
    echo
    '<ul class="vertical">';
    menu_articles(0,10,1);
    echo
    '</ul>';
    } else {
    $link = '<a href="'._SITE;
    while (
    $r = mysql_fetch_array($result)) {
    $infoline = $r['displayinfo'] == 'YES' ? true : false;
    $text = stripslashes($r['text']);
    if (!empty(
    $currentPage)) {
    $short_display = strpos($text, '[break]');
    $shorten = $short_display == 0 ? 9999000 : $short_display;
    } else {
    $shorten = 9999000;
    }
    $comments_query = 'SELECT id FROM '._PRE.'comments'.'
    WHERE articleid = '
    .$r['aid'].' AND approved = \'True\'';
    $comments_result = mysql_query($comments_query);
    $comments_num = mysql_num_rows($comments_result);
    $a_date_format = date(s('date_format'), strtotime($r['date']));
    if (
    $r['csef']) $uri = $r['xsef'] ? $r['xsef'].'/'.$r['csef'] : $r['csef'];
    elseif (
    $_XNAME) $uri = $categorySEF.'/'.$subcatSEF;
    else
    $uri = $categorySEF;
    $title = $r['title'];
    if (
    $r['displaytitle'] == 'YES') {
    if (!
    $_ID) {
    echo
    '<h2 class="big">'.$link.$uri.'/'.$r['asef'].'/">'.$title.'</a></h2>';
    } else {
    echo
    '<h2>'.$title.'</h2>';
    }
    }
    file_include(str_replace('[break]', '',$text), $shorten);
    $commentable = $r['commentable'];
    $visiblity = $r['visible'] == 'YES' ?
    '<a href="'._SITE.'?action=process&amp;task=hide&amp;item=snews_articles&amp;id='.$r['aid'].'&amp;back='.$uri.'">'.l('hide').'</a>' :
    l('hidden').' ( <a href="'._SITE.'?action=process&amp;task=show&amp;item=snews_articles&amp;id='.$r['aid'].'&amp;back='.$uri.'">'.l('show').'</a> )' ;
    $edit_link = $link.'?action=admin_article&amp;id='.$r['aid'].'" title="'.$title.'">'.l('edit').'</a> ';
    $edit_link.= ' '.l('divider').' '.$visiblity;
    if (!empty(
    $currentPage)) {
    if (
    $infoline == true) {
    $tag = explode(',', tags('infoline'));
    foreach (
    $tag as $tag) {
    switch (
    true) {
    case (
    $tag == 'date'):
    echo
    $a_date_format;
    break;
    case (
    $tag == 'readmore' && strlen($r['text']) > $shorten):
    echo
    $link.$uri.'/'.$r['asef'].'/">'.l('read_more').'</a> ';
    break;
    case (
    $tag == 'comments' && ($commentable == 'YES' || $commentable == 'FREEZ')):
    echo
    $link.$uri.'/'.$r['asef'].'/#'.l('comment').'1">
    '
    .l('comments').' ('.$comments_num.')</a> ';
    break;
    case (
    $tag == 'edit' && _ADMIN):
    echo
    ' '.$edit_link;
    break;
    case (
    $tag != 'readmore' && $tag != 'comments' && $tag != 'edit'):
    echo
    $tag;
    break;
    }
    }
    } else if (
    _ADMIN) {
    echo
    '<p>'.$edit_link.'</p>';
    }
    } else if (empty(
    $currentPage)) {
    if (
    $infoline == true) {
    $tag = explode(',', tags('infoline'));
    foreach (
    $tag as $tag ) {
    switch (
    $tag) {
    case
    'date':
    echo
    $a_date_format;
    break;
    case
    'readmore':
    case
    'comments': ;
    break;
    case
    'edit':
    if (
    _ADMIN) {
    echo
    ' '.$edit_link;
    }
    break;
    default:
    echo
    $tag;
    }
    }
    } else if (
    _ADMIN) {
    echo
    '<p>'.$edit_link.'</p>';
    }
    }
    }
    if (!empty(
    $currentPage) && ($num> $article_limit) && $on) {
    paginator( $currentPage, $totalPages, l('paginator'));
    }
    if (!empty(
    $_POS) && empty($currentPage) && $infoline == true) {
    if (
    $commentable == 'YES') {
    comment('unfreezed');
    } else if (
    $commentable == 'FREEZ') {
    comment('freezed');
    }
    }
    }
    }
    Questa di sopra è la parte che viene mostrata in Home..ed è quella che mi spunta bianca! :(
    Dopo c'è l'htaccess...
    Codice PHP:
    # <IfModule mod_php4.c>
    # php_value session.use_trans_sid 0
    # </IfModule>
    # <IfModule mod_security.c>
    # SecFilterEngine Off
    # SecFilterScanPOST Off
    # </IfModule>

    RewriteEngine On
    RewriteBase
    /v2
    RewriteCond
    %{REQUEST_FILENAME} -f
    RewriteRule
    ^(.*) $1 [L]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule
    ^(.*)$ template.php?category=$1 [L]
    DirectoryIndex index.php
    Ciaooo! ^_______^

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •