Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Projet_idaw
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
Liang Wu
Projet_idaw
Commits
df600147
Commit
df600147
authored
Apr 04, 2020
by
Liang Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
index
parent
f7dbc8e3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
73 deletions
+61
-73
index.php
index.php
+40
-69
signup.php
signup.php
+21
-4
No files found.
index.php
View file @
df600147
...
@@ -4,17 +4,16 @@
...
@@ -4,17 +4,16 @@
</head>
</head>
<body>
<body>
<script
type=
"text/javascript"
>
<main
role=
"main"
class=
"container starter-template"
>
setCookie
(
"jwt"
,
""
,
1
);
function
setCookie
(
cname
,
cvalue
,
exdays
)
{
<div
class=
"row"
>
var
d
=
new
Date
();
<div
class=
"col"
>
d
.
setTime
(
d
.
getTime
()
+
(
exdays
*
24
*
60
*
60
*
1000
));
var
expires
=
"expires="
+
d
.
toUTCString
();
document
.
cookie
=
cname
+
"="
+
cvalue
+
";"
+
expires
+
";path=/"
;
}
</script>
<form
id=
"login_form"
action=
"#"
method=
"POST"
>
<!-- where prompt / messages will appear -->
<div
id=
"response"
></div>
<div>
<form
id=
"login_form"
method=
"POST"
>
<table>
<table>
<tr>
<tr>
<th>
Login :
</th>
<th>
Login :
</th>
...
@@ -32,41 +31,12 @@ function setCookie(cname, cvalue, exdays) {
...
@@ -32,41 +31,12 @@ function setCookie(cname, cvalue, exdays) {
<a
href=
"signup.php"
>
S'inscrire
</a>
<a
href=
"signup.php"
>
S'inscrire
</a>
</tr>
</tr>
</table>
</table>
</form>
</form>
</div>
<script
type=
"text/javascript"
>
// show home page
function
showHomePage
(){
// validate jwt to verify access
var
jwt
=
getCookie
(
'jwt'
);
$
.
post
(
"https://eden.imt-lille-douai.fr/~liang.wu/API_LOGIN/identite/validate_token.php"
,
JSON
.
stringify
({
jwt
:
jwt
})).
done
(
function
(
result
)
{
var
html
=
<
a
href
=
"home.php"
>
;
$
(
'#content'
).
html
(
html
);
})
}
// get or read cookie
function
getCookie
(
cname
){
var
name
=
cname
+
"="
;
var
decodedCookie
=
decodeURIComponent
(
document
.
cookie
);
var
ca
=
decodedCookie
.
split
(
';'
);
for
(
var
i
=
0
;
i
<
ca
.
length
;
i
++
)
{
var
c
=
ca
[
i
];
while
(
c
.
charAt
(
0
)
==
' '
){
c
=
c
.
substring
(
1
);
}
if
(
c
.
indexOf
(
name
)
==
0
)
{
return
c
.
substring
(
name
.
length
,
c
.
length
);
}
}
return
""
;
}
</script>
</div>
</div>
</main>
<script
<script
src=
"https://code.jquery.com/jquery-3.4.1.min.js"
src=
"https://code.jquery.com/jquery-3.4.1.min.js"
...
@@ -75,6 +45,11 @@ function getCookie(cname){
...
@@ -75,6 +45,11 @@ function getCookie(cname){
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/jquery-serialize-object/2.5.0/jquery.serialize-object.min.js"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/jquery-serialize-object/2.5.0/jquery.serialize-object.min.js"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity=
"sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin=
"anonymous"
></script>
<!-- jquery scripts will be here -->
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
// will run if create identite form was submitted
// will run if create identite form was submitted
...
@@ -90,18 +65,14 @@ $(document).ready(function() {
...
@@ -90,18 +65,14 @@ $(document).ready(function() {
contentType
:
'application/json'
,
contentType
:
'application/json'
,
data
:
form_data
,
data
:
form_data
,
success
:
function
(
result
){
success
:
function
(
result
){
// show home page & tell the user it was a successful login
window
.
location
=
"https://eden.imt-lille-douai.fr/~liang.wu/projet_idaw/home.php"
;
showHomePage
();
$
(
'#response'
).
html
(
"<div class='alert alert-success'>Successful login.</div>"
);
},
},
error
:
function
(
xhr
,
resp
,
text
){
error
:
function
(
xhr
,
resp
,
text
){
// on error, tell the user login has failed & empty the input boxes
// on error, tell the user login has failed & empty the input boxes
$
(
'#response'
).
html
(
"<div class='alert alert-danger'>Login failed. Email
or password is incorrect.</div>"
);
$
(
'#response'
).
html
(
"<div class='alert alert-danger'>Login failed. login
or password is incorrect.</div>"
);
login_form
.
find
(
'input'
).
val
(
''
);
login_form
.
find
(
'input'
).
val
(
''
);
}
}
});
});
return
false
;
});
});
});
});
</script>
</script>
...
...
signup.php
View file @
df600147
...
@@ -39,12 +39,29 @@
...
@@ -39,12 +39,29 @@
<div>
<div>
<label>
Sexe
</label>
<label>
Sexe
</label>
<input
type=
'text'
id=
'sexe'
name=
'sexe'
class=
"form-control"
required
/>
<div>
<label>
Homme
<input
type=
"radio"
name=
"sexe"
id=
"M"
>
</label><br>
<label>
Femme
<input
type=
"radio"
name=
"sexe"
id=
"F"
>
</label>
</div>
</div>
</div>
<div>
<div>
<label>
Niveau du sport
</label>
<label>
Niveau de pratique sportive
</label>
<input
type=
'text'
id=
'niveau_du_sport'
name=
'niveau_du_sport'
class=
"form-control"
required
/>
<div>
<label>
Bas
<input
type=
"radio"
name=
"niveau_du_sport"
id=
"bas"
>
</label><br>
<label>
Moyen
<input
type=
"radio"
name=
"niveau_du_sport"
id=
"moyen"
>
</label><br>
<label>
Elevé
<input
type=
"radio"
name=
"niveau_du_sport"
id=
"eleve"
>
</label>
</div>
</div>
</div>
<!-- button to submit form -->
<!-- button to submit form -->
...
...
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