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
ebf09e86
Commit
ebf09e86
authored
Jun 08, 2016
by
S.Holzhauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more magic
parent
a3a58d03
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
11 deletions
+41
-11
load_notifications.php
WebContent/watchdad/modules/backend/load_notifications.php
+3
-3
server.php
WebContent/watchdad/modules/backend/server.php
+38
-8
No files found.
WebContent/watchdad/modules/backend/load_notifications.php
View file @
ebf09e86
...
@@ -6,7 +6,7 @@ function GetNotifications( $status = 0 ){
...
@@ -6,7 +6,7 @@ function GetNotifications( $status = 0 ){
global
$conn
;
global
$conn
;
$AccountID
=
$_SESSION
[
'AccountID'
];
$AccountID
=
$_SESSION
[
'AccountID'
];
$sql
=
"SELECT B.
Message,B.Tim
e
$sql
=
"SELECT B.
Title,B.Time,B.Dat
e
FROM Account_has_Notificatie A
FROM Account_has_Notificatie A
INNER JOIN Notificatie B
INNER JOIN Notificatie B
ON B.NotificationID = A.Notificatie_NotificatieID
ON B.NotificationID = A.Notificatie_NotificatieID
...
@@ -19,8 +19,8 @@ function GetNotifications( $status = 0 ){
...
@@ -19,8 +19,8 @@ function GetNotifications( $status = 0 ){
echo
'
echo
'
<a class="list-group-item" href="#">
<a class="list-group-item" href="#">
<i class="fa fa-bullseye fa-fw"></i>
<i class="fa fa-bullseye fa-fw"></i>
<strong>'
.
$row
[
"
Messag
e"
]
.
'</strong>
<strong>'
.
$row
[
"
Titl
e"
]
.
'</strong>
<span class="pull-right text-muted small"><em>'
.
$row
[
"Time"
]
.
'</em></span>
<span class="pull-right text-muted small"><em>'
.
$row
[
"Time"
]
.
$row
[
'Date'
]
.
'</em></span>
</a>
</a>
'
;
'
;
}
}
...
...
WebContent/watchdad/modules/backend/server.php
View file @
ebf09e86
...
@@ -169,18 +169,48 @@ else if ($ID == "IRPS001"){
...
@@ -169,18 +169,48 @@ else if ($ID == "IRPS001"){
ON A.AccountID = B.Account_AccountID
ON A.AccountID = B.Account_AccountID
WHERE C.OuderID = '
$OuderID
';"
;
WHERE C.OuderID = '
$OuderID
';"
;
$result
=
$conn
->
query
(
$sql
);
$result
=
$conn
->
query
(
$sql
);
$row
=
$result
->
fetch_assoc
()
$Acname
=
$row
[
'A.Voorletters'
]
.
" "
.
$row
[
'A.Achternaam'
];
$Email
=
$row
[
'A.Emailadres'
];
$Oudername
=
$row
[
'C.Voorletters'
]
.
" "
.
$row
[
'C.Achternaam'
];
//set mail features.
$headers
=
'From: <WatchDad@irp.nl>'
;
$Msg
=
"Er zou beweging moeten zijn waargenomen volgens het leefpatroon dit is echter niet gebeurd!
Kijk snel op stienos.nl/watchdad/ om te zien om welke activiteit dit gaat."
;
//Create a notification
$sql
=
"INSERT INTO Notificatie (`Date`,`Time`,`Title`)
VALUES ('
$date
','
$time
','Geen Beweging');"
;
$result
=
$conn
->
query
(
$sql
);
if
(
$result
===
TRUE
)
{
$notificatieID
=
$conn
->
insert_id
;
}
//add thee messaga to berichten in the database
$sql
=
"INSERT INTO Berichten (`Time`,`Message`,`Subject`,`Date`)
VALUES ('
$time
','
$Msg
','Geen beweging','
$date
');"
;
$result
=
$conn
->
query
(
$sql
);
//get the id of inserted message
if
(
$result
===
TRUE
)
{
$berichtID
=
$conn
->
insert_id
;
}
//loop trough every account so they all get an email
//loop trough every account so they all get an email
while
(
$result
&&
(
$row
=
$result
->
fetch_assoc
())){
while
(
$result
&&
(
$row
=
$result
->
fetch_assoc
())){
$Acname
=
$row
[
'A.Voorletters'
]
.
" "
.
$row
[
'A.Achternaam'
];
$Email
=
$row
[
'A.Emailadres'
];
$Oudername
=
$row
[
'C.Voorletters'
]
.
" "
.
$row
[
'C.Achternaam'
];
//set mail features.
$headers
=
'From: <WatchDad@irp.nl>'
;
$Msg
=
"Er zou beweging moeten zijn waargenomen volgens het leefpatroon dit is echter niet gebeurd!
Kijk snel op stienos.nl/watchdad/ om te zien om welke activiteit dit gaat."
;
//send the mail
//send the mail
mail
(
$Email
,
"Camera Alert"
,
"Beste
$AcName
$Msg
"
,
$headers
);
mail
(
$Email
,
"Camera Alert"
,
"Beste
$AcName
$Msg
"
,
$headers
);
//couple the message to appropriate accounts
$sql
=
"INSERT INTO Account_has_Berichten (`Berichten_BerichtID`,`Account_AccountID`,`Status`)
VALUES ('
$berichtID
','
$AccountID
',0);"
;
$conn
->
query
(
$sql
);
//couple notification to appropriate accounts
$sql
=
"INSERT INTO Account_has_Notificatie (`Notificatie_NotificatieID`,`Account_AccountID`)
VALUES ('
$notificatieID
','
$AccountID
');"
;
}
}
}
}
}
}
...
...
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