about summary refs log tree commit diff stats
path: root/central/trunk/index.php
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2008-09-28 22:53:48 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-09-28 22:53:48 +0000
commit6f881a9f11d80e2bc27ec5ade72ac55eaef495c6 (patch)
tree735a8f7c59ffb5d0c8f442a80c3bd9d5e92689b1 /central/trunk/index.php
parent9c696344683332400000e40c2c54dc98e98d947b (diff)
downloadinstadisc-6f881a9f11d80e2bc27ec5ade72ac55eaef495c6.tar.gz
instadisc-6f881a9f11d80e2bc27ec5ade72ac55eaef495c6.tar.bz2
instadisc-6f881a9f11d80e2bc27ec5ade72ac55eaef495c6.zip
Central: Added createUser()
Refs #63
Diffstat (limited to 'central/trunk/index.php')
-rw-r--r--central/trunk/index.php33
1 files changed, 32 insertions, 1 deletions
diff --git a/central/trunk/index.php b/central/trunk/index.php index ea77e3f..1d85fa1 100644 --- a/central/trunk/index.php +++ b/central/trunk/index.php
@@ -246,6 +246,36 @@ function countSubscribers($url)
246 return new xmlrpcresp(new xmlrpcval($cntsub3[0], 'int')); 246 return new xmlrpcresp(new xmlrpcval($cntsub3[0], 'int'));
247} 247}
248 248
249function createUser($username, $password)
250{
251 $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\"";
252 $getuser2 = mysql_query($getuser);
253 $getuser3 = mysql_fetch_array$($getuser2);
254 if ($getuser3['username'] == $username)
255 {
256 $ij = 0;
257
258 while ($ij == 0)
259 {
260 $fakeUN = $username . rand(10,9999);
261
262 $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($fakeUN) . "\"";
263 $getuser2 = mysql_query($getuser);
264 $getuser3 = mysql_fetch_array$($getuser2);
265 if ($getuser3['username'] != $username)
266 {
267 $ij = 1;
268 }
269 }
270
271 return new xmlrpcresp(new xmlrpcval($fakeUN, 'string'));
272 } else {
273 instaDisc_createUser($username, $password);
274
275 return new xmlrpcresp(new xmlrpcval($username, 'string'));
276 }
277}
278
249$s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function" => "checkRegistration"), 279$s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function" => "checkRegistration"),
250 "InstaDisc.deleteItem" => array("function" => "deleteItem"), 280 "InstaDisc.deleteItem" => array("function" => "deleteItem"),
251 "InstaDisc.resendItem" => array("function" => "resendItem"), 281 "InstaDisc.resendItem" => array("function" => "resendItem"),
@@ -258,7 +288,8 @@ $s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function"
258 "InstaDisc.setDownloadItemMode" => array("function" => "setDownloadItemMode"), 288 "InstaDisc.setDownloadItemMode" => array("function" => "setDownloadItemMode"),
259 "InstaDisc.initalizePort" => array("function" => "initalizePort"), 289 "InstaDisc.initalizePort" => array("function" => "initalizePort"),
260 "InstaDisc.deinitalizePort" => array("function" => "deinitalizePort"), 290 "InstaDisc.deinitalizePort" => array("function" => "deinitalizePort"),
261 "InstaDisc.countSubscribers" => array("function" => "countSubscribers") 291 "InstaDisc.countSubscribers" => array("function" => "countSubscribers"),
292 "InstaDisc.createUser" => array("function" => "createUser")
262 ),0); 293 ),0);
263$s->functions_parameters_type = 'phpvals'; 294$s->functions_parameters_type = 'phpvals';
264$s->service(); 295$s->service();