From a344edd79341baf78c61e337ecc588c1f6c9c597 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 29 Jul 2008 01:51:41 +0000 Subject: Central Server: Started XML-RPC interface --- central/trunk/xmlrpc.php | 99 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 central/trunk/xmlrpc.php (limited to 'central/trunk/xmlrpc.php') diff --git a/central/trunk/xmlrpc.php b/central/trunk/xmlrpc.php new file mode 100644 index 0000000..a057c12 --- /dev/null +++ b/central/trunk/xmlrpc.php @@ -0,0 +1,99 @@ +getParam(0)->scalarVal(); + $verification = $xmlrpcmsg->getParam(1)->scalarVal(); + $verificationID = $xmlrpcmsg->getParam(2)->scalarVal(); + + $getuser = "SELECT * FROM users WHERE username = \"" . $username "\""; + $getuser2 = mysql_query($getuser): + $getuser3 = mysql_fetch_array($getuser2); + if ($getuser3['username'] == $username) + { + $test = $username . ":" . $getuser3['password'] . ":" .$verificationID; + if (md5($test) == $verification) + { + return new xmlrpcresp(new xmlrpcval(0, "int")); + } + } + + return new xmlrpcresp(new xmlrpcval(1, "int")); +} + +function deleteItem($xmlrpcmsg) +{ + $username = $xmlrpcmsg->getParam(0)->scalarVal(); + $verification = $xmlrpcmsg->getParam(1)->scalarVal(); + $verificationID = $xmlrpcmsg->getParam(2)->scalarVal(); + $id = $xmlrpcmsg->getParam(3)->scalarVal(); + + $getuser = "SELECT * FROM users WHERE username = \"" . $username "\""; + $getuser2 = mysql_query($getuser): + $getuser3 = mysql_fetch_array($getuser2); + if ($getuser3['username'] == $username) + { + $test = $username . ":" . $getuser3['password'] . ":" .$verificationID; + if (md5($test) == $verification) + { + $getitem = "SELECT * FROM inbox WHERE id = " . $id; + $getitem2 = mysql_query($getitem); + $getitem3 = mysql_fetch_array($getitem2); + if ($getitem3['id'] == $id) + { + $delitem = "DELETE inbox WHERE id = " . $id; + $delitem2 = mysql_query($delitem); + + return new xmlrpcresp(new xmlrpcval(0, "int")); + } + } + } + + return new xmlrpcresp(new xmlrpcval(1, "int")); +} + +function resendItem($xmlrpcmsg) +{ + $username = $xmlrpcmsg->getParam(0)->scalarVal(); + $verification = $xmlrpcmsg->getParam(1)->scalarVal(); + $verificationID = $xmlrpcmsg->getParam(2)->scalarVal(); + $id = $xmlrpcmsg->getParam(3)->scalarVal(); + + $getuser = "SELECT * FROM users WHERE username = \"" . $username "\""; + $getuser2 = mysql_query($getuser): + $getuser3 = mysql_fetch_array($getuser2); + if ($getuser3['username'] == $username) + { + $test = $username . ":" . $getuser3['password'] . ":" .$verificationID; + if (md5($test) == $verification) + { + $getitem = "SELECT * FROM inbox WHERE id = " . $id; + $getitem2 = mysql_query($getitem); + $getitem3 = mysql_fetch_array($getitem2); + if ($getitem3['id'] == $id) + { + instaDisc_sendItem($id); + + return new xmlrpcresp(new xmlrpcval(0, "int")); + } + } + } + + return new xmlrpcresp(new xmlrpcval(1, "int")); +} + +$s = new xmlrpc_server(array( + "InstaDisc.checkRegistration" => array("function" => "checkRegistration"), + "InstaDisc.deleteItem" => array("function" => "deleteItem"), + "InstaDisc.resendItem" => array("function" => "resendItem"), + "InstaDisc.requestRetained" => array("function" => "requestRetained") + )); + +?> -- cgit 1.4.1