1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Please help Blank Page Show Error inPligg Website

Discussion in 'PHP' started by Mearning, May 6, 2015.

  1. #1
    Hello all webmasters
    can anybuddy help me
    i have a webiste run with Pligg Application
    http://rocktechsco.com/

    But before 3 days there are nothing show in website only white blank page show

    This is code of Index.php
    <?php
    function str_ends_with($haystack, $needle) {
        return ( substr ($haystack, -strlen ($needle) ) === $needle) || $needle === '';
    }
    
    
    /* If the URL is too verbose (specifying index.php or page 1), then, of course
    * we just want the main page, which defaults to page 1 anyway. */
    $url = parse_url ($_SERVER['REQUEST_URI']);
    if (strpos($_SERVER['REQUEST_URI'],'index.php') !== false || ( isset ($_GET['page']) && $_GET['page'] == 1))
    {
        header("HTTP/1.1 301 Moved Permanently");
        $_SERVER['QUERY_STRING'] = str_replace('page=1','',$_SERVER['QUERY_STRING']);
        header ("Location: ./".($_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING'] : ''));
        exit;
    }
    elseif (str_ends_with($url['path'], '/page/1') || str_ends_with($url['path'], '/page/1/'))
    {
        header("HTTP/1.1 301 Moved Permanently");
        header ("Location: ../".($_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING'] : ''));
        exit;
    }
    
    include_once('internal/Smarty.class.php');
    $main_smarty = new Smarty;
    
    include('config.php');
    
    include(mnminclude.'html1.php');
    
    include(mnminclude.'link.php');
    
    include(mnminclude.'tags.php');
    
    include(mnminclude.'search.php');
    
    include(mnminclude.'smartyvariables.php');
    
    // module system hook
    $vars = '';
    check_actions('index_top', $vars);
    
    // find the name of the current category
    if(isset($_REQUEST['category'])){
       
        $thecat = get_cached_category_data('category_safe_name', sanitize($_REQUEST['category'], 1));
       
        $main_smarty->assign('request_category_name', $thecat->category_name);
        $catID = $thecat->category_id;
        $thecat = $thecat->category_name;
        if (!$thecat)
        {
            header("Location: $my_pligg_base/error_404.php");
            //$main_smarty->assign('tpl_center', 'error_404_center');
            //$main_smarty->display($the_template . '/pligg.tpl');       
            die();
        }
    }
    
    // start a new search
    $search=new Search();
    
    // check for some get/post
    if(isset($_REQUEST['from'])){$search->newerthan = sanitize($_REQUEST['from'], 3);}
    unset($_REQUEST['search']);
    unset($_POST['search']);
    unset($_GET['search']);
    if(isset($_REQUEST['search'])){$search->searchTerm = sanitize($_REQUEST['search'], 3);}
    if(isset($_REQUEST['search'])){$search->filterToStatus = "all";}
    if(!isset($_REQUEST['search'])){$search->orderBy = "link_published_date DESC, link_date DESC";}
    if(isset($_REQUEST['tag'])){$search->searchTerm = sanitize($_REQUEST['search'], 3); $search->isTag = true;}
    if(isset($thecat)){$search->category = $catID;}
    
    // figure out what "page" of the results we're on
    $search->offset = (get_current_page()-1)*$page_size;
    
    // pagesize set in the admin panel
    $search->pagesize = $page_size;
    
    // since this is index, we only want to view "published" stories
    $search->filterToStatus = "published";
    
    // this is for the tabs on the top that filter
    if(isset($_GET['part'])){$search->setmek = $db->escape($_GET['part']);}
    $search->do_setmek();   
    
    // do the search
    $search->doSearch();
    
    $linksum_count = $search->countsql;
    $linksum_sql = $search->sql;
    
    if(isset($_REQUEST['category'])) {
        $category_data = get_cached_category_data('category_safe_name', sanitize($_REQUEST['category'], 1));
        $main_smarty->assign('meta_description', $category_data->category_desc);
        $main_smarty->assign('meta_keywords', $category_data->category_keywords);
    
        // breadcrumbs and page title for the category we're looking at
        $main_smarty->assign('title', ''.$main_smarty->get_config_vars('PLIGG_Visual_Published_News').' - ' . $thecat . '');
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Published_News');
        $navwhere['link1'] = getmyurl('root', '');
        $navwhere['text2'] = $thecat;
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('pretitle', $thecat );
        $main_smarty->assign('posttitle', $main_smarty->get_config_vars('PLIGG_Visual_Published_News'));
        $main_smarty->assign('page_header', $thecat . $main_smarty->get_config_vars('PLIGG_Visual_Published_News'));
        // pagename   
        define('pagename', 'published');
        $main_smarty->assign('pagename', pagename);
    } else {
        // breadcrumbs and page title
        $navwhere['show'] = 'yes';
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Published_News');
        $navwhere['link1'] = getmyurl('root', '');
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', $main_smarty->get_config_vars('PLIGG_Visual_Home_Title'));
        $main_smarty->assign('page_header', $main_smarty->get_config_vars('PLIGG_Visual_Published_News'));
        // pagename   
        define('pagename', 'index');
        $main_smarty->assign('pagename', pagename);
    }
    
    //  make sure my_base_url is set
    if($my_base_url == ''){echo '<div style="text-align:center;"><span class=error>ERROR: my_base_url is not set. Please correct this using the <a href = "/admin/admin_config.php?page=Location%20Installed">admin panel</a>. Then refresh this page.</span></div>';}
    
    // sidebar
    $main_smarty = do_sidebar($main_smarty);
    $sql = "SELECT user_login FROM " . table_users . " ORDER BY user_id DESC LIMIT 1";
    $last_user = $db->get_var($sql);
    $main_smarty->assign('last_user', $last_user);
    
    // misc smarty
    
    if(isset($from_text)){$main_smarty->assign('from_text', $from_text);}
    
    if(isset($search->setmek)){
        $main_smarty->assign('setmeka', $search->setmek);
    }
    else{
        $main_smarty->assign('setmeka', '');
    }
    
    $main_smarty->assign('URL_rss_page', getmyurl('rsspage', $category_data->category_safe_name, ''));
    
    $fetch_link_summary = true;
    include('./libs/link_summary.php'); // this is the code that show the links / stories
    
    //For Infinit scrolling and continue reading option
    if(Auto_scroll==2 || Auto_scroll==3){
       $main_smarty->assign("scrollpageSize", $page_size);
    }else
       $main_smarty->assign('link_pagination', do_pages($rows, $page_size, "published", true));
    
    // show the template
    $main_smarty->assign('tpl_center', $the_template . '/index_center');
    $main_smarty->display($the_template . '/pligg.tpl');
    ?>
    PHP:
    can anybuddy help me
    Thanks in advance
     
    Mearning, May 6, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Holy CRAP, that's some awful code. But I would first and foremost check to see if the ./libs/link_summary.php (which seems to be the only content supposed to show) actually exist and is fetchable - change the include() to include_once() or require_once() - and for deity's sake, turn on PHP-errors while developing so errors and warnings get shown.
    Secondary - throw out Pligg / Smarty / whatever template crap you're using.
     
    PoPSiCLe, May 7, 2015 IP
  3. Mearning

    Mearning Well-Known Member

    Messages:
    213
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    170
    #3
    Hi thanks for reply but i dont understand what you say
    can you pls describe solution step by step
    Thanks
     
    Mearning, May 7, 2015 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    I did.
    First: check to see if the file link_summary.php exists in the folder you're trying to include it from - I only got a 403/404 error when I tried accessing it myself.
    Second: turn on PHP-error display when you develop, so PHP shows you errors and warnings when something is wrong.
    Third: get rid of that hopeless code-bloat that is Pligg / SMARTY.
    Four: Take out the redirect-garbage you have in the code - that might very well be what's causing the errors.
    Five: learn to code before you do try to make something involving (gasp!) code.
     
    PoPSiCLe, May 7, 2015 IP
  5. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #5
    Add the following few lines at the beginning of index.php:

    
    <?php
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(-1);
    
    function str_ends_with($haystack, $needle) {
    ...
    ...
    
    PHP:
    and let us know if you see any errors when loading the page.
     
    ThePHPMaster, May 7, 2015 IP
  6. Mearning

    Mearning Well-Known Member

    Messages:
    213
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    170
    #6
    Thanks for reply but there are no any effect after change in index.php
    Only white blank page are show
    Please help me
    Thanks
     
    Mearning, May 13, 2015 IP
  7. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #7
    Try this: comment out all the header()-lines, and substitute them with echo 'this is supposed to do <what the headerline says>'; - Then you'll probably at least see where the error is originating.
     
    PoPSiCLe, May 13, 2015 IP
  8. Mearning

    Mearning Well-Known Member

    Messages:
    213
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    170
    #8
    Thanks For your valuable solutions
    but problem are shutout and website work great
    actuality this is error log file problem. just empty error log file and website work great .
    Thanks
     
    Mearning, May 13, 2015 IP
  9. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #9
    Uhm, no, it doesn't. If a full error-log is causing you problems, then you have an insane amount of errors - which is in no way a good thing.
     
    PoPSiCLe, May 13, 2015 IP
  10. Mearning

    Mearning Well-Known Member

    Messages:
    213
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    170
    #10
    You are right sir But the problem are shutout and website work fine.
    i seen in Pligg support about error log file and many people have solution with empty error log file.
     
    Mearning, May 13, 2015 IP
  11. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #11
    *headdesk* Okay. Fine. Use that trainwreck of crappy code, and empty your error log at regular intervals. Perfect solution to the problem at hand. *shakes head*
     
    PoPSiCLe, May 14, 2015 IP