You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.6 KiB
56 lines
1.6 KiB
4 years ago
|
<?php
|
||
|
/**
|
||
|
* Created by xiaofu.qin
|
||
|
* Description: 用户在前端页面请求激活码,其实这些激活码是从finereport官网上获取的,并没有存入数据库中,所以该文件就是接受index.php的ajax传递进来的激活码进行数据库保存操作。
|
||
|
*/
|
||
|
session_start();
|
||
|
define('FINEREPORT', '100');
|
||
|
require_once '../myFunc/mysql_beta.php';
|
||
|
|
||
|
|
||
|
|
||
|
//判断前端页面传递回来的token是否正确
|
||
|
if( !isset($_POST['token']) || $_POST['token'] !== $_SESSION['token'] ) {
|
||
|
exit('Go home,my boy!');
|
||
|
}
|
||
|
|
||
|
$key = addslashes(htmlspecialchars($_POST["key"]));
|
||
|
$type = addslashes(htmlspecialchars($_POST['type']));
|
||
|
$uid = $_SESSION['uid'];
|
||
|
$time = time();
|
||
|
|
||
|
|
||
|
$conn = connect();
|
||
|
|
||
|
if( $type == 'fineBI' ) {
|
||
|
$sql = 'update pre_common_member_profile set finebi_code=?, finebi_activation_time=? where uid=?';
|
||
|
}else {
|
||
|
$sql = 'update pre_common_member_profile set finereport_code=?, finereport_activation_time=? where uid=?';
|
||
|
}
|
||
|
|
||
|
|
||
|
$stmt = $conn->prepare($sql);
|
||
|
|
||
|
if( !$stmt ) {
|
||
|
exit('false');
|
||
|
}
|
||
|
|
||
|
$stmt->bind_param('sii', $key, $time, $uid);
|
||
|
$stmt->execute();
|
||
|
if( $stmt->affected_rows !== 1){
|
||
|
exit('Can not insert into the database');
|
||
|
}
|
||
|
//发送邮件
|
||
|
|
||
|
require_once '../myFunc/clueReceipt.php';
|
||
|
if( isset($_SESSION['email']) && strlen($_SESSION['email'])>0 ) {
|
||
|
$nameforsend = isset($_SESSION['realname'])? $_SESSION['realname']: '尊敬的用户';
|
||
|
if($type == 'fineReport') {
|
||
|
$reqresult = send_mail($_SESSION['email'], 'zlwd',$subject='【帆软】这是关于FineReport的更多资料', ARRAY("%key%" => ARRAY($nameforsend)));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
echo 'true';
|
||
|
|
||
|
$stmt->free_result();
|
||
|
$conn->close();
|