Skip to content
Commits on Source (7)
......@@ -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
......
......@@ -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;
......
<p>The SUCS room houses our network of Linux desktop PCs, along with spaces for members with laptop computers to get connected.</p>
<p><img alt="The SUCS Room" src="../pictures/sucsroom.jpg" /></p>
<h3>Where to find the room</h3>
<p style="float: left; margin: 0.5em"><a href="../pictures/room-map.jpg"><img alt="Location of SUCS Room on Campus Map" src="../pictures/room-map_thumb.jpg" /></a></p>
<p>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 <abbr>RFID</abbr> sensor pad denoted by the black square (both located to the right of our blue door, underneath the window).</p>
\ No newline at end of file
<p>The SUCS room houses our network of Linux desktop PCs, along with spaces for members with laptop computers to get connected.</p>
<p><img alt="The SUCS Room" src="../pictures/sucsroom.jpg" /></p>
<h3>Where to find the room</h3>
<p style="float: left; margin: 0.5em"><a href="../pictures/room-map.jpg"><img alt="Location of SUCS Room on Campus Map" src="../pictures/room-map_thumb.jpg" /></a></p>
<p>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 <abbr>RFID</abbr> sensor pad denoted by the square (both located to the right of our blue door, underneath the window).</p>
\ No newline at end of file
<p>
<script src="/~imranh/sucs/jwplayer/jwplayer/jwplayer.js" type="text/javascript"></script>
</p>
<p>We are currently streaming <em><strong>nothing</strong></em>.<br />We also stream student forums on behalf of the Student Union - check <a href="http://swansea-union.co.uk/">their website for dates and times</a></p>
<ul>
<div id="JWPlayer">Loading the player...</div>
<script type="text/javascript">
jwplayer("JWPlayer").setup({
primary: "html5",
levels: [{
file: "http://stream.sucs.org/high.flv",
label: "High"
},{
file: "http://stream.sucs.org/low.flv",
label: "Low",
default: true
}
],
image: ""
});
</script>
</ul>
<p>
To view the stream in an external media player <em>(e.g VLC)</em>
<a href="../Stream/External">Click Here for instructions</a><em><br /></em></p>
<p>All streams are currently FLV format. If you have any problems, please read the <a href="../Stream/FAQ">FAQ</a></p>
<ul>
<p>
<script src="/~imranh/sucs/jwplayer/jwplayer/jwplayer.js" type="text/javascript"></script>
</p>
<p>We are currently streaming <em><strong>nothing</strong></em>.<br />We also stream student forums on behalf of the Student Union - check <a href="http://swansea-union.co.uk/">their website for dates and times</a></p>
<ul>
<div id="JWPlayer">Loading the player...</div>
<script type="text/javascript">
jwplayer("JWPlayer").setup({
primary: "html5",
levels: [{
file: "rtmp://137.44.10.80/live",
label: "High"
},{
file: "rtmp://137.44.10.80/live",
label: "Low",
default: true
}
],
image: ""
});
</script>
</ul>
<ul>
</ul>
\ No newline at end of file