From 1eec10329a4764f132b159e7b1bbf37added6c8a Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 7 Aug 2011 16:56:26 -0700 Subject: guid functions --- boot.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index d5adbd7cf..3bdbe2db2 100644 --- a/boot.php +++ b/boot.php @@ -610,12 +610,12 @@ function check_config(&$a) { }} -function get_guid() { - $exists = true; +function get_guid($size=16) { + $exists = true; // assume by default that we don't have a unique guid do { - $s = random_string(16); + $s = random_string($size); $r = q("select id from guid where guid = '%s' limit 1", dbesc($s)); - if(! results($r)) + if(! count($r)) $exists = false; } while($exists); q("insert into guid ( guid ) values ( '%s' ) ", dbesc($s)); -- cgit v1.2.3