Store in GIT
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
require("../../../inc/connect.php");
|
||||
require("../../../inc/session.php");
|
||||
|
||||
$device = $_POST['device'];
|
||||
|
||||
//Validate Device ID
|
||||
if(strlen($device) != 6)
|
||||
{
|
||||
error("devices", "Device ID invalid");
|
||||
}
|
||||
|
||||
$sql = "SELECT `id` FROM `device` WHERE `dev_id`='" . $device . "' AND `user`=0";
|
||||
$query = ExecQuery($mysqli, $sql);
|
||||
|
||||
if($query->num_rows < 1)
|
||||
{
|
||||
error("devices", "Device ID invalid");
|
||||
}
|
||||
|
||||
$code = $email . "~" . $device . "~";
|
||||
$code .= RandomString(96 - strlen($code));
|
||||
$code = str_rot13($code);
|
||||
|
||||
$sql = "UPDATE user SET `code`='$code' WHERE `id`=$userid";
|
||||
ExecQuery($mysqli, $sql);
|
||||
|
||||
$msg = "Hello " . $username . ",\n\n";
|
||||
$msg .= "Please verify your new device by clicking the link below.\n";
|
||||
$msg .= "<a href='http://lipa.kvewijk.nl/manage/php/session/verify.php?code=" . urlencode($code) . "'>Verify</a>";
|
||||
|
||||
sendMail($email, "Verify Device", $msg);
|
||||
|
||||
success("devices", "An email has been sent to " . $email . " for verification");
|
||||
?>
|
||||
Reference in New Issue
Block a user