Welcome Guest, Not a member yet? Register   Sign In
Community Auth Learning...
#15

(08-21-2015, 02:05 PM)skunkbad Wrote:
(08-21-2015, 04:38 AM)solidcodes Wrote: Okay I just modified the codes,




Code:
   private function _get_unused_id()
   {
       // Create a random user id
       //$random_unique_int = mt_rand(1200, 4294967295);
    $random_unique_int = mt_rand();

       // Make sure the random user_id isn't already in use
       $query = $this->db->where('user_id', $random_unique_int)
           ->get_where(config_item('user_table'));

       if ($query->num_rows() > 0) {
           $query->free_result();

           // If the random user_id is already in use, get a new number
           return $this->_get_unused_id();
       }

       return $random_unique_int;
   }

It works now, but I'm not sure why brian did that.
Brian??? lol

It could be that the max value available to mt_rand is 2147483647 and not 4294967295

You might try changing the number there and see if it works. I'll have to investigate, but try that and let me know.

It is, no matter if you're on a 32 or 64-bit system. But either way - there's mt_getrandmax().
Reply


Messages In This Thread
Community Auth Learning... - by solidcodes - 08-18-2015, 10:30 PM
RE: Community Auth Learning... - by solidcodes - 08-19-2015, 02:04 AM
RE: Community Auth Learning... - by solidcodes - 08-20-2015, 06:24 PM
RE: Community Auth Learning... - by solidcodes - 08-20-2015, 06:32 PM
RE: Community Auth Learning... - by skunkbad - 08-20-2015, 07:41 PM
RE: Community Auth Learning... - by solidcodes - 08-20-2015, 09:10 PM
RE: Community Auth Learning... - by zenepay - 06-11-2016, 03:01 AM
RE: Community Auth Learning... - by bpuig - 05-17-2017, 08:33 AM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 02:53 AM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 02:56 AM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 04:07 AM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 04:38 AM
RE: Community Auth Learning... - by skunkbad - 08-21-2015, 02:05 PM
RE: Community Auth Learning... - by Narf - 08-21-2015, 02:11 PM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 04:50 AM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 05:04 AM
RE: Community Auth Learning... - by skunkbad - 08-21-2015, 02:07 PM
RE: Community Auth Learning... - by Narf - 08-21-2015, 02:13 PM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 04:38 PM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 07:08 PM
RE: Community Auth Learning... - by skunkbad - 08-21-2015, 09:23 PM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 10:04 PM
RE: Community Auth Learning... - by solidcodes - 11-14-2015, 07:34 PM
RE: Community Auth Learning... - by skunkbad - 11-15-2015, 12:05 AM
RE: Community Auth Learning... - by solidcodes - 11-15-2015, 03:43 AM
RE: Community Auth Learning... - by solidcodes - 11-15-2015, 08:15 PM
RE: Community Auth Learning... - by skunkbad - 11-16-2015, 01:04 PM
RE: Community Auth Learning... - by solidcodes - 11-17-2015, 07:57 PM
RE: Community Auth Learning... - by skunkbad - 11-18-2015, 10:42 AM
RE: Community Auth Learning... - by solidcodes - 11-18-2015, 06:46 PM
RE: Community Auth Learning... - by skunkbad - 11-18-2015, 07:25 PM
RE: Community Auth Learning... - by solidcodes - 11-18-2015, 07:38 PM
RE: Community Auth Learning... - by solidcodes - 11-23-2015, 03:55 PM
RE: Community Auth Learning... - by solidcodes - 11-23-2015, 11:25 PM
RE: Community Auth Learning... - by solidcodes - 11-24-2015, 12:29 AM
RE: Community Auth Learning... - by skunkbad - 11-24-2015, 01:01 PM
RE: Community Auth Learning... - by solidcodes - 11-24-2015, 06:15 PM
RE: Community Auth Learning... - by solidcodes - 11-28-2015, 04:45 PM
RE: Community Auth Learning... - by skunkbad - 11-29-2015, 02:31 AM
RE: Community Auth Learning... - by solidcodes - 11-29-2015, 02:43 AM
RE: Community Auth Learning... - by skunkbad - 11-29-2015, 09:52 AM
RE: Community Auth Learning... - by solidcodes - 11-30-2015, 05:24 PM
RE: Community Auth Learning... - by solidcodes - 11-30-2015, 05:28 PM
RE: Community Auth Learning... - by skunkbad - 11-30-2015, 06:32 PM
RE: Community Auth Learning... - by solidcodes - 11-30-2015, 07:33 PM
RE: Community Auth Learning... - by skunkbad - 12-01-2015, 01:22 AM
RE: Community Auth Learning... - by solidcodes - 11-30-2015, 07:52 PM
RE: Community Auth Learning... - by solidcodes - 12-01-2015, 03:20 PM
RE: Community Auth Learning... - by solidcodes - 12-01-2015, 03:48 PM
RE: Community Auth Learning... - by solidcodes - 12-01-2015, 06:35 PM
RE: Community Auth Learning... - by skunkbad - 12-01-2015, 11:24 PM
RE: Community Auth Learning... - by solidcodes - 12-02-2015, 04:46 PM
RE: Community Auth Learning... - by solidcodes - 12-05-2015, 04:33 PM
RE: Community Auth Learning... - by skunkbad - 12-05-2015, 08:37 PM
RE: Community Auth Learning... - by solidcodes - 12-08-2015, 05:03 PM
RE: Community Auth Learning... - by skunkbad - 12-08-2015, 08:12 PM
RE: Community Auth Learning... - by solidcodes - 12-09-2015, 06:14 PM
RE: Community Auth Learning... - by skunkbad - 12-09-2015, 09:03 PM
RE: Community Auth Learning... - by solidcodes - 12-10-2015, 02:31 PM
RE: Community Auth Learning... - by skunkbad - 12-10-2015, 04:51 PM
RE: Community Auth Learning... - by solidcodes - 12-10-2015, 05:36 PM
RE: Community Auth Learning... - by InsiteFX - 05-17-2017, 10:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB