Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projet-cdaw
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Raphaël PEIM
projet-cdaw
Commits
9d916fbe
Commit
9d916fbe
authored
Nov 13, 2020
by
Raphaël Peim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish backend tp2
parent
6ce27b74
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
11 deletions
+8
-11
UserModel.php
BackEnd/tp2/api/UserModel.php
+6
-9
UsersController.php
BackEnd/tp2/api/UsersController.php
+1
-1
api.php
BackEnd/tp2/api/api.php
+1
-1
Project CDAW - Maquette.mp
UX/Maquettes/Project CDAW - Maquette.mp
+0
-0
No files found.
BackEnd/tp2/api/UserModel.php
View file @
9d916fbe
...
...
@@ -42,15 +42,12 @@
if
(
!
empty
(
$user
))
{
$quest
=
""
;
if
(
isset
(
$post
[
'name'
])
&&
isset
(
$post
[
'email'
]))
$quest
=
"UPDATE `users` SET `name` = '"
.
$post
[
'name'
]
.
"', `email` = '"
.
$post
[
'email'
]
.
"' WHERE `users`.`id` = "
.
$id
;
else
if
(
isset
(
$post
[
'name'
])
&&
!
isset
(
$post
[
'email'
]))
$quest
=
"UPDATE `users` SET `name` = '"
.
$post
[
'name'
]
.
"' WHERE `users`.`id` = "
.
$id
;
else
if
(
!
isset
(
$post
[
'name'
])
&&
isset
(
$post
[
'email'
]))
$quest
=
"UPDATE `users` SET `email` = '"
.
$post
[
'email'
]
.
"' WHERE `users`.`id` = "
.
$id
;
print_r
(
$post
);
echo
"
\n
"
;
if
(
isset
(
$post
->
name
)
&&
isset
(
$post
->
email
))
$quest
=
"UPDATE `users` SET `name` = '"
.
$post
->
name
.
"', `email` = '"
.
$post
->
email
.
"' WHERE `users`.`id` = "
.
$id
;
else
if
(
isset
(
$post
->
name
)
&&
!
isset
(
$post
->
email
))
$quest
=
"UPDATE `users` SET `name` = '"
.
$post
->
name
.
"' WHERE `users`.`id` = "
.
$id
;
else
if
(
!
isset
(
$post
->
name
)
&&
isset
(
$post
->
email
))
$quest
=
"UPDATE `users` SET `email` = '"
.
$post
->
email
.
"' WHERE `users`.`id` = "
.
$id
;
if
(
$quest
!=
""
)
{
$request
=
DatabaseConnector
::
current
()
->
prepare
(
$quest
);
...
...
BackEnd/tp2/api/UsersController.php
View file @
9d916fbe
...
...
@@ -18,7 +18,7 @@
$response
=
$this
->
createUser
(
$post
);
break
;
case
'PUT'
:
$response
=
$this
->
updateUser
(
$post
,
$id
);
$response
=
$this
->
updateUser
(
json_decode
(
$post
)
,
$id
);
break
;
case
'DELETE'
:
$response
=
$this
->
deleteUser
(
$id
);
...
...
BackEnd/tp2/api/api.php
View file @
9d916fbe
...
...
@@ -47,7 +47,7 @@
break
;
case
'user'
:
$controller
=
new
UsersController
(
$requestMethod
);
$controller
->
processRequest
(
f
open
(
"php://input"
,
"r
"
),
$route
[
'params'
][
0
]);
$controller
->
processRequest
(
f
ile_get_contents
(
"php://input
"
),
$route
[
'params'
][
0
]);
break
;
default
:
header
(
"HTTP/1.1 404 Not Found"
);
...
...
UX/Maquettes/Project CDAW - Maquette.mp
0 → 100644
View file @
9d916fbe
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment