diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-28 15:39:55 +0000 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-28 15:39:55 +0000 |
commit | ff65e9ee2f7145265dc9c3daacfc2d5fd0756d3f (patch) | |
tree | 3416983de2c7a93f98e576068c7af8e91176527a /central/trunk | |
parent | 0bed7609d62da9132801ff2dee9311e2edb9f934 (diff) | |
download | instadisc-ff65e9ee2f7145265dc9c3daacfc2d5fd0756d3f.tar.gz instadisc-ff65e9ee2f7145265dc9c3daacfc2d5fd0756d3f.tar.bz2 instadisc-ff65e9ee2f7145265dc9c3daacfc2d5fd0756d3f.zip |
Central: Completed step 9
Refs #69
Diffstat (limited to 'central/trunk')
-rw-r--r-- | central/trunk/includes/instadisc.php | 26 | ||||
-rw-r--r-- | central/trunk/xmlrpc.php | 27 |
2 files changed, 52 insertions, 1 deletions
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) | |||
237 | $setpass2 = mysql_query($setpass); | 237 | $setpass2 = mysql_query($setpass); |
238 | } | 238 | } |
239 | 239 | ||
240 | function instaDisc_initalizePort($username) | ||
241 | { | ||
242 | $getports = "SELECT * FROM users WHERE ip = \"" . mysql_real_escape_string($username) . "\" AND port <> 0 ORDER BY port ASC"; | ||
243 | $getports2 = mysql_query($getports); | ||
244 | $i=0; | ||
245 | while ($getports3[$i] = mysql_fetch_array($getports2)) | ||
246 | { | ||
247 | $i++; | ||
248 | } | ||
249 | |||
250 | if ($i==0) | ||
251 | { | ||
252 | $port = 1204; | ||
253 | } else if ($i>=4331) | ||
254 | { | ||
255 | return 0; | ||
256 | } else { | ||
257 | $port = (61204 + ($i-1)); | ||
258 | } | ||
259 | |||
260 | $setuser = "UPDATE users SET port = " . $port . " WHERE username = \"" . mysql_real_escape_string($username) . "\""; | ||
261 | $setuser2 = mysql_query($setuser); | ||
262 | |||
263 | return $port; | ||
264 | } | ||
265 | |||
240 | ?> | 266 | ?> |
diff --git a/central/trunk/xmlrpc.php b/central/trunk/xmlrpc.php index 466cae3..2e3aa62 100644 --- a/central/trunk/xmlrpc.php +++ b/central/trunk/xmlrpc.php | |||
@@ -153,6 +153,29 @@ function setDownloadItemMode($username, $verification, $verificationID, $mode) | |||
153 | return new xmlrpcresp(new xmlrpcval('1', 'int')); | 153 | return new xmlrpcresp(new xmlrpcval('1', 'int')); |
154 | } | 154 | } |
155 | 155 | ||
156 | function initalizePort($username, $verification, $verificationID) | ||
157 | { | ||
158 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) | ||
159 | { | ||
160 | return new xmlrpcresp(new xmlrpcval(instaDisc_initalizePort($username), 'int')); | ||
161 | } | ||
162 | |||
163 | return new xmlrpcresp(new xmlrpcval('0', 'int')); | ||
164 | } | ||
165 | |||
166 | function deinitalizePort($username, $verification, $verificationID) | ||
167 | { | ||
168 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) | ||
169 | { | ||
170 | $setuser = "UPDATE users SET port = 0 WHERE username = \"" . mysql_real_escape_string($username) . "\""; | ||
171 | $setuser2 = mysql_query($setuser); | ||
172 | |||
173 | return new xmlrpcresp(new xmlrpcval('0', 'int')); | ||
174 | } | ||
175 | |||
176 | return new xmlrpcresp(new xmlrpcval('1', 'int')); | ||
177 | } | ||
178 | |||
156 | $s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function" => "checkRegistration"), | 179 | $s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function" => "checkRegistration"), |
157 | "InstaDisc.deleteItem" => array("function" => "deleteItem"), | 180 | "InstaDisc.deleteItem" => array("function" => "deleteItem"), |
158 | "InstaDisc.resendItem" => array("function" => "resendItem"), | 181 | "InstaDisc.resendItem" => array("function" => "resendItem"), |
@@ -161,7 +184,9 @@ $s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function" | |||
161 | "InstaDisc.deleteSubscription" => array("function" => "deleteSubscription"), | 184 | "InstaDisc.deleteSubscription" => array("function" => "deleteSubscription"), |
162 | "InstaDisc.addSubscription" => array("function" => "addSubscription"), | 185 | "InstaDisc.addSubscription" => array("function" => "addSubscription"), |
163 | "InstaDisc.downloadItemModeTest" => array("function" => "downloadItemModeTest"), | 186 | "InstaDisc.downloadItemModeTest" => array("function" => "downloadItemModeTest"), |
164 | "InstaDisc.setDownloadItemMode" => array("function" => "setDownloadItemMode") | 187 | "InstaDisc.setDownloadItemMode" => array("function" => "setDownloadItemMode"), |
188 | "InstaDisc.initalizePort" => array("function" => "initalizePort"), | ||
189 | "InstaDisc.deinitalizePort" => array("function" => "deinitalizePort") | ||
165 | ),0); | 190 | ),0); |
166 | $s->functions_parameters_type = 'phpvals'; | 191 | $s->functions_parameters_type = 'phpvals'; |
167 | $s->service(); | 192 | $s->service(); |