<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
  img {
    max-width: 100%;
    height: auto;
  }
  p.details {
    font-style:italic;
    color:#777
  }
  .footer p {
    font-size:small;
    color:#777
  }
  pre.commit-message {
    white-space: pre-wrap;
  }
  .file-stats a {
    text-decoration: none;
  }
  .file-stats .new-file {
    color: #090;
  }
  .file-stats .deleted-file {
    color: #B00;
  }
</style>
<body>
<div class='content'>
<h3>
Imran Hussain pushed to branch sucs-site
at <a href="https://projects.sucs.org/sucssite/sucs-site">sucssite / sucs-site</a>
</h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://projects.sucs.org/sucssite/sucs-site/commit/a16d95d05b16377dbc5b3c30ddf254a5493eae58">a16d95d0</a></strong>
<div>
<span>by Imran Hussain</span>
<i>at 2015-12-29T17:07:38+00:00</i>
</div>
<pre class='commit-message'>Replace the old UID generation.

New UID generation system that uses the full year as a prefix. Should stop UIDs
from being reused.</pre>
</li>
<li>
<strong><a href="https://projects.sucs.org/sucssite/sucs-site/commit/080478fe19d550e7de5157cdb22c290025f6b306">080478fe</a></strong>
<div>
<span>by Laurence Sebastian Bowes</span>
<i>at 2016-02-13T03:26:59+00:00</i>
</div>
<pre class='commit-message'>Twat</pre>
</li>
<li>
<strong><a href="https://projects.sucs.org/sucssite/sucs-site/commit/c2f7394d9ed8408f824008a6a2ed5a57f03af51e">c2f7394d</a></strong>
<div>
<span>by Laurence Sebastian Bowes</span>
<i>at 2016-02-13T03:44:17+00:00</i>
</div>
<pre class='commit-message'>Minor fixes. Happy with this code now.</pre>
</li>
<li>
<strong><a href="https://projects.sucs.org/sucssite/sucs-site/commit/85a840ef4881bc721f037017a959334aba835199">85a840ef</a></strong>
<div>
<span>by Laurence Sebastian Bowes</span>
<i>at 2016-02-17T12:42:57+00:00</i>
</div>
<pre class='commit-message'>Updated info following on from what I think #29 was talking about</pre>
</li>
<li>
<strong><a href="https://projects.sucs.org/sucssite/sucs-site/commit/bbd8423ef23d7cdc002f6fd712778992983e6a59">bbd8423e</a></strong>
<div>
<span>by Imran Hussain</span>
<i>at 2016-03-12T15:59:14+00:00</i>
</div>
<pre class='commit-message'>Update stream page with new info</pre>
</li>
<li>
<strong><a href="https://projects.sucs.org/sucssite/sucs-site/commit/edf6aa38c27c9ce13bb50379a2741fbde8c2975a">edf6aa38</a></strong>
<div>
<span>by Imran Hussain</span>
<i>at 2016-03-12T16:00:36+00:00</i>
</div>
<pre class='commit-message'>Remove old info from stream page</pre>
</li>
<li>
<strong><a href="https://projects.sucs.org/sucssite/sucs-site/commit/ec70944850afef3ed98bb546c1ef02d4dd7df36c">ec709448</a></strong>
<div>
<span>by Imran Hussain</span>
<i>at 2016-03-12T16:28:13+00:00</i>
</div>
<pre class='commit-message'>Merge branch 'master' into beta</pre>
</li>
<li>
<strong><a href="https://projects.sucs.org/sucssite/sucs-site/commit/f8f3c8f33c415685f594c0caedce6e66bea56d56">f8f3c8f3</a></strong>
<div>
<span>by Imran Hussain</span>
<i>at 2016-03-12T16:33:47+00:00</i>
</div>
<pre class='commit-message'>Merge branch 'beta' into sucs-site</pre>
</li>
</ul>
<h4>4 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
components/signup.php
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
lib/member_functions.php
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
static/About/Room.txt
</a>
</li>
<li class='file-stats'>
<a href='#diff-3'>
static/Community/Stream.txt
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://projects.sucs.org/sucssite/sucs-site/compare/2204d6690e83b451b782046c479be281ad5c7326...f8f3c8f33c415685f594c0caedce6e66bea56d56#diff-0'>
<strong>
components/signup.php
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/components/signup.php
</span><span style="color: #000000;background-color: #ddffdd">+++ b/components/signup.php
</span><span style="color: #aaaaaa">@@ -128,16 +128,8 @@ if (isset($_REQUEST['signupid']) && isset($_REQUEST['signuppw'])) {
</span>                         );
                         $failed = true;
                     } else {
<span style="color: #000000;background-color: #ffdddd">-                        // 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);
</span><span style="color: #000000;background-color: #ddffdd">+                        //generate the new uid
+                        $uid = generateUid();
</span>                         // make a password
                         $password = make_password();
                         // make the ldif
</code></pre>

<br>
</li>
<li id='diff-1'>
<a href='https://projects.sucs.org/sucssite/sucs-site/compare/2204d6690e83b451b782046c479be281ad5c7326...f8f3c8f33c415685f594c0caedce6e66bea56d56#diff-1'>
<strong>
lib/member_functions.php
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/lib/member_functions.php
</span><span style="color: #000000;background-color: #ddffdd">+++ b/lib/member_functions.php
</span><span style="color: #aaaaaa">@@ -29,21 +29,30 @@ function make_password($length = 8)
</span>     return $password;
 }
 
<span style="color: #000000;background-color: #ffdddd">-function findUid($start, $end)
</span><span style="color: #000000;background-color: #ddffdd">+function generateUid()
</span> {
<span style="color: #000000;background-color: #ffdddd">-    $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;
</span><span style="color: #000000;background-color: #ddffdd">+
+    //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;
</span>         }
<span style="color: #000000;background-color: #ddffdd">+
</span>     }
 
     return $safeuid;
</code></pre>

<br>
</li>
<li id='diff-2'>
<a href='https://projects.sucs.org/sucssite/sucs-site/compare/2204d6690e83b451b782046c479be281ad5c7326...f8f3c8f33c415685f594c0caedce6e66bea56d56#diff-2'>
<strong>
static/About/Room.txt
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/static/About/Room.txt
</span><span style="color: #000000;background-color: #ddffdd">+++ b/static/About/Room.txt
</span><span style="color: #aaaaaa">@@ -1,5 +1,5 @@
</span><span style="color: #000000;background-color: #ffdddd">-<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>
</span>\ No newline at end of file
<span style="color: #000000;background-color: #ddffdd">+<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>
</span>\ No newline at end of file
</code></pre>

<br>
</li>
<li id='diff-3'>
<a href='https://projects.sucs.org/sucssite/sucs-site/compare/2204d6690e83b451b782046c479be281ad5c7326...f8f3c8f33c415685f594c0caedce6e66bea56d56#diff-3'>
<strong>
static/Community/Stream.txt
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/static/Community/Stream.txt
</span><span style="color: #000000;background-color: #ddffdd">+++ b/static/Community/Stream.txt
</span><span style="color: #aaaaaa">@@ -1,28 +1,24 @@
</span><span style="color: #000000;background-color: #ffdddd">-<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>
</span><span style="color: #000000;background-color: #ddffdd">+<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>
</span> </ul>
\ No newline at end of file
</code></pre>

<br>
</li>

</div>
<div class='footer' style='margin-top: 10px;'>
<p>

<br>
<a href="https://projects.sucs.org/sucssite/sucs-site/compare/2204d6690e83b451b782046c479be281ad5c7326...f8f3c8f33c415685f594c0caedce6e66bea56d56">View it on GitLab</a>.
<br>
You're receiving this email because of your account on projects.sucs.org.
If you'd like to receive fewer emails, you can
adjust your notification settings.

</p>
</div>
</body>
</html>