hi
i create a web site by php and it works by mysql.
i have 20 users in mysql database and 20 tables in mysql database, each user can add record to only one table i need some code that first identify users and save username and password that user input for login beetwen pages(i need each user can add or delete record multi play without input user and pass multiplay)then check user prilivage for add or delete record to mysql and at last log out.
my english language is not good sorry.
please help me to create my code
Moderator: General Moderators
- DigitalMind
- Forum Contributor
- Posts: 152
- Joined: Mon Sep 27, 2010 2:27 am
- Location: Ukraine, Kharkov
Re: please help me to create my code
please help me to buy a new car
help and get a project done for free are different things
help and get a project done for free are different things
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: please help me to create my code
I think that what DigitalMind means is that you need to break your question into several small bits before anyone can really help you.
Start by creating somewhere to store details of users, their usernames, passwords etc. - another database table perhaps. Then write some code to allow a user to enter a user name and password, and check these against records in the database. There are lots of security issues about exactly how to do this. My advice is not to worry too much about security at the beginning - get a working system, and go back later and improve the security.
You will at this stage need to learn something about sessions. After a user has logged in successfully, you need to have a way of keeping them logged, at least until they close their browser window. The normal way of doing this is to create a 'session', and to check for the existence of a valid session cookie at the top of each page of your script.
Then think whether you really need one database table per user. You only have 20 users at present, but suppose that at some time in the future you get 100, or 1000, users. Do you really want that many database tables? Perhaps you can manage with only one database table (in addition to the table of usernames etc). You could link each record in the database to a particular user, and write your code to allow a user to read or modify only records which contain their user id in a 'user-id' field.
Start by creating somewhere to store details of users, their usernames, passwords etc. - another database table perhaps. Then write some code to allow a user to enter a user name and password, and check these against records in the database. There are lots of security issues about exactly how to do this. My advice is not to worry too much about security at the beginning - get a working system, and go back later and improve the security.
You will at this stage need to learn something about sessions. After a user has logged in successfully, you need to have a way of keeping them logged, at least until they close their browser window. The normal way of doing this is to create a 'session', and to check for the existence of a valid session cookie at the top of each page of your script.
Then think whether you really need one database table per user. You only have 20 users at present, but suppose that at some time in the future you get 100, or 1000, users. Do you really want that many database tables? Perhaps you can manage with only one database table (in addition to the table of usernames etc). You could link each record in the database to a particular user, and write your code to allow a user to read or modify only records which contain their user id in a 'user-id' field.