From e6cb77a07ad5ff4b7d43aa00fdf1fc810bfebf69 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 18 Nov 2005 10:00:18 +0100 Subject: user manager --- functions.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'functions.php') diff --git a/functions.php b/functions.php index 9841f95c9..3985890b1 100644 --- a/functions.php +++ b/functions.php @@ -553,4 +553,41 @@ } } + function make_password($length = 8) { + + $password = ""; + $possible = "0123456789bcdfghjkmnpqrstvwxyz"; + + $i = 0; + + while ($i < $length) { + $char = substr($possible, mt_rand(0, strlen($possible)-1), 1); + + if (!strstr($password, $char)) { + $password .= $char; + $i++; + } + } + return $password; + } + + // this is called after user is created to initialize default feeds, labels + // or whatever else + + // user preferences are checked on every login, not here + + function initialize_user($link, $uid) { + + db_query($link, "insert into ttrss_labels (owner_uid,sql_exp,description) + values ('$uid','unread = true', 'Unread articles')"); + + db_query($link, "insert into ttrss_labels (owner_uid,sql_exp,description) + values ('$uid','last_read is null and unread = false', 'Updated articles')"); + + db_query($link, "insert into ttrss_feeds (owner_uid,title,feed_url) + values ('$uid', 'Tiny Tiny RSS Dev. Feed', + 'http://bah.spb.su/darcsweb/darcsweb.cgi?r=tt-rss;a=rss')"); + + } + ?> -- cgit v1.2.3