Zubrag.com
June 23, 2017, 04:15:22 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 [3] 4 5
  Print  
Author Topic: Password Protection example  (Read 396555 times)
recoding
Global Moderator
Jr. Member
*****
Posts: 71


WWW
« Reply #28 on: March 12, 2009, 09:52:08 AM »

Hi ostatni,
Could you please copy and paste into a reply lines 115, 116 and 117?

Should be able to start to help then.

Logged

pan2
Newbie
*
Posts: 2


« Reply #29 on: March 22, 2009, 09:02:37 AM »

Hello,
I've been working on this for countless hours now, to the point that I think I'm about to cry.

As with so many other people, I've encountered the incredibly bothersome "cannot modify headers" problem:
Warning: Cannot modify header information - headers already sent by (output started at /home/doki/public_html/hetalia/admin2.php:1) in /home/doki/public_html/hetalia/password_protect.php on line 184

I've already checked for white spaces and there aren't any. I wonder if it's because I'm trying to combine so many different scripts and I have no idea what I'm doing. admin2.php is supposed to have a password form and then upon entering the correct password, it opens and displays another text file (which I have working).

These are the first two lines of admin2.php
Code:
<?php include("/home/doki/public_html/hetalia/password_protect.php");
include (
'pagestop.txt'); //regular text file with header info like <html>..<body>
//below this is code for opening & displaying another .txt

This was originally line 184 of password_protect.php, and after I // out the line as I read under the comments on the main page, the line of error changed to 158.
Code:
setcookie("verify", md5($lp), $timeout, '/');

These are lines 157-158 of password_protect.php
Code:
// set cookie if password was validated
    setcookie("verify", md5($login.'%'.$pass), $timeout, '/');
After I commented out line 158, the headers problem disappeared. But then, naturally, it wouldn't remember any cookies and I would have to re-enter the password each time which is tiresome!

Please help, somebody! I can also email my entire PHP codes and also give the URL to show the problem.
Logged
recoding
Global Moderator
Jr. Member
*****
Posts: 71


WWW
« Reply #30 on: March 23, 2009, 12:46:20 PM »

Hi pan2,
It sometimes can be hard to read the errors, the error is basically saying that the command on line 158 cannot be ran because of: output started at /home/doki/public_html/hetalia/admin2.php:1 or basically, admin2.php seems to have something on line one..what do you use to edit your files? try opening in wordpad(windows) or textedit(for mac) and making sure there is absolutely nothing there, if it still doesn't work send me a private message with the two php scripts attached, and I'll try and have a look for you.
Logged

pan2
Newbie
*
Posts: 2


« Reply #31 on: March 23, 2009, 08:23:52 PM »

I use notepad, and I've checked time and time again! I am certain there are no white spaces!
I will send you the PM now though, thank you for helping!
Logged
nairda
Newbie
*
Posts: 2


« Reply #32 on: April 06, 2009, 03:15:03 PM »

Hello,

This script seems fantastic and is just the thing I'm looking for, however I've the same problems as many others and have been trying to fix for many hours now! Have searched all the postings but no luck I'm afraid. I've added the line <?php include("/mounted-storage/home61b/sub009/sc38678-FRKH/cheaponlinetraintickets.co.uk/protector/password_protect.php"); ?> to my header.php file so gets added to all pages on the site. The problems I have are:

1) Warning: Cannot modify header information - headers already sent by (output started at /mounted-storage/home61b/sub009/sc38678-FRKH/cheaponlinetraintickets.co.uk/wp-content/themes/cheap-online-train-tickets-theme/three_column_template_cheap_tickets.php:7) in /mounted-storage/home61b/sub009/sc38678-FRKH/cheaponlinetraintickets.co.uk/protector/password_protect.php on line 137

If I comment out the line 137 this message is gone :-) But I would like it to have the option for cookies, how can I do this? I've checked my documents and can't see any white space.

2) I have to login on every page! I only want to enter the login details once so I can then browse all of the website.

This is a test site (need to implement this on a live site once I have ready). Any help would be much appreciated. I'd gladly email you the password_protect.php and header.php files I am using if it helps.

Kind regards,

Adrian
Logged
recoding
Global Moderator
Jr. Member
*****
Posts: 71


WWW
« Reply #33 on: April 06, 2009, 03:20:13 PM »

Hi Adrian,
The problems 2 and 3 are because of 1, cookies make it possible to save that you have logged in, and delete them when you logout.

So to do anything, we need to fix problem 1, now just commenting it out does fix the problem, but removes complete functionality.

Basically you may have added the password_protect to the right place, however the file ../wp-content/themes/cheap-online-train-tickets-theme/three_column_template_cheap_tickets.php loads BEFORE header.php so that is the problem, to be exact on the file three_column_template_cheap_tickets.php on line 7, something is said, what I recommend is moving the line:
Code:
<?php include("/mounted-storage/home61b/sub009/sc38678-FRKH/cheaponlinetraintickets.co.uk/protector/password_protect.php"); ?>
and adding it to three_column_template_cheap_tickets.php on line one. It should work then.
Logged

nairda
Newbie
*
Posts: 2


« Reply #34 on: April 06, 2009, 03:38:53 PM »

Hello again,

It's always the way isn't it, you search for hours to find a solution before making a posting... then a few minutes later find the solution :-) http://www.zubrag.com/forum/index.php/topic,360.0.html made it very clear what was needed to fix my problems.

Tried to delete my previous post but couldn't see how so just wanted to say a big thank you for the script :-)

Many thanks,

Adrian
Logged
recoding
Global Moderator
Jr. Member
*****
Posts: 71


WWW
« Reply #35 on: April 06, 2009, 03:43:14 PM »

Ah I thought you may have read that, okay Cheesy
Logged

lambofgod
Newbie
*
Posts: 1


« Reply #36 on: May 05, 2009, 09:14:06 PM »

Hi, i'm so newb at this its not even funny.

Where would i set my username/password?

I see a line where it say's

  'zubrag' => 'root',
  'admin' => 'adminpass'

and i tired to replace
 'root' with my username &
'adminpass' with my password.

it still wouldn't let me log in Sad please help!!!
Logged
recoding
Global Moderator
Jr. Member
*****
Posts: 71


WWW
« Reply #37 on: May 06, 2009, 04:56:15 AM »

Hey lambofgod,

Could you private message me your complete script (the whole file) I'll take a look (:
Logged

designer
Newbie
*
Posts: 1


« Reply #38 on: May 10, 2009, 01:58:32 AM »

Hello-
I have been trying for hours now to get the password to take in my file and I can't get it to take, and let me in to what I am protecting.

Would someone have some advice?

Logged
recoding
Global Moderator
Jr. Member
*****
Posts: 71


WWW
« Reply #39 on: May 10, 2009, 02:54:43 PM »

Take in your file? how are you including it? If you do not want to paste your code here please feel free to PM me and I'll try my best to help out Wink
Logged

akishimo
Newbie
*
Posts: 1


« Reply #40 on: May 16, 2009, 03:01:51 AM »

lambofgod:
you're supposed to replace 'zubrag' with username and 'root' with password. Same for the next line.

For all those who couldn't get the log-in page to come up, I had the same problem until I discovered this:

Let's say you were trying to password protect "Home.html".

You change the name to "Home.php"

However this "homepage" comes with a folder that contains your images and other stuff.

The password log-in may not be showing because you probably have to change everything in your folder that used to refer to "Home.html" to "Home.php"

I created an entirely new test page with no other folders/files attached, and the password script worked perfectly.

Hope this helps.
Logged
maco
Newbie
*
Posts: 1


« Reply #41 on: May 29, 2009, 10:01:46 AM »

Is there a way to add a logout button at the page that has been protected and when the user presses it it sends them back to the login page... I know when the session times out this happens but I want the user to be able to do it aswell...

how would this be done?
Logged
Pages: 1 2 [3] 4 5
  Print  
 
Jump to:  

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