aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_user.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions_user.inc.php')
-rw-r--r--include/functions_user.inc.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 999ef95af..3e8588cf7 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -110,6 +110,7 @@ SELECT id
$insert['nb_line_page'] = $conf['nb_line_page'];
$insert['language'] = $conf['default_language'];
$insert['recent_period'] = $conf['recent_period'];
+ $insert['feed_id'] = find_available_feed_id();
$insert['expand'] = boolean_to_string($conf['auto_expand']);
$insert['show_nb_comments'] = boolean_to_string($conf['show_nb_comments']);
if ( $mail_address != '' )
@@ -143,6 +144,13 @@ INSERT INTO '.USERS_TABLE.'
$query.= ')
;';
pwg_query($query);
+
+ $query = '
+UPDATE '.USERS_TABLE.'
+ SET registration_date = NOW()
+ WHERE id = '.mysql_insert_id().'
+;';
+ pwg_query($query);
}
return $errors;
}
@@ -379,4 +387,27 @@ SELECT username
return $username;
}
+
+/**
+ * search an available feed_id
+ *
+ * @return string feed identifier
+ */
+function find_available_feed_id()
+{
+ while (true)
+ {
+ $key = generate_key(50);
+ $query = '
+SELECT COUNT(*)
+ FROM '.USERS_TABLE.'
+ WHERE feed_id = \''.$key.'\'
+;';
+ list($count) = mysql_fetch_row(pwg_query($query));
+ if (0 == $count)
+ {
+ return $key;
+ }
+ }
+}
?>