本文整理汇总了PHP中DbHandler::activateUser方法的典型用法代码示例。如果您正苦于以下问题:PHP DbHandler::activateUser方法的具体用法?PHP DbHandler::activateUser怎么用?PHP DbHandler::activateUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbHandler
的用法示例。
在下文中一共展示了DbHandler::activateUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: json_encode
<?php
include './include/DbHandler.php';
$db = new DbHandler();
$response = array();
$response["error"] = false;
if (isset($_POST['otp']) && $_POST['otp'] != '') {
$otp = $_POST['otp'];
$user = $db->activateUser($otp);
if ($user != NULL) {
$response["message"] = "User created successfully!";
$response["profile"] = $user;
} else {
$response["message"] = "Sorry! Failed to create your account.";
}
} else {
$response["message"] = "Sorry! OTP is missing.";
}
echo json_encode($response);
示例2: function
}
}
} else {
$response['error'] = true;
$response['message'] = 'Activation code is not valid!';
}
//output final response
echo $response;
});
//GET Activate route
$app->get('/activate/:x/:y', function ($x, $y) use($app) {
// $email = $app->request->get('x');
// $active= $app->request->get('y');
require_once './classes/DbHandler.php';
$db = new DbHandler();
$data = $db->activateUser($x, $y);
echo "<div class=\"content-main opacity\">\n <section class=\"content-section contact-section\">\n <div class=\"wrap content-contact\">\n <div class=\"container-fluid\">\n <header>\n <h2 class=\"entry-header \">Account Activation</h2>\n </header><hr /><br />\n </div>\n ";
if ($data['message'] == 'USER_ACTIVE_SUCCESS') {
echo '<h3>Account Activated</h3>';
} elseif ($data['message'] == 'USER_ACTIVE_FAIL') {
echo '<h3>Activation Error</h3>';
} elseif ($data['message'] == 'USER_NOT_EXIST') {
echo "<h3>User doesn't exist</h3>";
}
echo "</div></section></div>";
});
//GET login route
$app->get('/login', function () use($app) {
$app->render('login.php');
});
//POST login route