Sessieon intergration

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Anti-Spam Guide
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
BendeBoy
Registered User
Posts: 7
Joined: Sun Apr 15, 2007 9:09 pm

Sessieon intergration

Post by BendeBoy »

Hello,

Im trying to intergrate the PhpBB login to a page, but I just can't get it to work properly. Im stuck at the redirect after login was succeeded. The script is redirecting me back to the forum index and with the meta refresh I am getting an error.

I also tried to not redirect and to be satisfied with a messege that Im logged in. I have let the action empty in the form but then Im receiving header errors.

Code: Select all

<form method="POST" action="">

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/session.php on line 990: Cannot modify header information - headers already sent by (output started at /home/apje14/public_html/bendeboy/ProjectHT/paginas/request.php:16)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 990: Cannot modify header information - headers already sent by (output started at /home/apje14/public_html/bendeboy/ProjectHT/paginas/request.php:16)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 990: Cannot modify header information - headers already sent by (output started at /home/apje14/public_html/bendeboy/ProjectHT/paginas/request.php:16)
Login Successful! Welcome Administrator
This is the location of the page: /home/apje14/public_html/bendeboy/ProjectHT/paginas/request.php
This is the location of the forum: /home/apje14/public_html/forum/

And here is my script:

Code: Select all

<?php
    define('IN_PHPBB', true);
    $phpbb_root_path = '../../../forum/';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);
     
    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();
?>

<html>
<head>
<title>SHOUT</title>
</head>
<BODY STYLE="background-color: transparent"> 
<?php
 if($user->data['is_registered'])
    {
        //User is already logged in

include("functions.php");
include("../hooizolder/connector.php");

if(isset($_POST["name"]) && isset($_POST["message"]))
{
    $username = clean($_POST["name"]);
    $message = clean($_POST["message"]);
    $dj = clean($_POST["DJ"]);
    $type = clean($_POST["type"]);
    if($username == "" || $message == "")
    {
        echo("Sorry, you have left a field blank, please click <a href=\"request.php\" target=\"_self\">here</a> to go back.");
        unset($_POST["name"]);
        unset($_POST["message"]);
        exit;
    }
    mysql_query("INSERT INTO `requests` (`sender`, `dj`, `message`, `date`, `type`, `ip`) VALUES ('$username', '$dj', '$message', '".gmdate("d/m/Y - h:i:s")."', '$type', '".$_SERVER["REMOTE_ADDR"]."')");
    echo("Thanks for sending in a request, $username.<br />Please feel free to navigate away from this page, or return to the request line by clicking <a onclick=\"dopage('request.php', 'content');\">here</a>");
    exit;
}
else
{
    ?>
    
    <form action="" method="post">
    <table border="0" width="275" cellspacing="0" cellpadding="0" id="table1">
    <tr>
        <td>Naam:</td>
        <td><b><? echo $user->data['username']; ?></b> <input type="hidden" name="name" size="29" value="<? echo $user->data['username']; ?>"><br /></td>
    </tr>
    <tr>
        <td>Type bericht:</td>
      <td><select name="type">
      <option>--------- Selecteer ---------</option>
      <option selected>Verzoek een nummer</option>
      <option>Shout</option>
      <option>Competitie inzending</option>
      <option>Mop inzenden</option>
      <option>Overige...</option>
      </select>
     </td>
    </tr>
        <tr>
        <td valign="top">Bericht:</td>
    <td valign="top"><textarea name="message" rows="4" cols="30"></textarea><br /></td>
    </tr>
    <tr>
    <td></td>
    <td><input type="submit" name="submit" value="Verstuur!"></td>
  </tr>
</table>

    </form>
    <?php
}
            }
            else
 {
 
function display_login_box()
{
   echo '<form method="POST" action="">
       <table border="0" width="275" cellspacing="0" cellpadding="0" id="table1">
        <tr>
          <td>Gebruikersnaam:&nbsp;&nbsp;&nbsp;</td>
          <td><input type="text" name="username" size="40"></td>
        </tr>
        <tr>
          <td>Wachtwoord:</td>
          <td><input type="password" name="password" size="40"></td>
        </tr>
        <tr>
          <td>Onthoud?: <input type="checkbox" name="autologin"></td>
           <td><input type="submit" value="Login" name="login"></td>
        </tr>
      </table>
      <input type="hidden" name="redirect" value="request.php">
        </form>';
}
 
  $username = request_var('username', '', true);
  $password = request_var('password', '', true);
  $autologin = (!empty($_POST['autologin'])) ? true : false;

  $result = $auth->login($username, $password, $autologin);

 if ($result['status'] == LOGIN_SUCCESS)
    {
        echo "Login Successful! Welcome " . $user->data['username'];
     
        //User was successfully logged into phpBB
        // append/replace SID
        $redirect = reapply_sid('request.php');

        meta_refresh(0, $redirect); 
    }
   else
   {
    display_login_box();
   }

 }
?>
</body></html>
Who can help me to fix the header errors or the redirect problem?

Kind regards,

Daniel
some blind fool
Registered User
Posts: 409
Joined: Sat Aug 19, 2006 5:28 pm

Re: Sessieon intergration

Post by some blind fool »

the best i can do is point you towards a rather lengthy site integration thread. i know a few ways to redirect have been covered in there, and you should be able to search the topic. glancing, there's a bit about redirection on the page i'm linking to. http://www.phpbb.com/community/viewtopi ... a&start=60
if nobody helps you here in the next couple of days, try asking there.
please do not PM me to ask for help. thanks.
BendeBoy
Registered User
Posts: 7
Joined: Sun Apr 15, 2007 9:09 pm

Re: Sessieon intergration

Post by BendeBoy »

Yep, I've allready been working through that thread... well, the first 20 pages...
Locked

Return to “[3.0.x] Support Forum”