-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfirm.php
25 lines (23 loc) · 1.28 KB
/
confirm.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
<?php
var_dump($_GET);
$login = no_injection($_GET["username"]);
$result = $dbconnection->query("SELECT `id` FROM $database.`users` WHERE `login` ='{$login}' LIMIT 1;") or die($dbconnection->error);
$uid = $result->fetch_assoc()['id'];
$result = $dbconnection->query("SELECT `id`, `name` FROM $database.`roles`") or die($dbconnection->error);
while ($row = $result->fetch_assoc()) {
if ($_GET[$row['name']] == "on") {
$rid = $row['id'];
$dbconnection->query("INSERT INTO $database.`user_roles`(`user_id`, `role_id`)
VALUES ('$uid', '$rid');") or die($dbconnection->error);
}
}
$result = $dbconnection->query("UPDATE $database.`users`
SET `approvied` = '1'
WHERE `login` = '$login';") or die($dbconnection->error);
$result = $dbconnection->query("SELECT `email`
FROM $database.`users`
WHERE `login` = '$login';") or die($dbconnection->error);
$msg = wordwrap("Hi! Your login ($login) just confirmed. Try to login on ".$hostname, 70);
$headers = "From: [email protected]\r\nReply-To: [email protected]\r\n";
mail($result->fetch_assoc()['email'], "Mymon registration", $msg, $headers);
echo "<p>Profile updated successfully.";