Jump to content

Recommended Posts

Posted

I'm trying to allow members of my forum to sign in from the pages of my website. I'm pretty sure I have the php coding correct, it just isn't working. I know very little about what I'm doing so any help is MUCH appreciated.

 

Heres my problem:

 

I sign with a correct user name and password and when I hit the log in button it just dumps me right to my else condition as if I weren't logged in. My code is:

 

Session Management that is at the top of both the page i'm logging in from and the page I want to go to after a log in.

 

define('IN_PHPBB', true);

$phpbb_root_path = './forums/';

include($phpbb_root_path . 'extension.inc');

include($phpbb_root_path . 'common.'.$phpEx);

 

//

// Start session management

//

$userdata = session_pagestart($user_ip, PAGE_INDEX);

init_userprefs($userdata);

//

// End session management

//

?>

 

 

 

my forums are located in my forum directory so that part is correct.

 

 

then on the page you get taken to after a log in i have:

 

if( $userdata['session_logged_in'] )

{

<html content>

 

}

else

{

echo('Please Login');

}

 

 

my syntax seems to be correct I just can't get the log in to actually work.

 

my form code that I'm logging in with is. (exactly as it appears on the page)

 

<form action="login.php" method="post"><font color=white face=verdana size=2>Username:</font></td>

<td width=140><input type="text" name="username" size=15> </td>

</tr>

<tr>

<td width=30><font color=white face=verdana size=2>Password:</font></td>

<td width=140><input type="password" name="password" size=15 ></td>

</tr>

<tr>

<td width=60></td>

<td>

<input type="submit" value="login" name="login"></form>

 

 

I've hit a major wall as I have no idea on where to go from here so any help would great.

 

Thanks in advance.

Posted

Welcome to the forums timmy

 

Sorry, I have never tried to login to any BB software other than from the BB interface.

 

Maybe one of our members has done this and can give you some clues.

Posted

The only issue I can see is your form action, maybe.

Is the page you are trying to login from in the forums directory?

 

If not then you need to change

></pre>
<form action="login.php" method="post"><

to

></pre>
<form action="location%20of%20forums/login.php" method="post"><

Posted (edited)
The only issue I can see is your form action, maybe.

Is the page you are trying to login from in the forums directory?

 

If not then you need to change

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

to

><form action="location of forums/login.php" method="post">

 

 

my file structure is

 

 

public_html

--index.php (page logging in from)

--login.php

forums

--index.php (forums index)

 

 

p.s - thanks for the welcomes guys. been a customer for awhile now, just never posted.

Edited by timmy
Posted

ok i got it workin. I reinstalled my forum and it worked. so now my next question is how do I change it so when a user logs in they are taken to a page within my site instead of the forum?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...