⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aedatingcms.php

📁 flashget43的源代码 一个比较常用的下载程序
💻 PHP
字号:
<?php//error_reporting(E_ALL);$aed_root_path = realpath(dirname(__FILE__) . '/../../../') . '/';include($aed_root_path . 'inc/header.inc.php');require_once( "$dir[inc]db.inc.php" );require_once( "$dir[inc]admin.inc.php" );class AEDatingCMS {    var $userid;    var $loginStmt;    var $getUserStmt;    var $getUsersStmt;    function AEDatingCMS() {      $this->userid = NULL;      $this->getUserStmt = new Statement("SELECT ID AS id, NickName AS login FROM Profiles WHERE ID = ? LIMIT 1");      $this->getAdminsStmt = new Statement("SELECT Name AS login FROM Admins LIMIT 1");      $this->getUsersStmt = new Statement("SELECT ID AS id, NickName AS login FROM Profiles");      // in addition to NOT having a numeric ID, admin passwords are stored unencrypted...      $this->adminLoginStmt = new Statement("SELECT * FROM Admins WHERE Name = ? AND Password = ? LIMIT 1");      if (isset($_COOKIE['memberID']) && isset($_COOKIE['memberPassword'])) {        $this->userid = $_COOKIE['memberID'];      }      elseif (isset($_COOKIE['adminID']) && isset($_COOKIE['adminPassword'])) {        // admin cookie.        $this->userid = $this->genAdminID($_COOKIE['adminID']);        $this->adminUser = true;      }    }    function isLoggedIn() {      return $this->userid;    }    function getRoles() {      $rv = NULL;      if ($GLOBALS['fc_config']['liveSupportMode'])        $rv = ROLE_CUSTOMER;      elseif ($this->adminUser)        $rv = ROLE_ADMIN;      else        $rv = ROLE_USER;      return $rv;    }    function getUserProfile($userid) {      if ($userid == SPY_USERID) $rv = NULL;      elseif ($user = $this->getUser($userid)) {        //if ($user['roles'] == ROLE_ADMIN) return NULL; // admins don't have a profile        $boardURL = $GLOBALS['site']['url'];        $rv = ($userid == $this->isLoggedIn()) ? $boardURL . "profile_edit.php?ID=" . $userid : $boardURL . "profile.php?ID=" . $userid;        return $rv;      }    }    function getUser($userid) {      $rv = NULL;      if(($rs = $this->getUserStmt->process($userid)) && ($rec = $rs->next())) {        $rec['roles'] = ROLE_USER;        $rv = $rec;      }      elseif ($rs = $this->getAdminsStmt->process()) {        while ($rs->hasNext()) {          $rec = $rs->next();          if ($userid == $this->genAdminID($rec['login'])) {        break;          }        }        $rec['roles'] = ROLE_ADMIN;        $rec['id'] = $this->genAdminID($rec['login']);        $rv = $rec;      }      return $rv;    }    function login($login, $password) {      $id = NULL;      $passwd = crypt( $password, 'secret_string' );      if (($id = getID($login)) && (check_login($id, $password, 'Profiles', false))) {          setcookie("memberID", $id, 0, '/');          setcookie("memberPassword", $passwd, 0, '/');      }      else {        if (($rs = $this->adminLoginStmt->process($login, $password)) && $rs->hasNext()) {          setcookie("adminID", $login, 0, '/');          setcookie("adminPassword", $passwd, 0, '/');          $id = $this->genAdminID($login);        }      }      return $id;    }    function genAdminID($adminName) {      // really simple hashing function      // AEDating admins have no numeric ID in the table      $r = 0;      for ($i = 0; $i < strlen($adminName); $i++) {        $r = 131 * $r + ord($adminName[$i]);      }      return $r;    }    function userInRole($userid, $role) {      $rv = NULL;      if($user = $this->getUser($userid)) {        $rv = (($user['roles'] & $role) != 0);      }      return $rv;    }    function logout() {    }    function getUsers() {      $rv = $this->getUsersStmt->process();      return $rv;    }		function getGender($userid) {        // 'M' for Male, 'F' for Female, NULL for undefined        return NULL;            }}$GLOBALS['fc_config']['db'] = array(    'host' => $GLOBALS['db']['host'],    'user' => $GLOBALS['db']['user'],    'pass' => $GLOBALS['db']['passwd'],    'base' => $GLOBALS['db']['db'],    'pref' => "fc_",    );$GLOBALS['fc_config']['cms'] = new AEDatingCMS();foreach($GLOBALS['fc_config']['languages'] as $k => $v) {    $GLOBALS['fc_config']['languages'][$k]['dialog']['login']['moderator'] = '';}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -