Please upgrade here. These earlier versions are no longer being updated and have security issues.

External Authentication - how do I solve bonk - blank page error*

kogan007kogan007 New New
edited September 2013 in Vanilla 2.0 - 2.8

Hey, on my site I'm using this code

define('APPLICATION', 'Vanilla');
define('APPLICATION_VERSION', '2.0.16');
define('DS', '/');
define('PATH_ROOT', 'forum');
ob_start();
require_once(PATH_ROOT.DS.'bootstrap.php');
ob_end_clean(); // clear any header output from vanila
$Session = Gdn::Session();
$Authenticator = Gdn::Authenticator();
if ($Session->IsValid()) {
   $Name = $Session->User->Name;
   echo "You are logged in as $Name";
}else{
  echo "You are not logged in";
}

When I put it my page goes blank and the title says bonk. Can someone help?

Comments

  • peregrineperegrine MVP MVP
    edited September 2013

    I can help you with bonk.

    http://vanillaforums.org/docs/errors

    I can also suggest when posting code - mark it (select it and press the C on the buttonbar).
    this will format it - so it is readable.

    conversely you could try three tildes above and below your code.

    ~~~
    
    your code
    
    ~~~
    

    your code

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • @peregrine said:
    I can help you with bonk.

    http://vanillaforums.org/docs/errors

    I can also suggest when posting code - mark it (select it and press the C on the buttonbar).
    this will format it - so it is readable.

    conversely you could try three tildes above and below your code.

    ~~~
    
    your code
    
    ~~~
    

    your code

    Hey, when I do the authentication thing, the page goes blank and the title is bonk

  • kogan007kogan007 New New
    edited September 2013

    <?php define('APPLICATION', 'Vanilla'); define('APPLICATION_VERSION', '2.0.16'); define('DS', '/'); define('PATH_ROOT', 'forum'); ob_start(); require_once(PATH_ROOT.DS.'bootstrap.php'); ob_end_clean(); // clear any header output from vanila $Session = Gdn::Session(); $Authenticator = Gdn::Authenticator(); if ($Session->IsValid()) { $Name = $Session->User->Name; echo "You are logged in as $Name"; }else{ echo "You are not logged in"; } ?>
  • peregrineperegrine MVP MVP
    edited September 2013

    I just have tangential suggestions -

    @kogan007 said:
    Hey, when I do the authentication thing, the page goes blank and the title is bonk

    great its more readable, I don't have an answer.

    I also suggested how to get more information instead of bonk when you get an error.

    you could put some var_dumps in to test as soon as you figure out what the actual bonk error.

    You also might consider upgrading to 2.0.18.8 unless you already added the security patches some other way.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Im using 2.0.18.8 and no information is there except blank page. The code I used worked before possibly another version but now no luck.

  • ShadowdareShadowdare Moderator Moderator
    edited September 2013

    You should call the dispatcher and its methods. You can look at the bottom of index.php for an example.

    Add Pages to Vanilla with the Basic Pages app

  • peregrineperegrine MVP MVP
    edited September 2013

    I tested your code in vanilla 2.0.18.8 on my local host -

    It worked fine. At least this code and displayed whether I was logged in or not.

    I have my forum var/www/vanilla

    I put your program in /var/www

    <?php
    define('APPLICATION', 'Vanilla');
    define('APPLICATION_VERSION', '2.0.16');
    define('DS', '/');
    define('PATH_ROOT', 'vanilla');
    ob_start();
    require_once(PATH_ROOT.DS.'bootstrap.php');
    ob_end_clean(); // clear any header output from vanila
    $Session = Gdn::Session();
    $Authenticator = Gdn::Authenticator();
    if ($Session->IsValid()) {
    $Name = $Session->User->Name;
    echo "You are logged in as $Name";
    }else{
    echo "You are not logged in";
    }
    

    However, I am unclear why you don't put the debugging info in your config.php as the link to bonk errors suggested.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    UnderDog
  • UnderDogUnderDog Moderator Moderator

    @kogan007 said:
    the page goes blank and the title is bonk

    I'M sorry, but without the debugging information that peregrine requested, I have to close this topic. Follow his advices, read the documentation and prepare to upgrade to 2.0.18 when everything is working again.

    peregrine
  • peregrineperegrine MVP MVP
    edited September 2013

    @underdog

    can you change title back to original

    • or put something like this

    "External Authentication - how do I solve bonk - blank page error"

    to find the discussion easier.


    • he said he has 2.0.18.8
    • just confusing because the code said define('APPLICATION_VERSION', '2.0.16');

    but that shouldn't matter anyway in the define statement.

    but the php error checking could be turned off.

    you could try also for vanilla 2.0.18.x
    
    in conf/config.php
    
    $Configuration['Garden']['Debug'] = TRUE;
    
    invanilla  2.1 and above
    in conf/config.php
    use
    $Configuration['Debug'] = TRUE;
    

    as well as

    or if that doesn't work you can

    ini_setting the error checking.

    http://php.net/manual/en/function.error-reporting.php


    and bonk errors

    add this:

    $Configuration['Garden']['Errors']['MasterView'] = 'deverror.master.php';

    http://vanillaforums.org/docs/errors

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    UnderDog
  • x00x00 MVP MVP
    edited September 2013

    If it is saying bonk then it is reaching the forum. If you wish to read the debug You have to disable buffer clearing like so:

    //ob_start();
    require_once(PATH_ROOT.DS.'bootstrap.php');
    //ob_end_clean(); // clear any header output from vanilla
    

    then turn on debug like peregrine says.

    grep is your friend.

    UnderDog
  • I think something may be disabled on my host because nothing thats been suggested has worked. Any ideas?

  • UnderDogUnderDog Moderator Moderator

    It doesn't work that way ... after you have read the docs, you know that you have to add a line in your conf/config.php and that will give you a detailed error page

    Also show your new index.php after you have made all the suggested changes

Sign In or Register to comment.