1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-18 14:31:30 +00:00

user manager

This commit is contained in:
Andrew Dolgov
2005-11-18 10:00:18 +01:00
parent cd42edf18d
commit e6cb77a07a
7 changed files with 454 additions and 12 deletions

View File

@@ -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')");
}
?>