The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Aah, I found it! Of course it hadn't anything to do with the "include"-tag, thought so!
But one of the files I included had a PHP-command in it:
<?php session_destroy ?> (or something like it).
And of course that's where things went wrong!
So, I beat the forum, hehehehe and then I get a:

'till next time, I suppose!

------------------------------------------
"In a forum no one can here you cry"
------------------------------------------

The first problem I have is that I want to have some private pages and some free pages. So members can log in from anywhere in the site.

This is not too much of a problem; I think I could easily solve this on its own.

The main problem comes from the fact that my main design template has a user login form on every page of the site, not just on the private pages, as in Kevin's tutorial.

Now I just can't get my head round how to solve this problem, because it means I would need to include the accesscontrol.php script on every page in order to allow the user login form to work (even on the free pages/visitors section). I just can't work out if this actually is a problem or not, I'm just very confused how to tackle this.

My options at the moment seem to be to either redesign the free/visitors section pages so as not to have a login form on them at all. This would mean I could use the script pretty much as Kevin intended.

OR,

I can try to figure out how to make the code work on my current site designs.

Could anyone give me advice on which way to go ie how I would go about adapting the code and how complicated it would be for a newbie?

you'd have to create a second form on the non-protected pages that would start the session, instead of using the accesscontrol.php file on these pages.

try this: copy the code from accesscontrol.php into a new file called login.php.... then include login.php on your non-protected pages. have login.php show the login pages (if the user isn't logged in) but don't have it restrict access to the current page.

----

Myself, I'm interested in this:

Members-only access to non-HTML files. Since PHP is equally capable of sending HTML and binary information, you could create a pass-through script that would only retrieve the requested file if a correct $uid/$pwd combination was found in the current session.

(from the article)

Any ideas on how to do this? (or where someone explains this?) And is this safe against direct requests?

Hi Prendo,
I had much the same problem ans I solved it as follows: on every page of my site I've included a standard header.php and a standard nav-bar.php. In this nav-bar is the link to my "members-only" pages. So, when someone visits my site, he/she can surf around freely and on any page he/she can decide to login by clicking the button "Login" and proceed to the member-dept.! Quite simple, but I'm not sure if this is what you mean!!

Derfel

------------------------------------------
"In a forum no one can here you cry"
------------------------------------------

is there a way for me to display back to the user there sign in imformation once the logged (kinda like it does on the protect page when a user login and is greeted with there user name?

Of course!

Originally Posted by deuce777

can i use the same form as my sign-up with a few changes that allow that allow them to edit and or delete to enter the new content?
?

I tried the same thing, but in my experience it results in one large file. I've split it: on my members-pages I've included a button "View/edit my profile", which links to a member-page where the MySQL-things are located.

************** Actually I've cut a few things out, but the principle should be clear, I hope. B.t.w.: I don't get this PHP-tag-thing to work correctly, I must be doing something wrong. Sorry. If someone could let me know how I should use them, please let me know! Thanx

------------------------------------------
"In a forum no one can here you cry"
------------------------------------------

as a novice in php/mySQL im having a bit of trouble with the script. it looks alright but when I press the submit button nothing happens. no warnings, no e-mail, no page switching, no DB entries. but I dont get errors either. how do I trace the error and how do I check if I have setup the db properly?

im running the scripts through phpdev on a local server if this has any influence..

should $dbhost in db.php be localhost or the name I have created for my db.

$dbuser and $dbpass are named to match the ones for my db. Are these db specific or are they tied with the visitor?

I know these are very beginner quation and properbly very easy but I still hope someone takes pity on me and help

it works fine after turning globals on but can I give an exampel of the $_POST[...variable name here... ] U mention cause globals might be off and the commercial server this will eventually go to. or can I just set globals on in htaccess.

Hey guys, I could use a little help here. I went through the tutorial and eventually figured out that I had to use $_POST['variable'], but I'm still having problems. On the signup page, every time I submit the form I get the error message: "A database error occurred in your submission...". What could be the prob here?

// Make sure all fields are filled inif ($_POST['newid']=="" or $_POST['newname']=="" or $_POST['newemail']=="") { error("One or more required fields were left blank.\\n". "Please fill them in and try again."); }

How can let the user change there password after they login

hello Kevin i have added a place in my members only area where the user can view there profile, now that i have down that i would like to add a form where they can edit the profile ,without me having to do it,

thanks for the help with the new feilds

Could you help me with a part now once the user has login i want them to be able to change there password
how can I do this
example of what i'm working in the member area i have a page where they can view there sign up info,on this page i want to add a form so they can edit if needed and so it e-mail them the new info with me have to do it for them my example below:
<?php include("accesscontrol.php"); ?>
<html>
<head>
<title>Customer_profile</title>
</head>
<body>
<p>Welcome,
<?=$username?>
! You have entered your profile area of the site.
<p>Email:
<?=$email?>
<br>
Company Name:
<?=$txtCompanyName?>
<br>
Title:
<?=$txtTitle?>
<br>
Address1:
<?=$txtAddress1?>
<br>
Address2:
<?=$txtAddress2?>
<br>
City
<?=$txtCity?>
<br>
OtherStateProvince:
<?=$txtOtherStateProvince?>
<br>
Country:
<?=$ddmCountry?>
<br>
OtherCountry:
<?=$txtOtherCountry?>
<br>
PostalCode:
<?=$txtPostalCode?>
<br>
Phone:
<?=$txtPhone?>
<br>
Extension:
<?=$txtExtension?>
<br>
Fax:
<?=$txtFax?>
<br>
Salutation:
<?=$rdbSalutation?>
<br>
URL:
<?=$txtURL?>
<br>
BusinessType:
<?=$txtBusinessType?>
</p>
<form method=post action="<?=$PHP_SELF?>">
<input name=newemail type=text maxlength=100 size=25>
Enter New Password
<td align=right colspan=2> <hr noshade color=black>
<p>
<input type=reset value="Reset Form">
<input type=submit name="submitok" value=" Create New Password ">
</p>
</form>

</body>
</html>

also how come the have to sign in agian when they view this page when there already signed in ?