国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

71 linhas
2.5KB

  1. <?php
  2. /**
  3. * 后台登录
  4. *
  5. * @version $id:login.php 8:48 2010年7月13日 tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2022 DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__).'/../system/common.inc.php');
  12. require_once(DEDEINC.'/userlogin.class.php');
  13. if (empty($dopost)) $dopost = '';
  14. if (empty($gotopage)) $gotopage = '';
  15. $gotopage = RemoveXSS($gotopage);
  16. //检测安装目录安全性
  17. if (is_dir(dirname(__FILE__).'/../install')) {
  18. if (!file_exists(dirname(__FILE__).'/../install/install_lock.txt')) {
  19. $fp = fopen(dirname(__FILE__).'/../install/install_lock.txt', 'w') or die('安装目录无写入权限,无法进行写入锁定文件,请安装完毕删除安装目录');
  20. fwrite($fp, 'ok');
  21. fclose($fp);
  22. }
  23. $fileindex = "../install/index.html";
  24. if (!file_exists($fileindex)) {
  25. $fp = @fopen($fileindex, 'w');
  26. fwrite($fp, 'dir');
  27. fclose($fp);
  28. }
  29. }
  30. //检测后台目录是否更名
  31. $cururl = GetCurUrl();
  32. if (preg_match('/admin\/login/i', $cururl)) {
  33. $redmsg = '<div class="alert alert-warning"><div class="safe-tips">您的管理目录的名称中包含默认名称admin,建议把它修改为其它名称,那样会更安全</div></div>';
  34. } else {
  35. $redmsg = '';
  36. }
  37. //登录检测
  38. $admindirs = explode('/', str_replace("\\", '/', dirname(__FILE__)));
  39. $admindir = $admindirs[count($admindirs) - 1];
  40. if ($dopost == 'login') {
  41. $validate = empty($validate) ? '' : strtolower(trim($validate));
  42. $svali = strtolower(GetCkVdValue());
  43. $cuserLogin = new userLogin($admindir);
  44. if (!empty($userid) && !empty($pwd)) {
  45. $res = $cuserLogin->checkUser($userid, $pwd);
  46. if ($res == 1) {
  47. $cuserLogin->keepUser();
  48. if (!empty($gotopage)) {
  49. ShowMsg('成功登录,正在转向管理管理主页', $gotopage);
  50. exit();
  51. } else {
  52. ShowMsg('成功登录,正在转向管理管理主页', 'index.php');
  53. exit();
  54. }
  55. } else if ($res == -1) {
  56. ResetVdValue();
  57. ShowMsg('您的账号不存在', 'login.php', 0, 1000);
  58. exit;
  59. } else {
  60. ResetVdValue();
  61. ShowMsg('您的密码错误', 'login.php', 0, 1000);
  62. exit;
  63. }
  64. } else {
  65. ResetVdValue();
  66. ShowMsg('用户和密码没填写完整', 'login.php', 0, 1000);
  67. exit;
  68. }
  69. }
  70. include('templets/login.htm');
  71. ?>