/
approveUser.php
43 lines (29 loc) · 1.03 KB
/
approveUser.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
41
42
43
<?php
session_start();
function sendMail($user, $listId, $listName){
$subject = "You have been invited to the following list!";
$msg = 'Hello! A user has added you to the list'.$listName.'
Please click the link to accept the invitiation if you wish.
http://www.calebsylvester.com/FinalApp/approve.php?email='.$user.'&listId='.$listId.'
';
// $headers = "MIME-Version: 1.0" . "\r\n";
// $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers = 'From:cgsylve@calebsylvester.com' . "\r\n";
mail($user, $subject, $msg, $headers);
echo "Sent";
}
function approveUser($user, $listId, $listName){
include("finalapp_hosted_dbconn.php");
sendMail($user, $listId, $listName);
//$sql = "INSERT INTO approved VALUES ('$user', '$listId')";
//$retval = mysql_query($sql, $conn);
echo("Done");
mysql_close($conn);
}
if($_POST['action'] == 'approve'){
$user = $_POST['user'];
$listId = $_POST['listId'];
$listName = $_POST['listName'];
approveUser($user, $listId, $listName);
}
?>