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
3f5a8a8c
Commit
3f5a8a8c
authored
4 years ago
by
raphael.peim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish backend tp4
parent
3f469b49
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
45 additions
and
61 deletions
+45
-61
Response.class.php
Classes/BackEnd/tp4/classes/Response.class.php
+5
-0
UserController.class.php
Classes/BackEnd/tp4/controller/UserController.class.php
+16
-27
game.php
Project/FrontEnd/game.php
+1
-5
gameCreate.php
Project/FrontEnd/gameCreate.php
+1
-5
gameJoin.php
Project/FrontEnd/gameJoin.php
+1
-5
head.php
Project/FrontEnd/head.php
+4
-0
index.php
Project/FrontEnd/index.php
+2
-5
infos.php
Project/FrontEnd/infos.php
+3
-0
js.php
Project/FrontEnd/js.php
+7
-0
signup.js
Project/FrontEnd/js/signup.js
+1
-0
login.php
Project/FrontEnd/login.php
+2
-5
rules.php
Project/FrontEnd/rules.php
+1
-5
signup.php
Project/FrontEnd/signup.php
+1
-4
No files found.
Classes/BackEnd/tp4/classes/Response.class.php
View file @
3f5a8a8c
...
...
@@ -22,6 +22,11 @@
return
new
Response
(
400
,
$message
);
}
public
static
function
unauthorizedResponse
(
$message
=
""
)
{
return
new
Response
(
401
,
$message
);
}
public
static
function
notFoundResponse
(
$message
=
""
)
{
return
new
Response
(
404
,
$message
);
...
...
This diff is collapsed.
Click to expand it.
Classes/BackEnd/tp4/controller/UserController.class.php
View file @
3f5a8a8c
...
...
@@ -74,33 +74,22 @@
protected
function
updateUser
(
$put
,
$id
)
{
$user
=
User
::
getWithId
(
$id
);
// var_dump(Request::getCurrentRequest());
// if (!empty($put) && !empty($user)) {
// try {
// $jwt_token = $this->request->getJwtToken();
// $decodedJWT = JWT::decode($jwt_token, JWT_BACKEND_KEY, array('HS256'));
// var_dump($decodedJWT->data);
// }
// catch (Exception $e){
// header('WWW-Authenticate: Bearer realm="' . JWT_ISSUER . '"');
// $jsonResult = json_encode(array(
// "message" => "Access denied.",
// "error" => $e->getMessage()
// ));
// return Response::unauthorizedResponse($jsonResult);
// }
// }
// else {
// return Response::notFoundResponse("Aucun utilisateur modifié");
// }
// User::update($put, $id);
// $response = Response::okResponse("Utilisateur modifié");
// return $response;
if
(
!
empty
(
$put
)
&&
!
empty
(
$user
))
{
$jwt_token
=
$this
->
request
->
getJwtToken
();
$jwt
=
JWT
::
decode
(
$jwt_token
,
JWT_BACKEND_KEY
,
array
(
'HS256'
));
if
(
$jwt
->
data
->
id
==
$id
)
{
User
::
update
(
$put
,
$id
);
$response
=
Response
::
okResponse
(
"Utilisateur modifié"
);
return
$response
;
}
else
{
return
Response
::
unauthorizedResponse
(
"Modification non autorisée"
);
}
}
else
{
return
Response
::
notFoundResponse
(
"Aucun utilisateur modifié"
);
}
}
protected
function
deleteUser
(
$id
)
{
...
...
This diff is collapsed.
Click to expand it.
Project/FrontEnd/game.php
View file @
3f5a8a8c
...
...
@@ -32,10 +32,6 @@
<i
class=
"fas fa-angle-up"
></i>
</a>
<script
src=
"vendor/jquery/jquery.js"
></script>
<script
src=
"vendor/bootstrap/js/bootstrap.bundle.js"
></script>
<script
src=
"vendor/jquery-easing/jquery.easing.js"
></script>
<script
src=
"js/sb-admin-2.js"
></script>
<script
src=
"vendor/chart.js/Chart.js"
></script>
<?php
require_once
(
'js.php'
);
?>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Project/FrontEnd/gameCreate.php
View file @
3f5a8a8c
...
...
@@ -46,10 +46,6 @@
<i
class=
"fas fa-angle-up"
></i>
</a>
<script
src=
"vendor/jquery/jquery.js"
></script>
<script
src=
"vendor/bootstrap/js/bootstrap.bundle.js"
></script>
<script
src=
"vendor/jquery-easing/jquery.easing.js"
></script>
<script
src=
"js/sb-admin-2.js"
></script>
<script
src=
"vendor/chart.js/Chart.js"
></script>
<?php
require_once
(
'js.php'
);
?>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Project/FrontEnd/gameJoin.php
View file @
3f5a8a8c
...
...
@@ -53,10 +53,6 @@
<i
class=
"fas fa-angle-up"
></i>
</a>
<script
src=
"vendor/jquery/jquery.js"
></script>
<script
src=
"vendor/bootstrap/js/bootstrap.bundle.js"
></script>
<script
src=
"vendor/jquery-easing/jquery.easing.js"
></script>
<script
src=
"js/sb-admin-2.js"
></script>
<script
src=
"vendor/chart.js/Chart.js"
></script>
<?php
require_once
(
'js.php'
);
?>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Project/FrontEnd/head.php
View file @
3f5a8a8c
<?php
$page
=
explode
(
'.php'
,
end
(
explode
(
'/'
,
$_SERVER
[
'REQUEST_URI'
])))[
0
];
$page
=
$page
==
""
?
"index"
:
$page
;
?>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
...
...
This diff is collapsed.
Click to expand it.
Project/FrontEnd/index.php
View file @
3f5a8a8c
...
...
@@ -25,6 +25,7 @@
<span
class=
"icon text-white-50"
>
<i
class=
"fas fa-book-open"
></i>
</span>
<!-- <span class="text">Découvrez le mahjong</span> -->
<span
class=
"text"
>
Découvrez le mahjong
</span>
</a>
<a
href=
"login.php"
class=
"btn btn-primary btn-icon-split btn-lg"
style=
"display: flex;"
>
...
...
@@ -43,10 +44,6 @@
<i
class=
"fas fa-angle-up"
></i>
</a>
<script
src=
"vendor/jquery/jquery.js"
></script>
<script
src=
"vendor/bootstrap/js/bootstrap.bundle.js"
></script>
<script
src=
"vendor/jquery-easing/jquery.easing.js"
></script>
<script
src=
"js/sb-admin-2.js"
></script>
<script
src=
"vendor/chart.js/Chart.js"
></script>
<?php
require_once
(
'js.php'
);
?>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Project/FrontEnd/infos.php
0 → 100644
View file @
3f5a8a8c
<?php
phpinfo
();
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Project/FrontEnd/js.php
0 → 100644
View file @
3f5a8a8c
<script
src=
"vendor/jquery/jquery.js"
></script>
<script
src=
"vendor/bootstrap/js/bootstrap.bundle.js"
></script>
<script
src=
"vendor/jquery-easing/jquery.easing.js"
></script>
<script
src=
"js/sb-admin-2.js"
></script>
<script
src=
"vendor/chart.js/Chart.js"
></script>
<script
<?php
echo
"src=
\"
js/
$page
.js
\"
"
?>
></script>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Project/FrontEnd/js/signup.js
0 → 100644
View file @
3f5a8a8c
console
.
log
(
"Hey !"
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Project/FrontEnd/login.php
View file @
3f5a8a8c
...
...
@@ -30,7 +30,7 @@
<hr>
</form>
<div
class=
"text-center"
>
<a
class=
"small"
href=
"
register
.php"
>
Créer un compte
</a>
<a
class=
"small"
href=
"
signup
.php"
>
Créer un compte
</a>
</div>
</div>
</div>
...
...
@@ -41,9 +41,6 @@
</div>
</div>
<script
src=
"vendor/jquery/jquery.js"
></script>
<script
src=
"vendor/bootstrap/js/bootstrap.bundle.js"
></script>
<script
src=
"vendor/jquery-easing/jquery.easing.js"
></script>
<script
src=
"js/sb-admin-2.js"
></script>
<?php
require_once
(
'js.php'
);
?>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Project/FrontEnd/rules.php
View file @
3f5a8a8c
...
...
@@ -32,10 +32,6 @@
<i
class=
"fas fa-angle-up"
></i>
</a>
<script
src=
"vendor/jquery/jquery.js"
></script>
<script
src=
"vendor/bootstrap/js/bootstrap.bundle.js"
></script>
<script
src=
"vendor/jquery-easing/jquery.easing.js"
></script>
<script
src=
"js/sb-admin-2.js"
></script>
<script
src=
"vendor/chart.js/Chart.js"
></script>
<?php
require_once
(
'js.php'
);
?>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Project/FrontEnd/
register
.php
→
Project/FrontEnd/
signup
.php
View file @
3f5a8a8c
...
...
@@ -53,9 +53,6 @@
</div>
</div>
<script
src=
"vendor/jquery/jquery.js"
></script>
<script
src=
"vendor/bootstrap/js/bootstrap.bundle.js"
></script>
<script
src=
"vendor/jquery-easing/jquery.easing.js"
></script>
<script
src=
"js/sb-admin-2.js"
></script>
<?php
require_once
(
'js.php'
);
?>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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