phpBB2.de Foren-Übersicht  
[netclusive - internet broadcasting]
 FAQ  •  Suchen  •  Download  •  Lesezeichen  •  Mitgliederliste  •  Benutzergruppen   •  Registrieren  •  Profil  •  Einloggen, um private Nachrichten zu lesen  •  Login
 
        
 
        
 

LinkLift

Nächstes Thema anzeigen
Vorheriges Thema anzeigen

Dieses Forum ist gesperrt, du kannst keine Beiträge editieren, schreiben oder beantworten.Dieses Thema ist gesperrt, du kannst keine Beiträge editieren oder beantworten.
Autor Nachricht
kambodianboi
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 24.06.2003
Beiträge: 695
Wohnort: Long Beach, CA [USA]

BeitragVerfasst am: Do 23 Jun, 2005 20:35 Antworten mit ZitatNach oben 

Hey,

This mod I made was simple and very usefull to many that I know.

It allow you to integrate phpBB login system with your website that supports PHP.

It also can display user info when they are logged in, such as private messages, or other info. But it not in phpBB, its either on a outside website or a sub directory to phpBB.

I attached the file with a sample file to test it out with.

You have to edit the phpbb_login.php

where its shows

Code:
Code:

$phpbb_root_path = 'forum/';  // Must be defined to your board location 


Make sure it point to your board direcory

If you need more help contact me.

*Update
I have updated the codes, so it should handle better now with your forum, incase a wrong password or username is used.

Also I have added an extra feature, which will let you display forum "Online Statistic" externally. That feature was requested, so I decided to add it aswell, now its one of the external features. I would be glad to take a few more request before I move along with another project.

-Kam


phpbb_external_login_stats.zip
 Beschreibung:
Released 06-12-06

Download
 Dateiname:  phpbb_external_login_stats.zip
 Dateigröße:  2.19 KB
 Heruntergeladen:  2844 mal

_________________
- kambodianboi


Zuletzt bearbeitet von kambodianboi am Mo 12 Jun, 2006 19:27, insgesamt 2-mal bearbeitet
OfflineBenutzer-Profile anzeigenPrivate Nachricht sendenE-Mail sendenWebsite dieses Benutzers besuchen
Google







Verfasst am: Nach oben

alsakrah
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 02.12.2003
Beiträge: 125
Wohnort: JUBAIL

BeitragVerfasst am: Mi 28 Sep, 2005 11:34 Antworten mit ZitatNach oben 

Very nice mod

thank you

_________________
phpBB2 Plus Arabic Language Support Forum
OfflineBenutzer-Profile anzeigenPrivate Nachricht sendenWebsite dieses Benutzers besuchenYahoo MessengerMSN Messenger
marcus1060
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 21.03.2006
Beiträge: 4

BeitragVerfasst am: Di 21 März, 2006 01:00 Antworten mit ZitatNach oben 

When my $phpbb_root_path is set to a http:// address.
For example http://foobar.com/forums
I get his error
Code:
Hacking attempt
Fatal error: Call to undefined function session_pagestart() in /home2/noveisne/public_html/bill/site/login.php on line 9

Any help?
OfflineBenutzer-Profile anzeigenPrivate Nachricht senden
kambodianboi
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 24.06.2003
Beiträge: 695
Wohnort: Long Beach, CA [USA]

BeitragVerfasst am: Di 21 März, 2006 09:22 Antworten mit ZitatNach oben 

It must be based on folder directory.

For example
Your main site is "public_html\", and your forum is "public_html\forum\", you would put "./forum/" for $phpbb_root_path. I hope its not confusing.

_________________
- kambodianboi
OfflineBenutzer-Profile anzeigenPrivate Nachricht sendenE-Mail sendenWebsite dieses Benutzers besuchen
marcus1060
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 21.03.2006
Beiträge: 4

BeitragVerfasst am: Di 21 März, 2006 12:07 Antworten mit ZitatNach oben 

Edit: I've got it working.
Thanks for the awesome script!


Zuletzt bearbeitet von marcus1060 am Di 21 März, 2006 13:18, insgesamt 2-mal bearbeitet
OfflineBenutzer-Profile anzeigenPrivate Nachricht senden
marcus1060
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 21.03.2006
Beiträge: 4

BeitragVerfasst am: Di 21 März, 2006 13:16 Antworten mit ZitatNach oben 

I've got a new problem now, when the script redirects you back to the page you set it too.
It has the variable sid with it.
But once you click a different link, that variable isn't in the address bar anymore, and the page acts like the user is logged out(shows the login form) even when they are still logged in.
OfflineBenutzer-Profile anzeigenPrivate Nachricht senden
kambodianboi
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 24.06.2003
Beiträge: 695
Wohnort: Long Beach, CA [USA]

BeitragVerfasst am: Di 21 März, 2006 23:26 Antworten mit ZitatNach oben 

When you create the login form, did you use the varibles $user_logged_in?

For example this is how your form can look like.

Code:

<?
if($user_logged_in) // User is logged in
{
echo $user['username']; //prints the username
}

if(!$user_logged_in) // User is not logged in
{
?>
Your form here
<?
}
?>

_________________
- kambodianboi
OfflineBenutzer-Profile anzeigenPrivate Nachricht sendenE-Mail sendenWebsite dieses Benutzers besuchen
marcus1060
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 21.03.2006
Beiträge: 4

BeitragVerfasst am: Mi 22 März, 2006 00:37 Antworten mit ZitatNach oben 

It works on my personal computer (that's setup with apache etc)
But on my web host it does not, so what are you using in the script that a webhost would turn off for security reasons?
OfflineBenutzer-Profile anzeigenPrivate Nachricht senden
kambodianboi
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 24.06.2003
Beiträge: 695
Wohnort: Long Beach, CA [USA]

BeitragVerfasst am: Mi 22 März, 2006 02:02 Antworten mit ZitatNach oben 

The scripts runs based on your phpBB forum cookies. In the phpBB ACP, make sure the cookie domain is set like this.

Code:

Cookie domain: .<yourdomain.com>
Cookie name: phpbb2mysql
Cookie path: /
Cookie secure: Disabled
Session length [ seconds ]: 3600


For cookie domain there must be a dot in front, so it will allow, subdomains and folders as well.

_________________
- kambodianboi
OfflineBenutzer-Profile anzeigenPrivate Nachricht sendenE-Mail sendenWebsite dieses Benutzers besuchen
stebbi67
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 08.06.2006
Beiträge: 1
Wohnort: Stockholm, Sweden

BeitragVerfasst am: Do 15 Jun, 2006 13:22 Antworten mit ZitatNach oben 

When you look at the phpbb.php file that you get with this mod you will se

Zitat:

Useage: You must create an PHP document to use this script.
Linking it by using include("phpbb.php"); .

Usable Varibles:
$online_userlist - Displays logged in users
$l_online_users - Display online stats


If you do not know how, feel free to use this one, just save it as a php file:

Code:
<?php
include("phpbb.php");
?>

<html dir="ltr">
<head>
</head>
<body bgcolor="#000000">

<?php
if(!$userdata['session_logged_in'])
{
        ?>
<!---  <table width="100%" cellspacing="0" cellpadding="10" border="0" align="center">
        <tr>
                <td class="bodyline"><table width="100%" cellspacing="0" cellpadding="0" border="0">
                        <tr>
                               <td><a href="index.php"><img src="templates/subSilver/images/logo_phpBB.gif" border="0" alt="yourdomain.com Forum Index" vspace="1" /></a></td>
                                <td align="center" width="100%" valign="middle"><span class="maintitle">yourdomain.com</span><br /><span class="gen">A _little_ text to describe your forum<br />&nbsp; </span> 
                                <table cellspacing="0" cellpadding="2" border="0">
                                        <tr>
                                                <td align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&nbsp;<a href="faq.php" class="mainmenu"><img src="templates/subSilver/images/icon_mini_faq.gif" width="12" height="13" border="0" alt="FAQ" hspace="3" />FAQ</a></span><span class="mainmenu">&nbsp; &nbsp;<a href="search.php" class="mainmenu"><img src="templates/subSilver/images/icon_mini_search.gif" width="12" height="13" border="0" alt="Search" hspace="3" />Search</a>&nbsp; &nbsp;<a href="memberlist.php" class="mainmenu"><img src="templates/subSilver/images/icon_mini_members.gif" width="12" height="13" border="0" alt="Memberlist" hspace="3" />Memberlist</a>&nbsp; &nbsp;<a href="groupcp.php" class="mainmenu"><img src="templates/subSilver/images/icon_mini_groups.gif" width="12" height="13" border="0" alt="Usergroups" hspace="3" />Usergroups</a>&nbsp;
                                                &nbsp;<a href="profile.php?mode=register" class="mainmenu"><img src="templates/subSilver/images/icon_mini_register.gif" width="12" height="13" border="0" alt="Register" hspace="3" />Register</a></span>&nbsp;
                                                </td>
                                        </tr>
                                        <tr>
                                                <td height="25" align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&nbsp;<a href="profile.php?mode=editprofile" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="Profile" hspace="3" />Profile</a>&nbsp; &nbsp;<a href="privmsg.php?folder=inbox" class="mainmenu"><img src="templates/subSilver/images/icon_mini_message.gif" width="12" height="13" border="0" alt="Log in to check your private messages" hspace="3" />Log in to check your private messages</a>&nbsp; &nbsp;<a href="login.php" class="mainmenu"><img src="templates/subSilver/images/icon_mini_login.gif" width="12" height="13" border="0" alt="Log in" hspace="3" />Log in</a>&nbsp;</span></td>
                                        </tr>
                                </table></td>
                        </tr>
                </table> --->


<form action="phpbb.php" method="post">

<!--- <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
  <tr>
        <td align="left" class="nav"><a href="index.php" class="nav">yourdomain.com Forum Index</a></td>
  </tr>
</table> --->

<table width="150" BORDERCOLOR="Black" border="1" align="center">
<!---  <tr>
        <th height="25"><font face="arial" size="2" color="#C00000">Log in </font></th>
  </tr>  --->
  <tr>
        <td><table border="0" cellpadding="3" cellspacing="1" width="100%">
                  <tr>
                        <td width="45%" align="center"><span class="gen"><font face="arial" size="2" color="#C00000">Username:</font></span></td>
                        </tr>
                        <tr>
                        <td align="center">
                          <input type="text" name="username" size="10" maxlength="40" value="" />
                        </td>
                  </tr>
                  <tr>
                        <td align="center"><span class="gen"><font face="arial" size="2" color="#C00000">Password:</font></span></td>
                        </tr>
                        <tr>
                        <td align="center">
                          <input type="password" name="password" size="10" maxlength="32" />
                        </td>
                  </tr>
              <tr align="center">
                        <td colspan="2"><span class="gen"><font face="arial" size="2" color="#C00000">Automatic login</font> <input type="checkbox" name="autologin" /></span></td>
                  </tr>
                  <tr align="center">
                        <td colspan="2"><input type="hidden" name="redirect" value="" /><input type="submit" name="login" class="mainoption" value="Log in" /></td>
                  </tr>
                  <tr align="center">
                        <td colspan="2"><span class="gensmall"><a href="profile.php?mode=sendpassword" class="gensmall"> <font face="arial" size="2">I forgot my password</font></a></span></td>
                  </tr>
                </table>
  <!--- </td>
  </tr>
</table>  --->

</form>
<?php
}
?>

<!--- <table width="150" BORDERCOLOR="Black" border="1" align="center"> -->
<tr>
<td>
<center>

<?php
if($userdata['session_logged_in'])
{
        print'Welcome';
        echo "<br />";
        $avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="http://' . $board_config['server_name'] . $board_config['script_path'] . $board_config['avatar_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
   print($avatar_img);

        echo "<br />";
        print('<a href="phpbb.php?logout">'.$userdata['username'].'</a>');

}
?>
</center>
<br>
<hr>
<?php
{
   echo "<br />";
        print $online_userlist;
}
?>
<br>
<hr>
<?php
{
   echo "<br />";
        print $l_online_users;
}
?>
</td>
</tr>
</table>

</font>



<!-- <div align="center"><span class="copyright"><br /><br />

        We request you retain the full copyright notice below including the link to www.phpbb.com.
        This not only gives respect to the large amount of time given freely by the developers
        but also helps build interest, traffic and use of phpBB 2.0. If you cannot (for good
        reason) retain the full copyright we request you at least leave in place the
        Powered by phpBB 2.0.8 line, with phpBB linked to www.phpbb.com. If you refuse
        to include even this then support on our forums may be affected.

        The phpBB Group : 2002

Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> 2.0.8 &copy; 2001, 2002 phpBB Group<br /></span></div>  // -->
                </td>
        </tr>
</table>

</body>
</html>
OfflineBenutzer-Profile anzeigenPrivate Nachricht senden
Ockham
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 25.09.2006
Beiträge: 3

BeitragVerfasst am: Mo 25 Sep, 2006 13:34 Antworten mit ZitatNach oben 

I am pretty sure that this is the solution I'm looking for. I've tested it out using the two pages you provided (original download and login code provided in subsequent post).

Here is what I would like to do with it:

Include a snippet of php code on several pages which I want reserved for "members only" section of my site.

When someone attempts to view any members only pages their login status is checked by the code snippet.

If they are logged in, they are allowed to view the page.

If they are not logged in, they are redirected to the login page.

Upon successful login, they are redirected back to the original page they were trying to view.


This solution seems to do 80% of what I need it to as-is. I've tested out a half-dozen other solutions in the last couple of weeks and this one is by far superior, and easier to implement than any of the others.

Is this possible to do what I want, and if so, what would be the code I need to include on a secured webpage? How would I modify the login page to redirect back to entry page?

Thanks.
OfflineBenutzer-Profile anzeigenPrivate Nachricht senden
kambodianboi
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 24.06.2003
Beiträge: 695
Wohnort: Long Beach, CA [USA]

BeitragVerfasst am: Di 26 Sep, 2006 01:21 Antworten mit ZitatNach oben 

Since the session varible is global you can use the same method from phpBB.

Code:

if(!$userdata['session_logged_in'])
{
redirect($phpbb_root_path."login.php?redirect=../".$HTTP_SERVER_VARS['PHP_SELF']);
}


Put that along with
Code:

include("phpbb.php");


to any external page you want, only for members. If they are not logged in, they will be redirected to the login page and after logging in, redirected back to the page.

Let me know if thats the way you want it.

_________________
- kambodianboi
OfflineBenutzer-Profile anzeigenPrivate Nachricht sendenE-Mail sendenWebsite dieses Benutzers besuchen
Ockham
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 25.09.2006
Beiträge: 3

BeitragVerfasst am: Di 26 Sep, 2006 04:13 Antworten mit ZitatNach oben 

Thanks for your help. What you've described looks to be exactly what I want. It seems to be working, sort of. When I'm logged in, I can view the page fine with no issues. But when I've logged out, I get the following errors/warnings:

Zitat:
Warning: Cannot modify header information - headers already sent by (output started at /home/content/m/a/c/macosx86/html/login/testpage.php:2) in /home/content/m/a/c/macosx86/html/phpBB2/includes/sessions.php on line 366

Warning: Cannot modify header information - headers already sent by (output started at /home/content/m/a/c/macosx86/html/login/testpage.php:2) in /home/content/m/a/c/macosx86/html/phpBB2/includes/sessions.php on line 367

Warning: Cannot modify header information - headers already sent by (output started at /home/content/m/a/c/macosx86/html/login/testpage.php:2) in /home/content/m/a/c/macosx86/html/phpBB2/includes/functions.php on line 941


Now, I'm thinking that I missed an easy step somewhere but I can't seem to find it.

I'm using three files to test this:

phpbb.php <- with $phpbb_root_path set to "../phpBB2"
login.php <- using the example code specified above by stebbi67
testpage.php <- using the code snippet first thing in the page as you specified.

The code snippet on testpage.php is:

Code:
<?php
include("phpbb.php");
if(!$userdata['session_logged_in'])
{
redirect($phpbb_root_path."login.php?redirect=../".$HTTP_SERVER_VARS['PHP_SELF']);
}                   
?>


My folder structure is as follows:

/public_html/
../login
...../phpbb.php
...../login.php
...../testpage.php
../phpBB2/

When accessed directly, the login.php page works great; it actuates a login to the forum as expected. However the testpage.php is the one producing the aforementioned warnings when I am not logged in. As I'm looking at testpage.php code, I don't see that there is a hook to redirect to login.php, which is what I would like. How would I add that?

Any ideas on the errors?

Thanks.
OfflineBenutzer-Profile anzeigenPrivate Nachricht senden
kambodianboi
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 24.06.2003
Beiträge: 695
Wohnort: Long Beach, CA [USA]

BeitragVerfasst am: Di 26 Sep, 2006 06:22 Antworten mit ZitatNach oben 

The error show because you have the code snipplet somewhere in the middle of the script.

It should be the first line of the script, for example.
Code:

<?php
include("phpbb.php");
if(!$userdata['session_logged_in'])
{
redirect($phpbb_root_path."login.php?redirect=../".$HTTP_SERVER_VARS['PHP_SELF']);
}                   
?>

<!-- YOUR PAGE CONTENT -->



There cant be any spaces before <?php

_________________
- kambodianboi
OfflineBenutzer-Profile anzeigenPrivate Nachricht sendenE-Mail sendenWebsite dieses Benutzers besuchen
Ockham
phpBB2.de User
phpBB2.de User



Anmeldungsdatum: 25.09.2006
Beiträge: 3

BeitragVerfasst am: Di 26 Sep, 2006 19:34 Antworten mit ZitatNach oben 

Thank you!

I had a comment field above the code. I've removed it and things work perfectly now.
OfflineBenutzer-Profile anzeigenPrivate Nachricht senden
Beiträge der letzten Zeit anzeigen:      
Dieses Forum ist gesperrt, du kannst keine Beiträge editieren, schreiben oder beantworten.Dieses Thema ist gesperrt, du kannst keine Beiträge editieren oder beantworten.

Nächstes Thema anzeigen
Vorheriges Thema anzeigen
Du kannst keine Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum nicht antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.
Du kannst Dateien in diesem Forum posten
Du kannst Dateien in diesem Forum herunterladen

Ähnliche Beiträge
Thema Autor Forum Antworten Verfasst am
nach login geht forum _parent auf obbi phpBB2.x - Support 0 Do 23 Jul, 2009 11:13 Letzten Beitrag anzeigen
how do i edit the login box in portal... nibraz Support Forum 1 Mo 13 Jul, 2009 22:24 Letzten Beitrag anzeigen
Login Target excituz Coding 0 Mo 18 Mai, 2009 12:16 Letzten Beitrag anzeigen
Seltsames Login Problem dr.feelgood Support allgemein 1 So 29 März, 2009 16:53 Letzten Beitrag anzeigen
wbb auf phpbb2.023 auf phpBB-3.0.4 mö... Torsten68 phpBB2.x - Diskussion 1 Mi 25 März, 2009 21:51 Letzten Beitrag anzeigen