X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=register.php;h=a6f42c65df865aaf49ea2abf84961c1e2f915ee3;hb=32ae0fc2a2c9909d753f649d87fda45a29e66362;hp=9fd75ffc51f6e41c0140eb9757d28eaed018620b;hpb=410c0b3a01b497cfc4349e4a8d13626051ab9d26;p=tt-rss.git diff --git a/register.php b/register.php index 9fd75ffc..a6f42c65 100644 --- a/register.php +++ b/register.php @@ -4,17 +4,22 @@ // 1) templates/register_notice.txt - displayed above the registration form // 2) register_expire_do.php - contains user expiration queries when necessary - $action = $_REQUEST["action"]; + set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . + get_include_path()); + require_once 'classes/ttrssmailer.php'; + require_once "autoload.php"; require_once "functions.php"; require_once "sessions.php"; require_once "sanity_check.php"; require_once "config.php"; require_once "db.php"; - $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); + startup_gettext(); + + $action = $_REQUEST["action"]; - init_connection($link); + if (!init_plugins()) return; if ($_REQUEST["format"] == "feed") { header("Content-Type: text/xml"); @@ -27,7 +32,7 @@ "; if (ENABLE_REGISTRATION) { - $result = db_query($link, "SELECT COUNT(*) AS cu FROM ttrss_users"); + $result = db_query( "SELECT COUNT(*) AS cu FROM ttrss_users"); $num_users = db_fetch_result($result, 0, "cu"); $num_users = REG_MAX_USERS - $num_users; @@ -55,10 +60,10 @@ /* Remove users which didn't login after receiving their registration information */ if (DB_TYPE == "pgsql") { - db_query($link, "DELETE FROM ttrss_users WHERE last_login IS NULL + db_query( "DELETE FROM ttrss_users WHERE last_login IS NULL AND created < NOW() - INTERVAL '1 day' AND access_level = 0"); } else { - db_query($link, "DELETE FROM ttrss_users WHERE last_login IS NULL + db_query( "DELETE FROM ttrss_users WHERE last_login IS NULL AND created < DATE_SUB(NOW(), INTERVAL 1 DAY) AND access_level = 0"); } @@ -69,9 +74,9 @@ if ($action == "check") { header("Content-Type: application/xml"); - $login = trim(db_escape_string($_REQUEST['login'])); + $login = trim(db_escape_string( $_REQUEST['login'])); - $result = db_query($link, "SELECT id FROM ttrss_users WHERE + $result = db_query( "SELECT id FROM ttrss_users WHERE LOWER(login) = LOWER('$login')"); $is_registered = db_num_rows($result) > 0; @@ -90,10 +95,11 @@ Create new account - - - - + + + + +