Login

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
kkroo
Registered User
Posts: 729
Joined: Sat Dec 03, 2005 4:49 pm
Contact:

Login

Post by kkroo »

I would like to know how to make wy website so that users can log on and the login is from phpBB, and i want to know how to make a page restricted on my website which needs authorization, and phpBB members can authorize themselves by loging in.

in other words i want it so that i can put {L_LOGIN_LOGOUT} on my page and that turns to either Login or Log out [user] and so on...


If it is too hard to explain, just send me a ZIP file and make index.php the page where i can put in my data and put like a restricted.php page which requires autorization by a phpBB member to be viewed , and just put a readme of what i need to edit.


Thanks Sooooo much!
Last edited by kkroo on Sat Dec 03, 2005 4:59 pm, edited 1 time in total.
User avatar
MHobbit
Former Team Member
Posts: 4761
Joined: Thu Mar 18, 2004 5:32 pm
Location: There and Back Again

Post by MHobbit »

This really isn't a MOD request if you're asking for code outside of phpBB... so, I'm moving this to MOD Writers Discussion.

Take a note of this KB article.
Former phpBB MOD Team member
No private support is offered.
"There’s too many things to get done, and I’m running out of days..."
kkroo
Registered User
Posts: 729
Joined: Sat Dec 03, 2005 4:49 pm
Contact:

Post by kkroo »

i did all that here on my test page http://kkroo.xena-free.com/forum.php, and i entered {L_LOGIN_LOGOUT}, it didn't replace in with Log in or Log out [user] why is this? and i do not understand how to do check for autorization. that part that says [insert your HTML/PHP or whatever here], i do not know what to put there!
kkroo
Registered User
Posts: 729
Joined: Sat Dec 03, 2005 4:49 pm
Contact:

Post by kkroo »

i got sessions to work!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
http://kkroo.xena-free.com/forum.php that is my test page


but i am having trouble getting the template to work, {L_LOGIN_LOGOUT} is not switching to Log in or whatever. so i guess i have little work to do.


Please Reply!

Thanks a lot!
Dman8568
Registered User
Posts: 32
Joined: Sun Feb 20, 2005 4:00 am
Location: WV, USA
Contact:

Post by Dman8568 »

Depending on your experience w/ PHP and Databases;

You could write a small program to run at the top os all "protected" page that scans the PHPBB Database for the user's IP address. If the database shows that IP as loged in, then show the page



Dman8568
kkroo
Registered User
Posts: 729
Joined: Sat Dec 03, 2005 4:49 pm
Contact:

Post by kkroo »

how would i do that, i am a noob.

and what about {L_LOGIN_LOGOUT}?
Dman8568
Registered User
Posts: 32
Joined: Sun Feb 20, 2005 4:00 am
Location: WV, USA
Contact:

Post by Dman8568 »

If you don't know PHP, then this will probably sound like gibberish to you, but this if what the program would look like.

This is an example program, not a full scale one. This is not entended to be run, and I'm sure there are a small error, or two.

You must change anything in "[ ]" to the propper item according to what's in the brackets.

If you want PHP's web site is: http://www.php.net

Code: Select all

<?php

// Program Functions
 
 // Encrypt IP (Found in /includes/functions.php)
 function encode_ip($dotquad_ip)
 {
	$ip_sep = explode('.', $dotquad_ip);
	return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
 }
 
// 

##############################################################################
// Main Program

// Connect to Database  (This is using MySQL)
mysql_connect([host],[username],[password]);  // Set the "[ ]" stuff to the appropriate items
mysql_select_db([database name]);             // [database name] = The name of the database that PHPBB uses

// Encrypt User's IP
$ip=encode_ip($_SERVER['REMOTE_ADDR']);

// Scan fo user's IP Address
$access=mysql_query("SELECT loged_in FROM phpbb_sessions WHERE id='$ip'");

// Test to see if the IP address is found and if so, see if it's logged in. logged in

if (mysql_num_rows ($access)) exit;		// If User is logged in, exit program (a simple way to show the data)
else header("location: http://example.com/login.php");  // If failed, sen user to login page
?>

---------------------------------------------------------------------------
Also,

{L_LOGIN_LOGOUT} simply tells PHPBB's templateing system to replace it with what is stored in the language file being used. (not the "L" at the begining). This is how PHPBB can be translated into other languages.

What I think you are thinking is "
<!-- BEGIN switch_user_logged_in --> and
<!-- END switch_user_logged_in -->
which I'm not entirely sure how this works.
kkroo
Registered User
Posts: 729
Joined: Sat Dec 03, 2005 4:49 pm
Contact:

Post by kkroo »

i made the program, and i inlucuded it.

but there is a fatal error:

Fatal error: Cannot redeclare encode_ip() (previously declared in /home/kkroolay/public_html/forum/includes/functions.php:378) in /home/kkroolay/public_html/include.php on line 6
geocator
Registered User
Posts: 16242
Joined: Fri Jan 09, 2004 11:56 pm
Location: On dry land
Contact:

Post by geocator »

Remove

Code: Select all

// Program Functions
 
 // Encrypt IP (Found in /includes/functions.php)
 function encode_ip($dotquad_ip)
 {
   $ip_sep = explode('.', $dotquad_ip);
   return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
 }
 
// 
kkroo
Registered User
Posts: 729
Joined: Sat Dec 03, 2005 4:49 pm
Contact:

Post by kkroo »

i got it to work! all is working but stuff like {L_LOGIN_LOGOUT} and {T_BODY_BACKGROUND} and so on. so that means my templating system is not functioning.

do you know how to get them to work?

Thanks
kkroo
Registered User
Posts: 729
Joined: Sat Dec 03, 2005 4:49 pm
Contact:

Post by kkroo »

all i know is that all that crap is in page_header.php, and i do not know how to get the crap out of there, i tried but i get an error
Fatal error: Call to a member function on a non-object

it doesn't like this

Code: Select all

$template->assign_vars(array(
:S

Please help!
Swizec
Former Team Member
Posts: 1701
Joined: Mon Mar 10, 2003 9:42 pm
Location: Slovenia
Contact:

Post by Swizec »

you need to include and initialize the template engine

template.php or something in includes I believe, check the common.php to see how it's done there
kkroo
Registered User
Posts: 729
Joined: Sat Dec 03, 2005 4:49 pm
Contact:

Post by kkroo »

i found the functions in page_header.php , but, i do not know how to include them.
Dman8568
Registered User
Posts: 32
Joined: Sun Feb 20, 2005 4:00 am
Location: WV, USA
Contact:

Post by Dman8568 »

If you include common.php this will initialize the Database, Language and Templating System. Along with some Anti-Hacking measures.
kkroo
Registered User
Posts: 729
Joined: Sat Dec 03, 2005 4:49 pm
Contact:

Post by kkroo »

Dman8568 wrote: If you include common.php this will initialize the Database, Language and Templating System. Along with some Anti-Hacking measures.


common.php is included....
Post Reply

Return to “[2.0.x] MOD Writers Discussion”