SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot Oznob's Avatar
    Join Date
    Jun 2002
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    phpbb integration

    I have a phpbb forums running on my site (http://www.phpbb.com) and I now have a php employment software package running.

    I want to make it so that my members can login to my phpbb forums and be automatically logged into the employment site too. (i.e. some way to maybe pass the login informatoin from one application to the other seamlessly).

    I realize that maybe I will have to manually set the passwords and usernames for each of my members in the employment section manually (i.e. making them the same username and password as the forums).

    But then again - I am a php newbie so I will bow to the knowledge of you fine people to help point me in the right direction here -- any help (the more detailed the better) is appreciated.

    Regards,
    Oznob

  2. #2
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    You could just make calls to the phpBB database and check the username and password from there.

  3. #3
    SitePoint Zealot Oznob's Avatar
    Join Date
    Jun 2002
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    more info please...

    you make it sound easy enough - any chance I could see an example of code that I could place in my pages (somewhere) that will do this --- I learn pretty well from example ...

  4. #4
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    It's relativly simple to do this, but to achieve the effect you want you will need to include the phpBB files and create a phpBB session. Here's some code -
    PHP Code:
    define('IN_PHPBB'true); 
    $phpbb_root_path './';  // path to phpBB root, include trailing slash
    include($phpbb_root_path 'extension.inc'); 
    include(
    $phpbb_root_path 'common.'.$phpEx); 

    // 
    // Start session management 
    // 
    $userdata session_pagestart($user_ipPAGE_INDEX); 
    init_userprefs($userdata); 
    Also, to create a login form, you can do this -
    PHP Code:
    <form method='post' action='path/to/login.php'> 
    <input type='hidden' name='redirect' value='<?=$_SERVER['SCRIPT_NAME"]?>' /> 
    Username: <input type='text' name='username' /> 
    Password: <input type='password' name='password' /> 
    <
    input type='submit' name='login' value='Login!' /> 
    </
    form>

  5. #5
    SitePoint Zealot Oznob's Avatar
    Join Date
    Jun 2002
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    more help....

    Here is the code for my employment entrance -- lets assume that I have set the usernames and logins to be the same as they are in phpBB.

    Could someone show me where in this page I could put what code so that when my users that are logged into my phpbb forums hit this page - the username and password are passed along and automatically logs them into this page without them having to type thier passwords again ..

    This help is much appreciated as I attempt something far beyond me

    PHP Code:
    <?php
     
    session_start
    ();  require_once "../config.php";
     include_once 
    "../main.php";  $day date(d); $month date(m); $year date(Y);

    $del "delete from demojobs_post where EXday = \"$day\" and EXmonth = \"$month\" and EXyear = \"$year\" ";
    $rdel mysql_query($del) or die(mysql_error());


    if(!isset(
    $uname) && !isset($upass)) {   ?> <center>   <h1><font face=arial color=#336699>JobSeekers  Login  </h1>   
    <p>Please confirm your login information below.
    <br> If you have not yet submitted a resume, 
    <a href="jobseeker_registration.php" style="text-decoration:none; color:#336699"><b>click here</b></a>      to enable Ventures.</p> 
      
    <p><form method="post" action="<?=$PHP_SELF?>">
    <table> <tr>     <td>Username:</td>     <td align=right> <input type="text" name="uname" size="8" style="border-color:black"></td> </tr>
     <tr>     <td>Password:</td>     <td align=right><input type="password" name="upass" SIZE="8" style="border-color:black"></td> </tr>
     <tr>     <td colspan=2 align=right>     <input type=hidden name=demojobs_id value=<?=$demojobs_id?>
        
    <input type="submit" name=submit value=" Login " style="border-width:2; border-color:black; font-family:verdana; font-weight:bold; color:#336699; background-color:white"></td> </tr>  

    <tr><td colspan=2 align=center> <a class=TN href=forgot.php> Forgot your username/password? </a></td></tr>  </table>   </form>   </center> 

    <? include ('../main_foot.php'); ?>

      <?php   exit; }    session_register("uname"); session_register("upass");   $sql "SELECT * FROM demojobs_seeker_info WHERE         uname = '$uname' AND upass = '$upass'"$result mysql_query($sql); if (!$result) {   echo "<center>A database error occurred while checking your          login details. 
    <br>

    If this error persists, please <br>         contact [email]mail@mail.net[/email] </center>"
    ; } 
     
    elseif (
    mysql_num_rows($result) == 0) {   session_unregister("uname");   session_unregister("upass");   ?>   <font face=verdana>  

     <h1> Access Denied </h1> 

    <p>Your user ID or password is incorrect, or you are not a      registered user on this site.<br>

    <br> To try logging in again, click      <a href="<?=$PHP_SELF?>">here</a>. <br>
    <br>To register for instant      access, click <a href="jobseeker_registration.php">here</a>.</p>   </font></font>   <?php include ('../main_foot.php'); 
      exit; }  
    ?>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •