user authentication with db cs346 fall 2010. requirements web site is for registered users only –...

23
User Authentication with DB Cs346 Fall 2010

Upload: seamus-dagley

Post on 14-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

User Authentication with DB

Cs346 Fall 2010

Requirements

• Web site is for registered users only– Username and password– Password is encripted

Design• Database student– Table auth_user– Re-use m12 scripts to create the table

• MVC– GUI: xhtml for registration entry– PHP: process the input and insert the entry into DB

table auth_user– DB: auth_user– GUI: xhtml for existing user login– PHP: process the username-password, query

auth_user

Development stages

Specify name of table and # columns

Define field for auth_user

Add table ‘auth_user’ to DB ‘student’

The above message was generated by the PHP sript.Is it really true?Use m11 script to list tables

Verify that table ‘auth_user’ is created

etc. Information_schema has too many attributes

New User Registration

One entry added

Is the entry really there in DB?

• Use MySQL Console• Write a PHP script to query the database

mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || books || cs346 || ex04a || mailinglist || mysql || products || student || testdb1 |+--------------------+9 rows in set (0.00 sec)

mysql> use student;Database changedmysql> show tables;+-------------------+| Tables_in_student |+-------------------+| auth_user || my_music |+-------------------+2 rows in set (0.00 sec)

mysql> use student;Database changedmysql> show tables;+-------------------+| Tables_in_student |+-------------------+| auth_user || my_music |+-------------------+2 rows in set (0.00 sec)

mysql> SELECT * FROM auth_user;Empty set (0.00 sec)

mysql> SELECT * FROM auth_user;+--------+--------+----------+-------------------------------------------+| f_name | l_name | username | password |+--------+--------+----------+-------------------------------------------+| John | Doe | john.doe | *54B88827AF6DA4FCE049F501D462BE6A9F7EF979 |+--------+--------+----------+-------------------------------------------+1 row in set (0.00 sec)

mysql>

Existing User Login

Existing User Login - successful

Existing User Login - Failure

Existing User Login - Failure

Next

• Upload to remote server• Testing– Repeat all the steps in the local server:• Create table auth_user• Enter new registrations• Authenticate the users

Add a 2nd New Registration

ok

success