[php] members only section

sean.ferguson

OSNN Veteran Addict
Joined
4 Jul 2003
Messages
1,693
im needing a secure login script that allows access to a protected dir; this is to be a members only section.

What I Need:
- Admin Area; No User Registrations
- Users Must Be Registered Via Admin
- Secure, Simple and Fast PHP
- Information on How to Protect a Full Directory
- MySQL Database of Users
- Login Script
- Something To Check User Is Valid

What it needs to do:
I need to be able to create new users via an admin panel of some form, users must be able to login from a form (user: pword:). After users login they are to be re-directed to the member only dir, they can only enter the directory if they have successfully logged in. I need to be able to monitor user usage and times/dates when they logged into the member area. It has to be secure enough to hold billing information.

I have searched on the PHP Resource Index and the free options they have are not really up to scratch... not the ones i have tried thus far anyway. I would prefer a free solution so the software that retails at $399.99 is out of the question im afraid. Im not to bothered about looks as it will be customized anyway.

Thanks for any help
 

Geffy

OSNN Veteran Addict
Joined
18 Mar 2002
Messages
7,805
I wrote something a bit ago that used .htaccess with .htpasswd, and a php login
 

sean.ferguson

OSNN Veteran Addict
Joined
4 Jul 2003
Messages
1,693
ok, i have my login script; SQL database and members authenticity script... but im stuck in MySQL as i have no prior experience with it and its queries

I have a Table (User) and four fields (id,username,password,email), what is the query i pass in MySQL to add data to these four fields, for example's sake say i want to add id:1 - user: test - password: testing - email: test@testing.com
Im stumped, anyonoe help?
 

Geffy

OSNN Veteran Addict
Joined
18 Mar 2002
Messages
7,805
say your different fields are coming from a PHP script in the following
$_POST['username']
$_POST['password']
$_POST['email']

the query you would use would be
INSERT INTO `table_name` (id,username,password,email) VALUES ('NULL', '". $_POST['username'] ."','". $_POST['password'] ."','". $_POST['email'] ."')

breaking it down its saying it wants to insert data into the table called "table_name" and that "table_name" has the fields called id, username, password and email, and then that the list of VALUES should be inserted into those fields
I dont know if the ordering in the table field listing matters, but I always just do it in the order that they appear in phpMyAdmin, and the VALUES list is always in the same order, hope that helps

btw it is best to have the id field set to auto_increment when you create the table for MySQL
 

sean.ferguson

OSNN Veteran Addict
Joined
4 Jul 2003
Messages
1,693
thanks, i already have the 'id' field set to auto_increment so i gather i dont need to enter any values for the id field?
 

Geffy

OSNN Veteran Addict
Joined
18 Mar 2002
Messages
7,805
thekore said:
thanks, i already have the 'id' field set to auto_increment so i gather i dont need to enter any values for the id field?
I always just send "NULL" to the id field, MySQL then ignores it and happily auto increments it. I leave it in so I can better see and structure the statement/query
 

Khayman

I'm sorry Hal...
Political Access
Joined
6 Jan 2002
Messages
5,518
I remeber writing my admin section for my site a while ago, i used to use just .htaccess with .htpasswd. don't even need a php login as it will pop up a box asking for the login details.

In the end i done my own in php and mysql. was fun. The main problem, that i found anyway, is that after they have logged on you have to know they have logged on. Usualy done in the form of a cookie (although i suppose you could log an IP address or somthing) and making that cookie secure so that people can't forge it (not that anyone would want to go to that effort to get in my site, but i though i might as well go all the way :))
 

ZeroHour

ho3 ho3 ho3
Joined
22 Mar 2004
Messages
1,118
thekore just out of intrest how long u been doing PHP and is this for you or a customer? LOL ;)
 

sean.ferguson

OSNN Veteran Addict
Joined
4 Jul 2003
Messages
1,693
php, not long; i have only ever played with includes and referrers ip info etc... this is very new to me.
its for me and a customer... i am in the process of setting up a company and the company website is going to be the main focal point for the customer. The members only area was going to be so as previous customers can log in and find out news on up and coming products, company news and gain access to customer forums which would be hidden from the public eye.
 

sean.ferguson

OSNN Veteran Addict
Joined
4 Jul 2003
Messages
1,693
the phpfreaks tutorial looks like exactly what i was looking for; im trying it out just now. I'l be back once i have scripted and customised to let you know :)
 

sean.ferguson

OSNN Veteran Addict
Joined
4 Jul 2003
Messages
1,693
okay after getting the basics from the tutorial; its missing the checkuser.php file :confused: ZeroHour you got any idea whats supposed to be in the checkuser.php page or where the actuall page is at? I cant test it / customize it until i have that file :(
 

ZeroHour

ho3 ho3 ho3
Joined
22 Mar 2004
Messages
1,118
Ahhh.
I will email the dude from PHPFreaks as I know him.
Will let you know ASAP m8
 

sean.ferguson

OSNN Veteran Addict
Joined
4 Jul 2003
Messages
1,693
yeah thats right take the piss out of a n00b :p

you'l be getting your
clicked ;)
 

ZeroHour

ho3 ho3 ho3
Joined
22 Mar 2004
Messages
1,118
HeHe
you could not see it for looking lol ;)
Hope it works for u m8
 

Geffy

OSNN Veteran Addict
Joined
18 Mar 2002
Messages
7,805
is it just me or does phpfreaks always seem to die and stop serving pages after you try to look at the second page of any tutorial??
 

ZeroHour

ho3 ho3 ho3
Joined
22 Mar 2004
Messages
1,118
Hmm
There is a mirror for them.
The ad's can hold the WHOLE page up if the ad server is busy. Its a issue with IE.
I used to run Kazaalite.com and I had that problem too. The ad server caused the page to load slowly as IE waited for the content to come from there crappy server LOL
 

X-Istence

*
Political Access
Joined
5 Dec 2001
Messages
6,498
ZeroHour said:
Hmm
There is a mirror for them.
The ad's can hold the WHOLE page up if the ad server is busy. Its a issue with IE.
I used to run Kazaalite.com and I had that problem too. The ad server caused the page to load slowly as IE waited for the content to come from there crappy server LOL

He aint using IE :p
 

Members online

No members online now.

Latest profile posts

Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.
Terrahertz wrote on Electronic Punk's profile.
Yo fellas!
Electronic Punk wrote on Sazar's profile.
Where are you buddy?
Perris Calderon wrote on Electronic Punk's profile.
Hey EP! All good with me, applying for Microsoft MVP right now, should have done this a while ago.

Notifications don't work, I only found your response by coming back to hunt up some threads, if you want, give me your email address so we can keep in touch easier!
Perris Calderon wrote on Electronic Punk's profile.
EP, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there!

Forum statistics

Threads
61,997
Messages
673,411
Members
5,589
Latest member
miankuttabila