I need a login box that will make a password protected area, how do I do this? I have been looking on the web but have found nothing. Like can the box link to another webpage? And how will the box know if it is the right password? Do I need a script for this?

teedoff

11-18-2010, 03:44 AM

you need to use server side and a database.

Also, re for your thread title tells nothing about your problem.

quartzy

11-18-2010, 03:38 PM

Yes it was an error that I entered re:
So I need to use serverside and a database, why do I need a database? And do you know where can I learn about them, I have never done databases on the web before.

teedoff

11-18-2010, 04:06 PM

Well there may be other ways to "store" a username and password, but databases are for just that purpose.

Is this going to be for a back room admin section? or for site users to register and login to the public section of your site?

quartzy

11-18-2010, 04:29 PM

It is a main website with a linked page for members only (certain professionals) to access images, so they need a login form which then directs them to the pages of images. So I think it is a back room section.

teedoff

11-18-2010, 04:46 PM

It is a main website with a linked page for members only (certain professionals) to access images, so they need a login form which then directs them to the pages of images. So I think it is a back room section.

Well it would be very simple to create a small "members" table in Mysql first. Then you could create a login form, which is just a standard html form, that compares the user's login to their username and password info with a simple query. This is the basics of what you would need. You could get a bit more complicated, but thats for another post.

quartzy

11-18-2010, 04:52 PM

Could I put a mySQL on this as I dont have a apache server I have a windows server.

This is the site they have right now, very hard to see anything that is going on with all the code on the pages.
http://leeoasis.org.uk Staff is the restricted area

teedoff

11-18-2010, 04:55 PM

Well you could download and install WAMP, which is a php, apache, and MySQL server package thats free.

You could certainly use MS Access database. I dont like using it for real world database applications, but it should work well enough for your needs, since this is to be a back room section anyway.

quartzy

11-18-2010, 05:00 PM

Yes, I just want to use the easiest method, MS Access database, but I have no idea on how to do that. I have created a form and use expression web but hand code. So the controls are there but I dont know what I need or how to go about it.

teedoff

11-18-2010, 05:06 PM

ok again first thing would be to create a database. Do you know anything about Access? or even have it?

quartzy

11-18-2010, 05:08 PM

I have used Access for office work, but never for the web. I have made a login form but it wants to post somewhere, where would I post it to?

Your action would be where you want a user to "go" once the login is successful. For example, once they enter their username and password, and it matches their username and password in the database, you might send them to an adminIndex page. So the action would be action="adminIndex.html"

quartzy

11-18-2010, 11:06 PM

So would I just import an access database onto my site? The same way I do a word doc or pdf? I have Access software.

teedoff

11-19-2010, 12:08 AM

You dont import a database to your site. You create a database, create each table in the database, then pull information from the database using server-side languages.

You should really learn a bit about SQL and php at w3schools.com (http://www.w3schools.com/sql/default.asp).

quartzy

11-19-2010, 12:39 AM

I am learning mySQL but it keeps throwing up errors on the syntax and I have not got a manual just a training DVD.

You said I could use an access database, Why cant I make this Access database and then import it into my website folder? Or in my controls in EW there is mySQL data source control, is that a database. I am just looking for some practical help on how to do this.

jibin

11-19-2010, 02:07 AM

try to check cms like drupal joomla etc, it has built in forms, and complex functionality.

quartzy

11-19-2010, 02:40 AM

I have made a form and now I need it to do something, it is on a local host. What happens to the data once the user has created a new account? I really need some help and not get told to learn something that I dont even want to do.

As I have mentioned before, it is for a charity http://www.leeoasis.org.uk and no I am not getting paid to do it.
I want to help them out and learn at the same time. But they will need a database to have a secure area accessed by a login screen, which links to pages of images.

I have never done databases and that is enough to learn I do not want to do CMS or anything like that. I also have Expression Web which has all the controls I need to make forms but I dont know how to start of the form and then link it to the database, if you see what I mean, the next thing I have to do is add the images.

teedoff

11-19-2010, 03:18 AM

All this can be done WITH a database, which is how it should be done. I dont know what you expected when taking on a project like this. By your own admission, you say they will need a database, so maybe you need to take some time to learn at leat how to create a couple of tables in Microsoft Access, and then at the very minimum how to write a simple query to get data from the database.

If you read through the link I gave you for SQL...which is a standard language that can be used with most any database such as MySQL or Access, then you could learn in no time.

If you then have specific questions about coding or databases, then someone or I could help you. Otherwise, do you just want me to create a database for you and write your form and query??

Not that I'm not willing to do more of that, but I was trying to push you towards learning some on your own.

quartzy

11-19-2010, 03:44 AM

I am very capable of learning a lot on my own, I know how to create a database and table in access and mySQL and I know how to query them. I know how to code a login form, what I dont know is what do I do with it? ie how to put it all together And you are not very helpful to me, even though you may intend to be.

teedoff

11-19-2010, 03:59 AM

I am very capable of learning a lot on my own, I know how to create a database and table in access and mySQL and I know how to query them. I know how to code a login form, what I dont know is what do I do with it? ie how to put it all together And you are not very helpful to me, even though you may intend to be.

Ok if you know all that, then what you would do is once a user types in his username and password and clicks tha submit button, then the form action would go to the "main" page. You could say the main page is the adminHome.html.

On this adminHome page, you would have a query to compare the username and password to the database. If they both match a record in the database, then the login would be successful, and so would correctly take the user to the adminHome.html page. If it didnt match you could display a message and take them back to the login page.

SInce you said you know how to query a database, and you know how to create a database and you know how to create a form, then honestly I dont know how much more I can say.

Now, if in fact you're still not sure how to do this, I will send you a login, loginError, and logout file and even create a single table database in Access for you as well. You would have to change the filenames and add records to the database for your own needs.

quartzy

11-19-2010, 02:37 PM

I have just found out that the host does not support mySQL or Access databases, they only support MS SQL so I will have to work with that. I also need to find out stuff from my client, ie I dont think that they need to register and so would need just a login form to free up the extra pages. I wonder if this could be done without a database?

teedoff

11-19-2010, 02:45 PM

I was just going by what you said. That your client would eventually need a database. Yeah you need to do some more research on what they actually need.

After some time, they will need a database but for now I think that they can use the login screen and then go to further pages from there. How would I do the .htaccess thing? my server has it on the server and I dont, can I add 2 of them? or amend the one on the server.

Teedoff you mentioned you could send me a login error and login files/code could you do that for me? I can do the form but I dont know where to point to.

Donkey

11-19-2010, 07:10 PM

If you read the tutorial it tells you how to protect folders or individual pages.

* If you want to password protect other folders (that aren't under the currently protected folder), simply copy your .htaccess file to the new folder to be protected.
* To password protect more than one file in the same folder, just create more <Files></Files> blocks within the same .htaccess file

quartzy

11-19-2010, 07:32 PM

Thanks, so to confirm, it is OK to have one htaccess on the server and then publish antoher one in my folder?