diff --git a/components/signup.php b/components/signup.php index 3e722a1e9a1eccc7bc9c2da21a0cc14171497165..c850da587ed2f37709fdedab0757fbd8480005a7 100644 --- a/components/signup.php +++ b/components/signup.php @@ -128,16 +128,8 @@ if (isset($_REQUEST['signupid']) && isset($_REQUEST['signuppw'])) { ); $failed = true; } else { - // determine the uid range - if ($row[type] == 2) { - $baseuid = 8; - } else { - $baseuid = 29; - } - $minuid = $baseuid * 1000; - $maxuid = $minuid + 999; - //get the new uid - $uid = findUid($minuid, $maxuid); + //generate the new uid + $uid = generateUid(); // make a password $password = make_password(); // make the ldif diff --git a/lib/member_functions.php b/lib/member_functions.php index a7a570191f6acf3acbf466ba12281e64ea7e2c1b..f5f4d7be93954a1775fc12f1b574ef2642dc99da 100644 --- a/lib/member_functions.php +++ b/lib/member_functions.php @@ -29,21 +29,30 @@ function make_password($length = 8) return $password; } -function findUid($start, $end) +function generateUid() { - $ds = ldap_connect("localhost"); - ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); - $r = ldap_bind($ds); - $sr = ldap_search($ds, "dc=sucs,dc=org", "uid=*", array(uidNumber)); - $info = ldap_get_entries($ds, $sr); - for ($i = 0; $i < $info[count]; $i++) { - $uids[$info[$i][uidnumber][0]] = true; - } - for ($i = $start; $i < $end; $i++) { - if (!isset($uids[$i])) { - $safeuid = $i; - break; + + //get the year, this'll be the start/prefix of the uid + $prefix = date("Y"); + + //generate a uid + //check to see if it's taken/safe to use + $ok = false; + while ($ok == false) { + + //generate random number between 00000 and 99999 + $uid = sprintf("%05d", mt_rand(0, 99999)); + + //id return 1 for error (safe to take). 0 for success (taken) not safe + exec("id ".$prefix.$uid, $output, $returnVal); + + //check the result of id + if ($returnVal == 1) { + // We have an unused one! + $ok = true; + $safeuid = $prefix.$uid; } + } return $safeuid; diff --git a/static/About/Room.txt b/static/About/Room.txt index ba2df62038302b4da0e21efd815172d3d3fb4a79..0f66a677f32869a652c3c9cfb4f060a76cc6cdbd 100644 --- a/static/About/Room.txt +++ b/static/About/Room.txt @@ -1,5 +1,5 @@ -

The SUCS room houses our network of Linux desktop PCs, along with spaces for members with laptop computers to get connected.

-

The SUCS Room

-

Where to find the room

-

Location of SUCS Room on Campus Map

-

The SUCS room is located at the bottom of the Student Union building, approximately halfway along the side facing the back of Fulton House. To unlock the door, members can swipe their student card in the card reader or hold it up to the RFID sensor pad denoted by the black square (both located to the right of our blue door, underneath the window).

\ No newline at end of file +

The SUCS room houses our network of Linux desktop PCs, along with spaces for members with laptop computers to get connected.

+

The SUCS Room

+

Where to find the room

+

Location of SUCS Room on Campus Map

+

The SUCS room is located at the bottom of the Student Union building, approximately halfway along the side facing the back of Fulton House. To unlock the door, members can swipe their student card in the card reader or hold it up to the RFID sensor pad denoted by the square (both located to the right of our blue door, underneath the window).

\ No newline at end of file diff --git a/static/Community/Stream.txt b/static/Community/Stream.txt index d408088567d5fd69e52a7c68089fad1a0b8296cf..54941377b5c07ee1100faed736a800dccecc8219 100644 --- a/static/Community/Stream.txt +++ b/static/Community/Stream.txt @@ -1,28 +1,24 @@ -

- -

-

We are currently streaming nothing.
We also stream student forums on behalf of the Student Union - check their website for dates and times

- -

-To view the stream in an external media player (e.g VLC) -Click Here for instructions

-

All streams are currently FLV format. If you have any problems, please read the FAQ

-