国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
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.

92 lines
2.8KB

  1. <?php
  2. /**
  3. * @version $id:api.php 8:38 2010年7月9日 tianya $
  4. * @package DedeBIZ.User
  5. * @copyright Copyright (c) 2022 DedeBIZ.COM
  6. * @license https://www.dedebiz.com/license
  7. * @link https://www.dedebiz.com
  8. */
  9. define('AJAXLOGIN', TRUE);
  10. define('IS_DEDEAPI', TRUE);
  11. require_once(dirname(__FILE__)."/config.php");
  12. AjaxHead();
  13. $action = isset($action)? $action : '';
  14. if ($action === 'is_need_check_code') {
  15. $isNeed = $cfg_ml->isNeedCheckCode($userid);
  16. echo json_encode(array(
  17. "code" => 0,
  18. "msg" => "",
  19. "data" => array(
  20. "isNeed" => $isNeed,
  21. ),
  22. ));
  23. exit;
  24. } else if ($action === 'get_old_email') {
  25. $oldpwd = isset($oldpwd)? $oldpwd : '';
  26. if (empty($oldpwd)) {
  27. echo json_encode(array(
  28. "code" => -1,
  29. "msg" => "旧密码不能为空",
  30. "data" => null,
  31. ));
  32. exit;
  33. }
  34. $row = $dsql->GetOne("SELECT * FROM `#@__member` WHERE mid='".$cfg_ml->M_ID."'");
  35. if (function_exists('password_hash') && !empty($row['pwd_new'])) {
  36. if (!is_array($row) || !password_verify($oldpwd, $row['pwd_new'])) {
  37. echo json_encode(array(
  38. "code" => -1,
  39. "msg" => "旧密码校验错误",
  40. "data" => null,
  41. ));
  42. exit;
  43. }
  44. } else {
  45. if (!is_array($row) || $row['pwd'] != md5($oldpwd)) {
  46. echo json_encode(array(
  47. "code" => -1,
  48. "msg" => "旧密码校验错误",
  49. "data" => null,
  50. ));
  51. exit;
  52. }
  53. }
  54. echo json_encode(array(
  55. "code" => 0,
  56. "msg" => "",
  57. "data" => array(
  58. "email" => $row['email'],
  59. ),
  60. ));
  61. } else {
  62. $format = isset($format) ? "json" : "";
  63. if (!$cfg_ml->IsLogin()) {
  64. if ($format === 'json') {
  65. echo json_encode(array(
  66. "code" => -1,
  67. "msg" => "未登录",
  68. "data" => null,
  69. ));
  70. } else {
  71. echo "";
  72. }
  73. exit;
  74. }
  75. $uid = $cfg_ml->M_LoginID;
  76. !$cfg_ml->fields['face'] && $face = ($cfg_ml->fields['sex'] == '女') ? 'dfgirl' : 'dfboy';
  77. $facepic = empty($face) ? $cfg_ml->fields['face'] : $GLOBALS['cfg_memberurl'].'/templets/images/'.$face.'.png';
  78. if ($format === 'json') {
  79. echo json_encode(array(
  80. "code" => 200,
  81. "msg" => "",
  82. "data" => array(
  83. "username" => $cfg_ml->M_UserName,
  84. "myurl" => $myurl,
  85. "facepic" => $facepic,
  86. "memberurl" => $cfg_memberurl,
  87. ),
  88. ));
  89. exit;
  90. }
  91. }
  92. ?>