-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello.php
More file actions
30 lines (30 loc) · 1.42 KB
/
hello.php
File metadata and controls
30 lines (30 loc) · 1.42 KB
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
<?php
$con = mysqli_connect("77.104.171.129", "noodlecr_ross", "AccustomCrushEffortSauce6", "noodlecr_main");
$user = $_POST['user'];
$sql = "SELECT username, email FROM user WHERE username = '$user'";
$q = mysqli_query($con, $sql);
while ($res = mysqli_fetch_array($q, MYSQLI_ASSOC)) {
$email = ("hello@noodlecreate.com"); //senders e-mail adress
if((filter_var($email, FILTER_VALIDATE_EMAIL))) {
$Name = ("Noodle Create"); //senders name
$mail_body = "Hi " . $user . ", \r\n";
$mail_body .= "Thanks for signing up to Noodle Create \r\n";
$mail_body .= "If you need help contact support@noodlecreate.com. \r\n";
$mail_body .= "Kind regards, \r\n";
$mail_body .= "Ross. \r\n";
$subject = "Welcome to Noodle Create"; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: text/html; charset=UTF-8\r\n";
$template = file_get_contents("emailTemplate.html");
foreach($res as $key => $value)
{
$template = str_replace('{{ '.$key.' }}', $value, $template);
}
mail($res['email'], $subject, $template, $header); //mail command :)
}
else {
print "You've entered an invalid email address!";
}
}
?>