-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeleteEmails.php
40 lines (37 loc) · 1.03 KB
/
deleteEmails.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/*
This deletes the emails you choose to delete from the ones you have made.
*/
require_once './vendor/autoload.php';
require 'session.php';
$loader = new Twig_Loader_Filesystem('./templates');
$twig = new Twig_Environment($loader, array());
session_start();
if(!check_user($_SESSION['username']))
header('Location: login.php');
else
{
$user = $_SESSION['username'];
$con = connect();
if(isset($_POST['deleted_book']) && !empty($_POST['deleted_book']))
{
remove_email($_POST['deleted_book']);
}
$get_message = "SELECT * FROM future_emails WHERE future_emails.user_name <= '$user'";
if ($result = mysqli_query($con, $get_message))
{
if(mysqli_num_rows($result) > 0)
{
while($data = mysqli_fetch_assoc($result))
$messages[] = $data;
}
mysqli_free_result($result);
}
mysqli_close($con);
$size = count($messages);
echo $twig->render('deleteEmails.html', array('messages' => $messages,
'message_size' => $size,
'username' => $user,
'logged_in' => true));
}
?>