Commit cfbd6ae3 authored by S.Holzhauer's avatar S.Holzhauer

le fix

parent dc824891
......@@ -61,67 +61,67 @@ if ($ID == "IRPS001" ){
$result = $conn->query($sql);
if ($result === TRUE) {
$last_id = $conn->insert_id;
}
//see what accounts are connected to this elder.
$sql = "SELECT Account_AccountID FROM Account_has_AlleenstaandeOuder WHERE AlleenstaandeOuder_OuderID='$OuderID'";
$result = $conn->query($sql);
if ($result->num_rows > 0){
while($result && ($row = $result->fetch_assoc()))
{
$AccountID=$row["Account_AccountID"];
//Get the email adres connected to the account
$sql = "SELECT Emailadres FROM Account WHERE AccountID='$AccountID'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
$row = $result->fetch_assoc();
//Binding the return value to $Email
$Email=$row["Emailadres"];
} else {
echo "0 results";
}
//Get the Name connected to the account
$sql = "SELECT Voorletters,Achternaam FROM Account WHERE AccountID='$AccountID'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
$row = $result->fetch_assoc();
//Binding the return to $AcName
$AcName=$row["Voorletters"] . " " . $row["Achternaam"];
} else {
echo "0 results";
}
//Connect the previous made notification to the appropriat accounts
$sql = "INSERT INTO Account_has_Notificatie (Notificatie_NotificatieID,Account_AccountID,Status)
VALUES ('$last_id','$AccountID',0)";
$result = $conn->query($sql);
//see what accounts are connected to this elder.
$sql = "SELECT Account_AccountID FROM Account_has_AlleenstaandeOuder WHERE AlleenstaandeOuder_OuderID='$OuderID'";
$result = $conn->query($sql);
if ($result->num_rows > 0){
while($result && ($row = $result->fetch_assoc()))
{
$AccountID=$row["Account_AccountID"];
//see how many notifications an account already has.
$sql = "SELECT *
FROM Account_has_Notificatie
WHERE Account_AccountID = $AccountID;";
$result = $conn->query($sql);
//if there are more then 1 notifications this means that multiple activities have failed and thus a email is send.
if ($result->num_rows > 1){
$sql = "INSERT INTO Berichten (Time,Message,Subject,Date)
VALUES ('$time','$message','Second Failed Activity','$date')";
//Get the email adres connected to the account
$sql = "SELECT Emailadres FROM Account WHERE AccountID='$AccountID'";
$result = $conn->query($sql);
if ($result === TRUE) {
$last_id = $conn->insert_id;
if ($result->num_rows > 0) {
// output data of each row
$row = $result->fetch_assoc();
//Binding the return value to $Email
$Email=$row["Emailadres"];
} else {
echo "0 results";
}
//sending the mail, $Email is initialized previously, $Msg is created above & $headers changes the sender information to irp@stienos.nl.
$headers = 'From: <activityalert@irp.nl>';
mail($Email,"Camera Alert","Beste $AcName $message",$headers);
//Get the Name connected to the account
$sql = "SELECT Voorletters,Achternaam FROM Account WHERE AccountID='$AccountID'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
$row = $result->fetch_assoc();
//Binding the return to $AcName
$AcName=$row["Voorletters"] . " " . $row["Achternaam"];
} else {
echo "0 results";
}
//Connect the previous made notification to the appropriat accounts
$sql = "INSERT INTO Account_has_Notificatie (Notificatie_NotificatieID,Account_AccountID,Status)
VALUES ('$last_id','$AccountID',0)";
$result = $conn->query($sql);
$sql = "INSERT INTO Account_has_Berichten (Berichten_BerichtID,Account_AccountID,Status)
VALUES ($last_id,$AccountID,0";
$conn-query($sql);
//see how many notifications an account already has.
$sql = "SELECT *
FROM Account_has_Notificatie
WHERE Account_AccountID = $AccountID;";
$result = $conn->query($sql);
//if there are more then 1 notifications this means that multiple activities have failed and thus a email is send.
if ($result->num_rows > 1){
$sql = "INSERT INTO Berichten (Time,Message,Subject,Date)
VALUES ('$time','$message','Second Failed Activity','$date')";
$result = $conn->query($sql);
if ($result === TRUE) {
$last_id = $conn->insert_id;
}
//sending the mail, $Email is initialized previously, $Msg is created above & $headers changes the sender information to irp@stienos.nl.
$headers = 'From: <activityalert@irp.nl>';
mail($Email,"Camera Alert","Beste $AcName $message",$headers);
$sql = "INSERT INTO Account_has_Berichten (Berichten_BerichtID,Account_AccountID,Status)
VALUES ($last_id,$AccountID,0";
$conn-query($sql);
}
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment