From ff65e9ee2f7145265dc9c3daacfc2d5fd0756d3f Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 28 Sep 2008 15:39:55 +0000 Subject: Central: Completed step 9 Refs #69 --- central/trunk/includes/instadisc.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'central/trunk/includes/instadisc.php') diff --git a/central/trunk/includes/instadisc.php b/central/trunk/includes/instadisc.php index 003ad1b..1c4c968 100644 --- a/central/trunk/includes/instadisc.php +++ b/central/trunk/includes/instadisc.php @@ -237,4 +237,30 @@ function instaDisc_changePassword($username, $password) $setpass2 = mysql_query($setpass); } +function instaDisc_initalizePort($username) +{ + $getports = "SELECT * FROM users WHERE ip = \"" . mysql_real_escape_string($username) . "\" AND port <> 0 ORDER BY port ASC"; + $getports2 = mysql_query($getports); + $i=0; + while ($getports3[$i] = mysql_fetch_array($getports2)) + { + $i++; + } + + if ($i==0) + { + $port = 1204; + } else if ($i>=4331) + { + return 0; + } else { + $port = (61204 + ($i-1)); + } + + $setuser = "UPDATE users SET port = " . $port . " WHERE username = \"" . mysql_real_escape_string($username) . "\""; + $setuser2 = mysql_query($setuser); + + return $port; +} + ?> -- cgit 1.4.1