diff --git a/components/blogfeed.php b/components/blogfeed.php
index 70527c5062fce19bd3a08590438f36999003d856..25c27f762c2c07b26c25b6ff1f3ebd8260d4a370 100644
--- a/components/blogfeed.php
+++ b/components/blogfeed.php
@@ -64,7 +64,7 @@ if (count($result) > 0) {
 	}
 	if($feedtype=='atom') {
 		//this should be a date type c when we are on php5, untill then, this nasty hack should work.
-		$pubdate = ereg_replace(' ', 'T', $row['timestamp']).":00";
+		$pubdate = preg_replace('/ /', 'T', $row['timestamp']).":00";
 	}
 	$entries = "";
 	//output this entry
@@ -85,7 +85,7 @@ if (count($result) > 0) {
 	}
 	if($feedtype=='atom') {
 		do {
-			$entrydate = ereg_replace(' ', 'T', $row['timestamp']).":00";
+			$entrydate = preg_replace('/ /', 'T', $row['timestamp']).":00";
 			$entries .= "\t<entry>\n";
 			$entries .= "\t\t<title>".htmlentities($row['subject'])."</title>\n";
 			$entries .= "\t\t<link rel=\"alternate\" type=\"text/html\" href=\"".$user['link']."entry/".$row['shortsubject']."\"/>\n";
diff --git a/components/contents.php b/components/contents.php
index 451911e2714257a3d526e5c410e0d7a1f351fbd9..8ef4da018ad1879c64d245445ac235a11821a0f2 100644
--- a/components/contents.php
+++ b/components/contents.php
@@ -10,7 +10,7 @@ function listdir($mypath, $recurse, $summaries) {
 		if ($file[0]!=".") {
 			$element = array();
 			if (!is_dir($base."static".$mypath."/".$file)) {
-				$pagename = ereg_replace("\.txt", "", $file);
+				$pagename = preg_replace("/\.txt/", "", $file);
 				if ($summaries) $element['summary'] = $DB->GetOne("select summary from static where path=?", array($mypath."/".$pagename));
 				if ($pagename!=@$lastdir) $output[$pagename]=str_replace("_", " ", $element);
 			} else {
diff --git a/components/email.php b/components/email.php
index fa151b7acae2171aa3bed1cbe3f97a01101a44d3..2d9c9a27934aede8f93de927c410ad24945ea90c 100644
--- a/components/email.php
+++ b/components/email.php
@@ -8,7 +8,7 @@ $subject = "Join request for user ".$_REQUEST['uname'];
 // Perform data integrity checks
 
 // Full name
-if (ereg("[:/<>]", $_REQUEST['realname'])) {
+if (preg_match("/[^\p{L}- ]/iu", $_REQUEST['realname'])) {
 	$body .= "<p>That's a suspiciously unusual-looking name, <strong>" . htmlentities($_REQUEST['realname']) . "</strong>.</p>\n";
 	$body .= "<p>Please click <em>Back</em> and correct it.</p>\n";
 } else {
@@ -18,14 +18,14 @@ if (!is_numeric($_REQUEST['student_number']) || strlen($_REQUEST['student_number
 	$body .= "<p>Please click <em>Back</em> and correct it.</p>\n";
 } else {
 // Email address
-	list($username, $maildomain) = split("@", $_REQUEST['email']);
+	list($username, $maildomain) = preg_split("/@/", $_REQUEST['email']);
 	if (!checkdnsrr($maildomain, "MX") && !checkdnsrr($maildomain)) {
 		$body .= "<p>The email address <strong>" . htmlentities($_REQUEST['email']) . "</strong> appears not to be valid.</p>\n";
 		$body .= "<p>Please click <em>Back</em> and correct it.</p>\n";
 	} else {
 // Username
 		// This test is rather inadequate. Needs improving
-		if (ereg("[:/<>]", $_REQUEST['uname'])) {
+		if (!preg_match("/^[a-z0-9_]*$/i", $_REQUEST['uname'])) {
 			$body .= "<p>Usernames can only contain letters, numbers and underscores(_).</p>\n";
 			$body .= "<p>Please click <em>Back</em> and choose a different one.</p>\n";
 		} else {
@@ -58,4 +58,4 @@ $smarty->assign("body", $body);
 $smarty->assign("title", "Joining");
 $pathlist[2] = "Joining";
 $smarty->assign("subselect", "Joining");
-?>
\ No newline at end of file
+?>
diff --git a/components/events.php b/components/events.php
index 830581f1562928170d096ce771522c34ab7effad..64c30c4434113eaa46acede94c2b02cad6a79330 100644
--- a/components/events.php
+++ b/components/events.php
@@ -13,7 +13,7 @@ $smarty->assign("event_categories", $eventcategories);
 $events_index = array_search("Events", $pathlist);
 
 if (isset($pathlist[$events_index + 1])) {
-	list($eventcat, $eventid) = split("_", $pathlist[$events_index + 1]);
+	list($eventcat, $eventid) = preg_split("/_/", $pathlist[$events_index + 1]);
 	if (!in_array($eventcat, $eventcategories)) {
 		trigger_error("Invalid category specified", E_USER_ERROR);
 		unset($eventcat, $eventid);
diff --git a/components/front.php b/components/front.php
index 9e1034a7edc5a55d1a1201e997a238dba55bd002..88fe8d8a6e8db4ca9c98b709519adb682abb60b6 100644
--- a/components/front.php
+++ b/components/front.php
@@ -8,7 +8,8 @@ $smarty->assign("body", $output);
 if (!$session->loggedin) {
 	$output = file_get_contents("../static/fragments/Join.txt");
 } else {
-	$output = "<div class=\"cbb\"><h3>You are logged in</h3><p>If you would like to contribute to the site or report a bug, please contact chckens or dez.</p></div>";
+//	$output = "<div class=\"cbb\"><h3>You are logged in</h3><p>If you would like to contribute to the site or report a bug, please contact chckens or dez.</p></div>";
+	$output = "<div class=\"cbb\"><h3>You are logged in</h3><p style=\"text-align: center;\">Why not join our <a href=\"#\" onclick=\"window.open('/mw/','Milliways','height=600,width=800,menubar=no,resizable=yes,location=no,directories=no,scrollbars=yes,status=no,toolbar=no')\" style=\"font-size: 150%; font-weight: bold; color: #ffc62b;\">Live Chat</a>?</p></div>";
 //include('users.php');
 //$output .= $result;
 include('electionreminder.php');
diff --git a/components/mw.php b/components/mw.php
index e1aa3e14bcee6d07b433fb99437ae69f9c8bca49..cc6b7545aa40d9319ca3fd55f64f4b98f7026c08 100755
--- a/components/mw.php
+++ b/components/mw.php
@@ -94,9 +94,9 @@ function post_article($folder, $user, $replyto)
 	$subject = strip_tags($_POST['subject']);
 	$body = strip_tags( $_POST['body']);
 
-	$to = ereg_replace('[^[:alnum:][:punct:][:space:]]*','',trim($to));
-	$subject = ereg_replace('[^[:alnum:][:punct:][:space:]]*','',trim($subject));
-	$body = ereg_replace("\n\\.\n","\n .\n",$body);
+	$to = preg_replace('/[^[:alnum:][:punct:][:space:]]*/','',trim($to));
+	$subject = preg_replace('/[^[:alnum:][:punct:][:space:]]*/','',trim($subject));
+	$body = preg_replace("/\n\\.\n","\n .\n/",$body);
 
 	$deb = fopen("/tmp/mwdebug.txt","w");
 	fwrite($deb, "folder: '$folder'\n");
diff --git a/components/projects.php b/components/projects.php
index 66bcd43789ac9fc7a90bfb977b0095bfb467d4e0..401616dcb67d5b0b3dacf26e9839061dec0ac56a 100644
--- a/components/projects.php
+++ b/components/projects.php
@@ -20,7 +20,7 @@ foreach ($dirlist as $file) {
 				} else if ($projectsection && (1 == preg_match("/^\[.*\]$/", trim($ini_line)))) {
 					$projectsection = FALSE;
 				} else if ($projectsection) { 
-					list($key, $value) = split("=", $ini_line);
+					list($key, $value) = preg_split("/=/", $ini_line);
 					$ini_array[trim($key)] = trim($value);
 				}
 			}
diff --git a/lib/blog/admin.lib.php b/lib/blog/admin.lib.php
index 11fae92618bd24c2ec8a409faa77cb55ba59b78a..38fb2eb8dcce8ccf27ea564c59adacfdf9a89130 100644
--- a/lib/blog/admin.lib.php
+++ b/lib/blog/admin.lib.php
@@ -774,7 +774,7 @@ class admin {
 		} 
 		//if we have an add action
 		elseif(isset($_POST['addnew'])) {
-			if(trim($_POST['name'])=="" or !eregi("^([a-z0-9]+([:space:][a-z0-9]*))$",trim($_POST['name']))) {
+			if(trim($_POST['name'])=="" or !preg_match("/^([a-z0-9]+([:space:][a-z0-9]*))$/i",trim($_POST['name']))) {
 				$this->error = _("Check name");
 			}
 			if(!validEmail($_POST['email'])) {
diff --git a/lib/blog/blog.lib.php b/lib/blog/blog.lib.php
index bbdc8a816ec72ba4f1fbdbf8e33adf230264bdbe..5eff1d9e4f40d2d1f74c22f929ca11ec08c2a7ec 100644
--- a/lib/blog/blog.lib.php
+++ b/lib/blog/blog.lib.php
@@ -621,7 +621,7 @@ class blogs {
 		}
 		//sanitse author
 		if (isset($_POST['author']) && trim($_POST['author']) != "") {
-			if(eregi("^([a-z0-9]+ *)+$", $_POST['author'])) {
+			if(preg_match("/^([a-z0-9]+ *)+$/i", $_POST['author'])) {
 				$author = addslashes(nl2br(trim(strip_tags($_POST['author']))));
 			} else {
 				$this->commentError = _("Invalid name. We only allow alphanumeric names!");
diff --git a/lib/blog/miscfunctions.lib.php b/lib/blog/miscfunctions.lib.php
index 0e932d92b025593caf4d6d4b9947b7e59c6339a1..96d87f1c3043c2dfbe3b3694fc3828d8c83aeeac 100644
--- a/lib/blog/miscfunctions.lib.php
+++ b/lib/blog/miscfunctions.lib.php
@@ -75,9 +75,9 @@ function getSVNRevision()
 function checkSpamURLs($text) {
 	$spam = false;
 	//find urls, ugly but works
-	while (ereg("http://[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}",$text,$match)) {
+	while (preg_match("/http://[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}/",$text,$match)) {
 		$matches[] = $match[0];
-		$text = ereg_replace($match[0],"",$text);
+		$text = preg_replace("/".$match[0]."/","",$text); //Can this be replaced with str_replace?
 	}
 	//pull in list of two level tlds, make an array from them. from http://spamcheck.freeapp.net/two-level-tlds
 	$twoLevelTLD = file("/var/www/sucssite/lib/blog/two-level-tlds");
diff --git a/lib/blog/validation.lib.php b/lib/blog/validation.lib.php
index 401a1798791df77b8138bfbdbf53bf6b86f942be..a8d149e3c03aca06ba660b8ab8d649dc559e5bd1 100644
--- a/lib/blog/validation.lib.php
+++ b/lib/blog/validation.lib.php
@@ -3,7 +3,7 @@
 function safeuname($name)
 {
 	if (strlen($name) < 2) return FALSE;
-	return ereg("^[a-z][a-z0-9_]*$", $name);
+	return preg_match("/^[a-z][a-z0-9_]*$/i", $name);
 }
 
 // Find out if a given user has a blog
diff --git a/lib/sanitization.php b/lib/sanitization.php
index 04c444cb075fd4113febd1c0e51b1108aa2c1848..0929059a411380dcff89aa4f3985e9effb1527c1 100644
--- a/lib/sanitization.php
+++ b/lib/sanitization.php
@@ -1,6 +1,6 @@
 <?
 function sanitizePhone($phone){
-	return ereg_replace("[ ()]", "", $phone);
+	return preg_replace("/[ ()]/", "", $phone);
 }
 function sanitizeAddress($address){
 	return str_replace(array("\r\n","\r"),array("\n","\n"),$address);
diff --git a/lib/session.php b/lib/session.php
index da7c10845444ad7fc65e2eb63efd161942f8a248..f462039fb155d1df4ad3de219e3238b47883a4ed 100644
--- a/lib/session.php
+++ b/lib/session.php
@@ -230,7 +230,7 @@ private $datahash='';		// hash of data field
 
 		if (file_exists($info['homedirectory'][0]."/.forward")) {
 			$forward = file($info['homedirectory'][0]."/.forward");
-			$this->email_forward = ereg_replace("\n", "", $forward[0]);
+			$this->email_forward = preg_replace("/\n/", "", $forward[0]);
 		}
 
 		$this->fullname = $info['cn'][0];
diff --git a/lib/validation.php b/lib/validation.php
index c4790aae50c1a81b76a605d8ad237e07010205fa..6561ba3098c2404ba174b19d724fe31ad789ea2b 100644
--- a/lib/validation.php
+++ b/lib/validation.php
@@ -10,7 +10,7 @@ function validEmail ($email)
 	//split user and domain
 	list($user,$domain) = explode("@", $email);
 	// check for bad characters, and check for zero length user & domain
-	if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$email) or !$user or !$domain )
+	if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",$email) or !$user or !$domain )
 	{
 		$error = 'an invalid email address (syntax)';
 		return false;
@@ -128,7 +128,7 @@ function sidUsed($sid){
 function validUsername ($username){
 	global $error;
 	// check if uname is sytactically valid
-	$syntax = ereg("^[a-z][a-z0-9_]*$", $username);
+	$syntax = preg_match("/^[a-z][a-z0-9_]*$/", $username);
 	if(!$syntax || (strlen($username) < 2)){
 		$error = "Usernames must start with a letter, only contain lowercase letter, numbers 0-9 and underscores (_) and be at least 2 characters.";
 		return false;
@@ -196,7 +196,7 @@ function validRealName($realName,$override){
 			return false;
 	        }
 	        //check for a sane realname, see comment below
-		elseif (!ereg("^([A-Z]([.]+ +[A-Z])*([\']+[A-Z])*[a-z]+[ -]*)+$", $realName))
+		elseif (!preg_match("/^([A-Z]([.]+ +[A-Z])*([\']+[A-Z])*[a-z]+[ -]*)+$/", $realName))
 	        {
 			$error = "Name incorrectly formated, email <a href=\"mailto:admin@sucs.org\">admin@sucs.org</a> if this is an error.";
 			return false;
@@ -241,7 +241,7 @@ function validSocName($socname,$override){
 		}
 	}
 	else{
-		if(!ereg('^[A-Z1-9]',$socname) || strlen($socname) < 2){
+		if(!preg_match('/^[A-Z1-9]/',$socname) || strlen($socname) < 2){
 			$error = "Must start with a capital letter or a number and be more than 1 character";
 			return false;
 		}
@@ -254,7 +254,7 @@ function validSocName($socname,$override){
 function validAddress($address){
 	global $error;
 	$address = sanitizeAddress($address);
-        if(!ereg("^([A-Z0-9]([[:alnum:]]|[ ./'-])*\n)+[A-Z0-9]([[:alnum:]]|[ ./'-])*$",$address)){
+        if(!preg_match("/^([A-Z0-9]([[:alnum:]]|[ ./'-])*\n)+[A-Z0-9]([[:alnum:]]|[ ./'-])*$/",$address)){
                 $error = "Please supply at least two valid lines of address.";
                 return false;
         }   
@@ -266,7 +266,7 @@ function validAddress($address){
 function validPhone($phone){
 	global $error;
 	$phone=sanitizePhone($phone);
-	if(!ereg("^\+?[0-9-]+$",$phone)){
+	if(!preg_match("/^\+?[0-9-]+$/",$phone)){
 		$error = "Must be all numbers";
 		return false;
 	}
@@ -274,7 +274,7 @@ function validPhone($phone){
 }
 function validSignupEmail($email){
 	global $error;
-	if(ereg('@sucs\.org$',$email)){
+	if(preg_match('/@sucs\.org$/',$email)){
 		$error = "SUCS email addresses are not allowed";
 		return false;
 	}