Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
PAD2016IRP04
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Stijn Holzhauer
PAD2016IRP04
Commits
e8b41d81
Commit
e8b41d81
authored
Jun 13, 2016
by
S.Holzhauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kwoksmagic?
parent
797760a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
0 deletions
+86
-0
check_input.php
WebContent/watchdad/modules/Leefpatroon/check_input.php
+86
-0
No files found.
WebContent/watchdad/modules/Leefpatroon/check_input.php
View file @
e8b41d81
...
...
@@ -66,6 +66,92 @@ if (checkSet($inputFieldsCount, $inputFields) != FALSE) {
// check the POST variable activiteit is correct and not empty
if
(
empty
(
$_POST
[
'activiteit'
])
==
FALSE
&&
sanityCheck
(
$_POST
[
'activiteit'
],
'string'
,
80
)
!=
FALSE
)
{
// checks if the post variable getActivityID is not false
if
(
empty
(
$_POST
[
'getActivityID'
])
==
FALSE
)
{
if
(
checkSet
(
$inputFieldsCount
,
$inputFields
)
!=
FALSE
)
{
$activityID
=
$_POST
[
'getActivityID'
];
if
(
empty
(
$_POST
[
'activiteit'
])
==
FALSE
&&
sanityCheck
(
$_POST
[
'activiteit'
],
'string'
,
80
)
!=
FALSE
)
{
$activity
=
$_POST
[
'activiteit'
];
}
else
{
$errors
++
;
echo
'<p '
.
$redTextError
.
'>Ongeldige invoer bij Activiteit</p>'
;
}
// check the POST variable begintijd is correct and not empty
if
(
empty
(
$_POST
[
'begintijd'
])
==
FALSE
&&
isRealTime
(
$_POST
[
'begintijd'
])
!=
FALSE
)
{
$startTime
=
$_POST
[
'begintijd'
];
}
else
{
$errors
++
;
echo
'<p '
.
$redTextError
.
'>Ongeldige invoer bij Begintijd</p>'
;
}
// check the POST variable eindtijd is correct and not empty
if
(
empty
(
$_POST
[
'eindtijd'
])
==
FALSE
&&
isRealTime
(
$_POST
[
'eindtijd'
])
!=
FALSE
)
{
$endTime
=
$_POST
[
'eindtijd'
];
}
else
{
$errors
++
;
echo
'<p '
.
$redTextError
.
'>Ongeldige invoer bij Eindtijd</p>'
;
}
// check if begintijd and eindtijd are both not empty and have the same values
if
(
$_POST
[
'begintijd'
]
==
$_POST
[
'eindtijd'
]
&&
$_POST
[
'begintijd'
]
!=
""
&&
$_POST
[
'eindtijd'
]
!=
""
)
{
$errors
++
;
echo
'<p '
.
$redTextError
.
'>Begintijd en Eindtijd mogen niet overeenkomen</p>'
;
}
// check if beweging_opties is selected
if
(
$_POST
[
'beweging_opties'
]
==
0
||
$_POST
[
'beweging_opties'
]
==
1
)
{
$movement
=
$_POST
[
'beweging_opties'
];
}
else
{
$errors
++
;
echo
'<p '
.
$redTextError
.
'>Ongeldige selectie bij Beweging Waarnemen</p>'
;
}
// check the POST variable Comment is correct
if
(
strlen
(
$_POST
[
'opmerking'
])
<
80
)
{
$comment
=
$_POST
[
'opmerking'
];
}
else
{
$comment
=
''
;
echo
'<p '
.
$redTextError
.
'>Uw opmerking bevat '
.
strlen
(
$_POST
[
'opmerking'
])
.
' karakters</p>'
;
echo
'<p '
.
$redTextError
.
'>Het maximaal aantal karakters is 80.</p>'
;
}
// check if it has 1 or more errors, if so run exit()
if
(
$errors
>=
1
)
{
$errors
=
0
;
exit
();
}
if
(
mysqli_connect_errno
())
{
echo
"<p ' .
$dbTextError
. '>Failed to connect to MySQL: "
.
mysqli_connect_error
()
.
".</p>"
;
echo
$systemError
;
exit
();
}
// Sql query to insert and check each variable with mysqli_real_escape_string()
$sql
=
sprintf
(
"UPDATE Leefpatroon
SET ActivityID = '%s', StartTime = '%s', EndTime = '%s', Activity = '%s', Movement = '%s', Day = '%s', Comment = '%s', OuderID = '%s'
WHERE "
.
$activityID
.
" = ActivityID "
,
mysqli_real_escape_string
(
$conn
,
$activityID
),
mysqli_real_escape_string
(
$conn
,
$startTime
),
mysqli_real_escape_string
(
$conn
,
$endTime
),
mysqli_real_escape_string
(
$conn
,
$activity
),
mysqli_real_escape_string
(
$conn
,
$movement
),
mysqli_real_escape_string
(
$conn
,
$day
),
mysqli_real_escape_string
(
$conn
,
$comment
),
mysqli_real_escape_string
(
$conn
,
$OuderID
));
// run the query
if
(
!
mysqli_query
(
$conn
,
$sql
))
{
echo
'<p '
.
$dbTextError
.
'>Error: '
.
mysqli_error
(
$conn
)
.
'</p>'
;
echo
$systemError
;
exit
();
}
else
{
echo
'<p '
.
$greenTextSuccess
.
'>Uw gegevens zijn gewijzigd, klik <a href="activiteiten.php">hier</a> om naar activiteiten te gaan.</p>'
;
echo
'<p '
.
$greenTextSuccess
.
'>Klik op de reset knop om de pagina te resetten.</p>'
;
}
mysqli_close
(
$conn
);
}
else
{
...
...
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