Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

ASSIGNMENT 5 | SESSIONs + User Management ASSIGNMENT 5 | SESSIONS + USER MANAGEMENT PRAVIIN M | IS 667 | 71749 | ONLINE 1 We have discussed sessions in class. Now, it is time to put sessions to use....

1 answer below »
ASSIGNMENT 5 | SESSIONs + User Management
ASSIGNMENT 5 | SESSIONS + USER MANAGEMENT
PRAVIIN M | IS 667 | 71749 | ONLINE 1
We have discussed sessions in class. Now, it is time to put sessions to use.

Do the following:

• We already have a database (UserManager attached in assignment files) and we
also have a table that manages users. These users come with a user id!

• Create a table to hold roles, which will contain a column for userid and then the
ole they have been granted. (you will need to join the user and the roles tables
for fetching the information during login)
• You should have different roles for performing the following operations
o Admin (role): Should be able to do everything on the application; which is,
create, update, delete a record.

o Record Manager: This role should be able to create, edit, delete and view
the users that they have created. Let`s say there are two record managers,
FrodoBaggins and Gollum. Frodo should be able to edit and delete the
ecords Frodo has created. They should not be able to touch Gollum`s
ecords. On the other hand. Admin (Gandalf) should be able to edit.
Delete both Frodo’s and Gollum’s records.

o General User: This user role will NOT be able to create, delete, edit
ecords. They should only be able to see all the records in the system. –
Marked with who created the records!
• If you are feeling adventurous, you can create a page to reassign roles instead of
hardcoding them in the database. Which means, and admin can make P1, P2 and
other users of the system into admins or general users. In short be able to manage
oles through a GUI. (This question is totally optional)
Copy your functions (code) to a file along with screenshots of your output and what not
and upload to blackboard.
Answered Same Day Nov 28, 2021

Solution

Sanghamitra answered on Dec 04 2021
141 Votes
UserManage
.DS_Store
UserManage
.git/COMMIT_EDITMSG
login changes
UserManage
.git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "StudyA
oadFair"]
    url = https:
[email protected]/Praviin/studya
oadfair.git
    fetch = +refs/heads/*:refs
emotes/StudyA
oadFai
*
UserManage
.git/FETCH_HEAD
3537037324109ce63
c7bdcc530db6a40af68db    not-for-merge    
anch 'development' of https:
itbucket.org/Praviin/studya
oadfai
3537037324109ce63
c7bdcc530db6a40af68db    not-for-merge    
anch 'master' of https:
itbucket.org/Praviin/studya
oadfai
e7f12d88bd3f03e0e7e878d9a641ce561b55ee4b    not-for-merge    
anch 'rc-01-18-18.1' of https:
itbucket.org/Praviin/studya
oadfai
603bc66e81441c99aa21d24f34191db851dcf892    not-for-merge    
anch 'rc-07-26-18.1' of https:
itbucket.org/Praviin/studya
oadfai
90366cfd6bd9f0d056675e32445eaa6ab91d7d9c    not-for-merge    
anch 'rc-08-01-18.1' of https:
itbucket.org/Praviin/studya
oadfai
d89a1e54809139db7387657044630c77808b5ad4    not-for-merge    
anch 'rc-08-02-18.1' of https:
itbucket.org/Praviin/studya
oadfai
fec4aa6538cdd8258254d6a8e8f8d28ccfcbfc8c    not-for-merge    
anch 'rc-08-14-19.1' of https:
itbucket.org/Praviin/studya
oadfai
c1874d7fd2315bf741cda22277bf4df4029b883    not-for-merge    
anch 'rc-08-15-18.1' of https:
itbucket.org/Praviin/studya
oadfai
2391d244bfc4760d4a712b294dcfd3b0fb375d29    not-for-merge    
anch 'rc-10-18-18.1' of https:
itbucket.org/Praviin/studya
oadfai
3537037324109ce63
c7bdcc530db6a40af68db    not-for-merge    
anch 'rc-12-19-19.1' of https:
itbucket.org/Praviin/studya
oadfai
UserManage
.git/HEAD
ef: refs/heads/maste
UserManage
.git/index
UserManage
.git/logs/HEAD
0000000000000000000000000000000000000000 3f54ee97e3396b4d52b593f22f10313cf884ec0d Praviin M 1491237353 -0400    commit (initial): Updated Code + echo`d passwords for explanation
3f54ee97e3396b4d52b593f22f10313cf884ec0d 3f54ee97e3396b4d52b593f22f10313cf884ec0d Praviin M 1491237364 -0400    checkout: moving from master to development
3f54ee97e3396b4d52b593f22f10313cf884ec0d 3f54ee97e3396b4d52b593f22f10313cf884ec0d Praviin M 1509460350 -0400    checkout: moving from development to clean-up
3f54ee97e3396b4d52b593f22f10313cf884ec0d d9e1c5f0ac79a1dc9523c1f6cf730d707b7cc89d Praviin M 1509462987 -0400    commit: Code cleanedup -- indented and also place header.php wherever necessary.
d9e1c5f0ac79a1dc9523c1f6cf730d707b7cc89d 3f54ee97e3396b4d52b593f22f10313cf884ec0d Praviin M 1509462991 -0400    checkout: moving from clean-up to development
3f54ee97e3396b4d52b593f22f10313cf884ec0d d9e1c5f0ac79a1dc9523c1f6cf730d707b7cc89d Praviin M 1509462997 -0400    merge clean-up: Fast-forward
d9e1c5f0ac79a1dc9523c1f6cf730d707b7cc89d d9e1c5f0ac79a1dc9523c1f6cf730d707b7cc89d Praviin M 1509465859 -0400    checkout: moving from development to clean-up
d9e1c5f0ac79a1dc9523c1f6cf730d707b7cc89d 74d9e7399d06c5e906992094cac7c9f34f2b32a3 Praviin M 1509720119 -0400    commit: added some stuff
74d9e7399d06c5e906992094cac7c9f34f2b32a3 d9e1c5f0ac79a1dc9523c1f6cf730d707b7cc89d Praviin M 1509720123 -0400    checkout: moving from clean-up to development
d9e1c5f0ac79a1dc9523c1f6cf730d707b7cc89d 74d9e7399d06c5e906992094cac7c9f34f2b32a3 Praviin M 1509720131 -0400    checkout: moving from development to clean-up
74d9e7399d06c5e906992094cac7c9f34f2b32a3 e67f1190c8d83ae1344ff10be5b9affbf22485f5 Praviin M 1509720200 -0400    commit: database update
e67f1190c8d83ae1344ff10be5b9affbf22485f5 d9e1c5f0ac79a1dc9523c1f6cf730d707b7cc89d Praviin M 1509720203 -0400    checkout: moving from clean-up to development
d9e1c5f0ac79a1dc9523c1f6cf730d707b7cc89d e67f1190c8d83ae1344ff10be5b9affbf22485f5 Praviin M 1509720208 -0400    merge clean-up: Fast-forward
e67f1190c8d83ae1344ff10be5b9affbf22485f5 e67f1190c8d83ae1344ff10be5b9affbf22485f5 Praviin M 1553789223 -0400    reset: moving to HEAD
e67f1190c8d83ae1344ff10be5b9affbf22485f5 e67f1190c8d83ae1344ff10be5b9affbf22485f5 Praviin M 1553789252 -0400    checkout: moving from development to CodeCleanUp
e67f1190c8d83ae1344ff10be5b9affbf22485f5 cd0b263932ba0dfbe2463653313c2429839ab340 Praviin M 1599055446 -0400    commit: code commit
cd0b263932ba0dfbe2463653313c2429839ab340 e67f1190c8d83ae1344ff10be5b9affbf22485f5 Praviin M 1599055455 -0400    checkout: moving from CodeCleanUp to development
e67f1190c8d83ae1344ff10be5b9affbf22485f5 e67f1190c8d83ae1344ff10be5b9affbf22485f5 Praviin M 1599055481 -0400    checkout: moving from development to class-demo
e67f1190c8d83ae1344ff10be5b9affbf22485f5 e67f1190c8d83ae1344ff10be5b9affbf22485f5 Praviin M 1600960832 -0400    reset: moving to HEAD
e67f1190c8d83ae1344ff10be5b9affbf22485f5 e67f1190c8d83ae1344ff10be5b9affbf22485f5 Praviin M 1600960939 -0400    checkout: moving from class-demo to dev_new
e67f1190c8d83ae1344ff10be5b9affbf22485f5 50b86c7fa215124f3245d5a39f51d675579f6168 Praviin M 1600961012 -0400    commit: devdelete
50b86c7fa215124f3245d5a39f51d675579f6168 50b86c7fa215124f3245d5a39f51d675579f6168 Praviin M 1600961023 -0400    checkout: moving from dev_new to master1
50b86c7fa215124f3245d5a39f51d675579f6168 50b86c7fa215124f3245d5a39f51d675579f6168 Praviin M 1600961114 -0400    checkout: moving from master1 to login
50b86c7fa215124f3245d5a39f51d675579f6168 68a62af1b407346924bd44f191acce7864f68e4d Praviin M 1600961256 -0400    commit: login page start
68a62af1b407346924bd44f191acce7864f68e4d 50b86c7fa215124f3245d5a39f51d675579f6168 Praviin M 1600961330 -0400    checkout: moving from login to master1
50b86c7fa215124f3245d5a39f51d675579f6168 50b86c7fa215124f3245d5a39f51d675579f6168 Praviin M 1600961391 -0400    checkout: moving from master1 to registe
50b86c7fa215124f3245d5a39f51d675579f6168 34846b22f14b68d30f8f5ff072a00a28466c6c08 Praviin M 1600961486 -0400    commit: registtration page
34846b22f14b68d30f8f5ff072a00a28466c6c08 50b86c7fa215124f3245d5a39f51d675579f6168 Praviin M 1600961521 -0400    checkout: moving from register to master1
50b86c7fa215124f3245d5a39f51d675579f6168 68a62af1b407346924bd44f191acce7864f68e4d Praviin M 1600961536 -0400    checkout: moving from master1 to login
68a62af1b407346924bd44f191acce7864f68e4d e2d2f5c5b37ff3fd5d6d0b350de6e29449069d4a Praviin M 1600961572 -0400    commit: login changes
e2d2f5c5b37ff3fd5d6d0b350de6e29449069d4a 34846b22f14b68d30f8f5ff072a00a28466c6c08 Praviin M 1600961577 -0400    checkout: moving from login to registe
34846b22f14b68d30f8f5ff072a00a28466c6c08 50b86c7fa215124f3245d5a39f51d675579f6168 Praviin M 1600961615 -0400    checkout: moving from register to master1
50b86c7fa215124f3245d5a39f51d675579f6168 e2d2f5c5b37ff3fd5d6d0b350de6e29449069d4a Praviin M 1600961621 -0400    merge login: Fast-forward
e2d2f5c5b37ff3fd5d6d0b350de6e29449069d4a d7f73808e596471f2602124d1862b33548bdb416 Praviin M 1600961630 -0400    merge register: Merge made by the 'recursive' strategy.
d7f73808e596471f2602124d1862b33548bdb416 d7f73808e596471f2602124d1862b33548bdb416 Praviin M 1603978215 -0400    reset: moving to HEAD
d7f73808e596471f2602124d1862b33548bdb416 3f54ee97e3396b4d52b593f22f10313cf884ec0d Praviin M 1603978226 -0400    checkout: moving from master1 to maste
UserManage
.git/logs
efs/heads/class-demo
0000000000000000000000000000000000000000 e67f1190c8d83ae1344ff10be5b9affbf22485f5 Praviin M 1599055481 -0400    
anch: Created from development
UserManage
.git/logs
efs/heads/CodeCleanUp
0000000000000000000000000000000000000000 e67f1190c8d83ae1344ff10be5b9affbf22485f5 Praviin M 1553789252 -0400    
anch: Created from development
e67f1190c8d83ae1344ff10be5b9affbf22485f5 cd0b263932ba0dfbe2463653313c2429839ab340 Praviin M 1599055446 -0400    commit: code commit
UserManage
.git/logs
efs/heads/development
0000000000000000000000000000000000000000 3f54ee97e3396b4d52b593f22f10313cf884ec0d Praviin M 1491237364 -0400    
anch: Created from maste
3f54ee97e3396b4d52b593f22f10313cf884ec0d d9e1c5f0ac79a1dc9523c1f6cf730d707b7cc89d Praviin M 1509462997 -0400    merge clean-up: Fast-forward
d9e1c5f0ac79a1dc9523c1f6cf730d707b7cc89d e67f1190c8d83ae1344ff10be5b9affbf22485f5 Praviin M 1509720208 -0400    merge clean-up: Fast-forward
UserManage
.git/logs
efs/heads/dev_new
0000000000000000000000000000000000000000 e67f1190c8d83ae1344ff10be5b9affbf22485f5 Praviin M 1600960939 -0400    
anch: Created from class-demo
e67f1190c8d83ae1344ff10be5b9affbf22485f5 50b86c7fa215124f3245d5a39f51d675579f6168 Praviin M 1600961012 -0400    commit: devdelete
UserManage
.git/logs
efs/heads/login
0000000000000000000000000000000000000000 50b86c7fa215124f3245d5a39f51d675579f6168 Praviin M 1600961114 -0400    
anch: Created from master1
50b86c7fa215124f3245d5a39f51d675579f6168 68a62af1b407346924bd44f191acce7864f68e4d Praviin M 1600961256 -0400    commit: login page start
68a62af1b407346924bd44f191acce7864f68e4d e2d2f5c5b37ff3fd5d6d0b350de6e29449069d4a Praviin M 1600961572 -0400    commit: login changes
UserManage
.git/logs
efs/heads/maste
0000000000000000000000000000000000000000 3f54ee97e3396b4d52b593f22f10313cf884ec0d Praviin M 1491237353 -0400    commit (initial): Updated Code + echo`d passwords for explanation
UserManage
.git/logs
efs/heads/master1
0000000000000000000000000000000000000000 50b86c7fa215124f3245d5a39f51d675579f6168 Praviin M 1600961023 -0400    
anch: Created from dev_new
50b86c7fa215124f3245d5a39f51d675579f6168 e2d2f5c5b37ff3fd5d6d0b350de6e29449069d4a Praviin M 1600961621 -0400    merge login: Fast-forward
e2d2f5c5b37ff3fd5d6d0b350de6e29449069d4a d7f73808e596471f2602124d1862b33548bdb416 Praviin M 1600961630 -0400    merge register: Merge made by the 'recursive' strategy.
UserManage
.git/logs
efs/heads
egiste
0000000000000000000000000000000000000000 50b86c7fa215124f3245d5a39f51d675579f6168 Praviin M 1600961391 -0400    
anch: Created from master1
50b86c7fa215124f3245d5a39f51d675579f6168 34846b22f14b68d30f8f5ff072a00a28466c6c08 Praviin M 1600961486 -0400    commit: registtration page
UserManage
.git/logs
efs
emotes/StudyA
oadFai
development
0000000000000000000000000000000000000000 3537037324109ce63
c7bdcc530db6a40af68db Praviin M 1600968832 -0400    fetch StudyA
oadFair: storing head
UserManage
.git/logs
efs
emotes/StudyA
oadFai
maste
0000000000000000000000000000000000000000 3537037324109ce63
c7bdcc530db6a40af68db Praviin M 1600968832 -0400    fetch StudyA
oadFair: storing head
UserManage
.git/logs
efs
emotes/StudyA
oadFai
c-01-18-18.1
0000000000000000000000000000000000000000 e7f12d88bd3f03e0e7e878d9a641ce561b55ee4b Praviin M 1600968832 -0400    fetch StudyA
oadFair: storing head
UserManage
.git/logs
efs
emotes/StudyA
oadFai
c-07-26-18.1
0000000000000000000000000000000000000000 603bc66e81441c99aa21d24f34191db851dcf892 Praviin M 1600968832 -0400    fetch StudyA
oadFair: storing head
UserManage
.git/logs
efs
emotes/StudyA
oadFai
c-08-01-18.1
0000000000000000000000000000000000000000 90366cfd6bd9f0d056675e32445eaa6ab91d7d9c Praviin M 1600968832 -0400    fetch StudyA
oadFair: storing head
UserManage
.git/logs
efs
emotes/StudyA
oadFai
c-08-02-18.1
0000000000000000000000000000000000000000 d89a1e54809139db7387657044630c77808b5ad4 Praviin M 1600968832 -0400    fetch StudyA
oadFair: storing head
UserManage
.git/logs
efs
emotes/StudyA
oadFai
c-08-14-19.1
0000000000000000000000000000000000000000 fec4aa6538cdd8258254d6a8e8f8d28ccfcbfc8c Praviin M 1600968832 -0400    fetch StudyA
oadFair: storing head
UserManage
.git/logs
efs
emotes/StudyA
oadFai
c-08-15-18.1
0000000000000000000000000000000000000000 bc1874d7fd2315bf741cda22277bf4df4029b883 Praviin M 1600968832 -0400    fetch StudyA
oadFair: storing head
UserManage
.git/logs
efs
emotes/StudyA
oadFai
c-10-18-18.1
0000000000000000000000000000000000000000 2391d244bfc4760d4a712b294dcfd3b0fb375d29 Praviin M 1600968832 -0400    fetch StudyA
oadFair: storing head
UserManage
.git/logs
efs
emotes/StudyA
oadFai
c-12-19-19.1
0000000000000000000000000000000000000000 3537037324109ce63
c7bdcc530db6a40af68db Praviin M 1600968832 -0400    fetch StudyA
oadFair: storing head
UserManage
.git/objects/0d/a2a8f410bed23e349701adc7c8d33788ba237
UserManage
.git/objects/0d/a2a8f410bed23e349701adc7c8d33788ba237
lob 96�?
label>username
label
input type="text" name="username"
h4>LOGIN PAGE START
h4
UserManage
.git/objects/1d/cdc65647d80acd7727bed68792b179d6263a8a
UserManage
.git/objects/1d/cdc65647d80acd7727bed68792b179d6263a8a
lob 3645�equire_once("config.php");
Prevent the user visiting the logged in page if he/she is already logged in
if (isUserLoggedIn()) {
header("Location: myaccount.php");
die();
}
print_r($_POST);
Forms posted
if (!empty($_POST)) {
$e
ors = a
ay();
$email = trim($_POST["email"]);
$username = trim($_POST["username"]);
$firstname = trim($_POST["firstname"]);
$lastname = trim($_POST["lastname"]);
$password = trim($_POST["password"]);
$confirm_pass = trim($_POST["passwordc"]);
if ($username == "") {
$e
ors[] = "enter valid username";
}
if ($firstname == "") {
$e
ors[] = "enter valid first name";
}
if ($lastname == "") {
$e
ors[] = "enter valid last name";
}
if ($password == "") {
$e
ors[] = "enter valid password";
}
if ($confirm_pass == "") {
$e
ors[] = "enter valid password";
}
if ($email == "") {
$e
ors[] = "enter valid email address";
}
if ($password == "" && $confirm_pass == "") {
$e
ors[] = "enter password";
} else if ($password != $confirm_pass) {
$e
ors[] = "password do not match";
}

End data validation
if (count($e
ors) == 0) {
$user = createNewUser($username, $firstname, $lastname, $email, $password);
print_r($user);
if ($user
1) {
$e
ors[] = "registration e
or";
}
}
if (count($e
ors) == 0) {
$successes[] = "registration successful";
}
}
equire_once("header.php");
?

ody

Registe
h2

div
ors); ?

pre
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here