Zubrag.com
August 20, 2018, 10:45:06 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1] 2
  Print  
Author Topic: Include login into php page  (Read 30537 times)
thejohnson4
Newbie
*
Posts: 28


« on: November 29, 2007, 04:32:39 PM »

Hi Zubrag,

I have uploaded all files and checked permissions etc.... but I am trying to include the login box into my own login (php) page and am having some trouble getting it to work...

I have tried using php include  for: login.php, login_form.php, password_protect.php and all display the login box - but none allow me to progress any further. Often replying 'incorrect password' or refreshing the page... or a combination....

Does my login page have to be in the same 'protect' directory as those files for it to work correctly? (i have tried it both ways... in and out of the directory.. still to no avail).


I had no real problems with the original password protect....trouble is - now there are 3 diff files that seem to have the same ability!

Any help would be greatly appreciated.
Warmest regards,

Adam Johnson

Logged
thejohnson4
Newbie
*
Posts: 28


« Reply #1 on: November 30, 2007, 12:36:52 PM »

does anyone have any ideas? i am at a real dead end with this.. i can include the login form okay... but getting it to work succesfully etc is another matter...

please help!
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #2 on: November 30, 2007, 01:53:13 PM »

login form has header and footer: login_header.php  and login_footer.php

did you try to update them?  These files are always included. Try removing everything from these two files if you include login form into your own design.
Logged
thejohnson4
Newbie
*
Posts: 28


« Reply #3 on: November 30, 2007, 01:58:47 PM »

zubrag,

i haven't uploaded these 2 as i've removed the mention of them in the other files
(i.e. where it says:
 include(login_header.php)
 include(login_form.php)
 include(login_footer.php)

 i have removed the header/footer references and not uploaded them to the server...)

What is the best way to incorporate a "working" login form into my page? what code do i copy from what file?
Sorry to be a pain,

many thanks.

adam
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #4 on: November 30, 2007, 02:03:01 PM »

Adam

I would like to try before answering this question, but unfortunately have no time today. Will try tomorrow. Hope it is not very urgent.
Logged
thejohnson4
Newbie
*
Posts: 28


« Reply #5 on: November 30, 2007, 02:06:33 PM »

Zubrag,

That's fine - no problem! Just a bit confused cos there are a 2/3 files that have the login form in them.... im guessin password_protect.php was leftover from standard passwordprotect? and including both login.php and login_form.php also display a login form on my own page...!

Thanks in advance.  adam
Logged
thejohnson4
Newbie
*
Posts: 28


« Reply #6 on: December 03, 2007, 04:32:07 AM »

did you have any luck in getting it to work? im still wrestling with it!
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #7 on: December 03, 2007, 05:41:03 AM »

Hi Adam

Sorry, did not have a chance to look at this over weekend.

It appears you must use login_header.php and login_footer.php if you want to incorporate login page into your site's design. Password protector stops page load after displaying login form, and your page contents would not be shown. It should work like this to not allow viewing protected page contents (as login.php is also used to protect pages).

Actually login_header.php and login_footer.php would contain code from your page, divided into two part. For example:

Your page code is:
<html>
<title>page title</title>
<body>
Sample page text before login form. Sample page text before login form.
Here you want to put login form.
Sample page text after login form. Sample page text after login form.
</body>
</html>


Your new page code is (same as above, just adding html for login form):
<html>
<title>page title</title>
<body>
Sample page text before login form. Sample page text before login form.
  <form method="post" action="http://www.example.com/url/to/login.php">
    Login:<br /><input type="input" name="access_login" /><br />
    Password:<br /><input type="password" name="access_password" />
    <p></p><input type="submit" name="Submit" value="Submit" />
  </form>

Sample page text after login form. Sample page text after login form.
</body>
</html>


login_header.php (everything before the place where you need login form), i.e.
<html>
<title>page title</title>
<body>
Sample page text before login form. Sample page text before login form.

login_header.php (everything before the place where you need login form), i.e.
Sample page text after login form. Sample page text after login form.
</body>
</html>

I'll try to change password protector make it easier to include login form on your page (without a need for header/footer). It is not trivial as your page contents is coming before password protector, causing problems with redirects (headers already sent error). But i think we will find some workaround.
Logged
thejohnson4
Newbie
*
Posts: 28


« Reply #8 on: December 03, 2007, 11:29:04 AM »

Hi Zubrag,

thankyou very much for getting back to me - it works perfectly - i just uploaded a blank header/footer and it works great!
You can see it here: http://www.adamjohnson.co.nr/login.html
Many thanks,

adam
Logged
thejohnson4
Newbie
*
Posts: 28


« Reply #9 on: December 03, 2007, 01:47:48 PM »

it seems i spoke too soon.... it does work - if you enter the correct login/password... it redirects you accordingly.

However, if you enter the wrong username/password you get taken to a blank white page with the form on it -- saying: error: user/pass incorrect.. is there anyway to incorporate this into the pagedesign instead of getting redirected to this standard white page? (which i am guessing is login_form?)

many  thanks,

a
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #10 on: December 03, 2007, 03:44:24 PM »

That is why i said you need login_header.php and login_footer.php (see my previous post what needs to be put into these files).
login_header.php and login_footer.php should contain your page design. Password protector loads them in case of error. You have "standard white page" because you removed these files and references to them. Put references back and create header/footer files.
Logged
thejohnson4
Newbie
*
Posts: 28


« Reply #11 on: December 03, 2007, 04:36:33 PM »

Thanks Zubrag, i am sort of getting it to work... by the way - do i NEED password_protect.php on my webserver? if so..what is it doing?


A seperate question though (on a similar note) -  i have an admin page.. and have used a php include to include manager.php and signup.php.... yet when i hit save on them the page refreshes and goes to my index page (on a CLEAN install of PPA).

though if i go to the files directly, they work fine... why is this happening?
many thanks,

a
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #12 on: December 04, 2007, 03:18:23 AM »

password_protect.php is protecting manager.php.
manager.php uses flatfile.inc.php for user management. flatfile.inc.php has following code:

echo '<form method="post">';

add action='http://www.example.com/path/to/the/file/which/includes/manager.php/or/flatfile.inc.php'

For example
echo '<form method="post" action="http://www.example.com/members/manager.php">';
Logged
thejohnson4
Newbie
*
Posts: 28


« Reply #13 on: December 04, 2007, 04:54:35 AM »

Hi zubrag,

thanks again for getting back to me so promptly- (sorry about this). Where do i put the above code? (i.e. in what file) Is it the same method for signup.php too?

Many thanks,

ada,

Logged
Pages: [1] 2
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC