Jump to content

Php login/registration page


timtam88

Recommended Posts

a login without sessions is not really posible. Unless you want to use it for only one page. You don't have to use cookies yourself but sessions will store a cookie on the clients computer.

a registration page means that you will have to deal with a dynamic number of users with all different names an emailaddresses etc.. You will need to store that data somewhere. A database is most common but store your data into a file is also possible.

Link to comment
Share on other sites

a login without sessions is not really posible. Unless you want to use it for only one page. You don't have to use cookies yourself but sessions will store a cookie on the clients computer.

a registration page means that you will have to deal with a dynamic number of users with all different names an emailaddresses etc.. You will need to store that data somewhere. A database is most common but store your data into a file is also possible.

 

you see thats the problem im running into im trying to do it for my class but i have to follow certain guidelines. Would you mind looking at the assignment for me? im not asking you to do it i just want to know if you could understand fully what my professor is asking us to do and what method i should go about doing it( i would ask him to explain but its an online course and its been 12 hours since i asked)

 

its a google presentation

 

 https://docs.google.com/presentation/d/1_vjLMhxMPToGR8E937ZHIF7X9YmU680AK5IZcR4B9J0/pub?start=false&loop=false&delayms=3000#slide=id.p

Link to comment
Share on other sites

Your first time coding php and your professor wants you to do this kind of thing with those restrictions?  Interesting.  What was the topic of the day when he made that assignment?

 

In order to have a login your app has to have some 'continuity' to it and we know that the web doesn't provide that kind of conversational activity without using one of the 3 things you have been instructed not to use.  Sounds like an impossible assignment to me.  I suppose you could use a text file stored in a folder outside the web tree, but that is just silly from a teaching standpoint.  Maybe he is teaching in 'baby steps' ?

 

The only way I see to accomplish this lesson is to use a text file which you write a function to open it, read thru it, and look for the user-supplied credentials from your form.  If found then they are logged in; if not then no.  And for new registrations, you have to add the ability to add a line at the end of the file.

Edited by ginerjm
Link to comment
Share on other sites

Yeah I would have to go with Frank_b and ginerjm on this.

 

It is nearly impossible to have a login system without any type of database to it. Although it does say no cookies or database, you can always use sessions if they didn't say you can't use it. Like Frank_b and ginerjm said, you could use a text file to store these user datas. Normally, I'd suggest .csv files. .txt files aren't normally used for these things. .csv files are more easier when it comes to editing them via a file editor.

Link to comment
Share on other sites

LeJack - re-read the OP opening statement.  It's pretty clear on what is taboo.

 

As for my suggestion to use a 'text' file - a text file is just that - text.  Whether it has commas, pipes, tabs or whatever in it doesn't change what it is - a poor-man's db and should only be used as a last resort.

Link to comment
Share on other sites

Ok,

 

"No database or cookies are required".

"All data should be passed from form to form"
 

Tells me that it is not forbidden to use a database OR cookies :-)

 

What hurts me is that they want us to pass all data from form to form which is a very big security hole. 

It means that we have to include a query string on every link that we write to help us remember who is logged in.

To make it a bit more secure we use  the password and username scrambled into the query string.

eg: http://mysite.org/profile.php?sid=hfqe0weyr40faqew0runqrvfda

 

 

I think i should make a login WITH database OR file storage.

 

And i should use all the guidlines for the sign-up and profile pages.

 

I asume that you know how to maken a form in HTML. Start with that part:

 

I think this is what you have to make first:

- an index page with links to the other pages like the profile page 

- a login form

- a profile page (later it will be after the login)

-a edit-your-profile page (later it will be after the login)

- a add-user page (later it will be after the login)

 

i ll send you a private message later.

Edited by Frank_b
Link to comment
Share on other sites

I made a begin on a manner how you could do this.

 

You should only use it for learning. Write your own code!

Dig everything out until you understand how it works!

 

unpack the zip in the document root or a higher directory on your webserver.

Then browse to the setup.php file

 

if you don't get errors then setup ended successfully.

 

You have two users:

 

Frank with password 1234

Newbee with password 0000

 

 

No sessions, cookies or database is used.

Users are stored in a file in a directory with the name private which will not be accessible from the web.

The file format is JSON plaintext.

 

I've added comments in the code.

For any questions you can leave a message here.

 

Success.

login.zip

Edited by Frank_b
Link to comment
Share on other sites

I made a begin on a manner how you could do this.

 

You should only use it for learning. Write your own code!

Dig everything out until you understand how it works!

 

unpack the zip in the document root or a higher directory on your webserver.

Then browse to the setup.php file

 

if you don't get errors then setup ended successfully.

 

You have two users:

 

Frank with password 1234

Newbee with password 0000

 

 

No sessions, cookies or database is used.

Users are stored in a file in a directory with the name private which will not be accessible from the web.

The file format is JSON plaintext.

 

I've added comments in the code.

For any questions you can leave a message here.

 

Success.

thanks i greatly appreciate this....now i can actually understand the basic steps of how to approach this project.....thanks a tonne

  • Like 1
Link to comment
Share on other sites

I made a begin on a manner how you could do this.

 

You should only use it for learning. Write your own code!

Dig everything out until you understand how it works!

 

unpack the zip in the document root or a higher directory on your webserver.

Then browse to the setup.php file

 

if you don't get errors then setup ended successfully.

 

You have two users:

 

Frank with password 1234

Newbee with password 0000

 

 

No sessions, cookies or database is used.

Users are stored in a file in a directory with the name private which will not be accessible from the web.

The file format is JSON plaintext.

 

I've added comments in the code.

For any questions you can leave a message here.

 

Success.

thanks so far, Im trying to follow the directs but i think you had left the .json file out of the zip or am i missing something.......with that said im not sure i really understand how you are saying to arrange the files for them to work

Edited by timtam88
Link to comment
Share on other sites

Hi timtam,

 

When you run setup.php it will create the the json file in the /private directory.

 

after setup you should have this:

|----[private]
|        |
|        |---- .htaccess
|        |---- users.json
|        |---- users.php
|
|
|---- index.php
|---- login.php
|---- logout.php
|---- members.php
|---- setup.php


Edited by Frank_b
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.