about summary refs log tree commit diff stats
path: root/central/trunk/xmlrpc.php
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2008-07-29 01:51:41 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-07-29 01:51:41 +0000
commita344edd79341baf78c61e337ecc588c1f6c9c597 (patch)
tree4885acaa2fc4b71450c694f192ee271708ec452d /central/trunk/xmlrpc.php
parent3bfabd220ce6c644168184a8464d78564adb05f5 (diff)
downloadinstadisc-a344edd79341baf78c61e337ecc588c1f6c9c597.tar.gz
instadisc-a344edd79341baf78c61e337ecc588c1f6c9c597.tar.bz2
instadisc-a344edd79341baf78c61e337ecc588c1f6c9c597.zip
Central Server: Started XML-RPC interface
Diffstat (limited to 'central/trunk/xmlrpc.php')
-rw-r--r--central/trunk/xmlrpc.php99
1 files changed, 99 insertions, 0 deletions
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 @@
1<?php
2
3/* InstaDisc Server - A Four Island Project */
4
5include('xmlrpc/xmlrpc.inc');
6include('xmlrpc/xmlrpcs.inc');
7include('db.php');
8include('instadisc.php');
9
10function checkRegistration($xmlrpcmsg)
11{
12 $username = $xmlrpcmsg->getParam(0)->scalarVal();
13 $verification = $xmlrpcmsg->getParam(1)->scalarVal();
14 $verificationID = $xmlrpcmsg->getParam(2)->scalarVal();
15
16 $getuser = "SELECT * FROM users WHERE username = \"" . $username "\"";
17 $getuser2 = mysql_query($getuser):
18 $getuser3 = mysql_fetch_array($getuser2);
19 if ($getuser3['username'] == $username)
20 {
21 $test = $username . ":" . $getuser3['password'] . ":" .$verificationID;
22 if (md5($test) == $verification)
23 {
24 return new xmlrpcresp(new xmlrpcval(0, "int"));
25 }
26 }
27
28 return new xmlrpcresp(new xmlrpcval(1, "int"));
29}
30
31function deleteItem($xmlrpcmsg)
32{
33 $username = $xmlrpcmsg->getParam(0)->scalarVal();
34 $verification = $xmlrpcmsg->getParam(1)->scalarVal();
35 $verificationID = $xmlrpcmsg->getParam(2)->scalarVal();
36 $id = $xmlrpcmsg->getParam(3)->scalarVal();
37
38 $getuser = "SELECT * FROM users WHERE username = \"" . $username "\"";
39 $getuser2 = mysql_query($getuser):
40 $getuser3 = mysql_fetch_array($getuser2);
41 if ($getuser3['username'] == $username)
42 {
43 $test = $username . ":" . $getuser3['password'] . ":" .$verificationID;
44 if (md5($test) == $verification)
45 {
46 $getitem = "SELECT * FROM inbox WHERE id = " . $id;
47 $getitem2 = mysql_query($getitem);
48 $getitem3 = mysql_fetch_array($getitem2);
49 if ($getitem3['id'] == $id)
50 {
51 $delitem = "DELETE inbox WHERE id = " . $id;
52 $delitem2 = mysql_query($delitem);
53
54 return new xmlrpcresp(new xmlrpcval(0, "int"));
55 }
56 }
57 }
58
59 return new xmlrpcresp(new xmlrpcval(1, "int"));
60}
61
62function resendItem($xmlrpcmsg)
63{
64 $username = $xmlrpcmsg->getParam(0)->scalarVal();
65 $verification = $xmlrpcmsg->getParam(1)->scalarVal();
66 $verificationID = $xmlrpcmsg->getParam(2)->scalarVal();
67 $id = $xmlrpcmsg->getParam(3)->scalarVal();
68
69 $getuser = "SELECT * FROM users WHERE username = \"" . $username "\"";
70 $getuser2 = mysql_query($getuser):
71 $getuser3 = mysql_fetch_array($getuser2);
72 if ($getuser3['username'] == $username)
73 {
74 $test = $username . ":" . $getuser3['password'] . ":" .$verificationID;
75 if (md5($test) == $verification)
76 {
77 $getitem = "SELECT * FROM inbox WHERE id = " . $id;
78 $getitem2 = mysql_query($getitem);
79 $getitem3 = mysql_fetch_array($getitem2);
80 if ($getitem3['id'] == $id)
81 {
82 instaDisc_sendItem($id);
83
84 return new xmlrpcresp(new xmlrpcval(0, "int"));
85 }
86 }
87 }
88
89 return new xmlrpcresp(new xmlrpcval(1, "int"));
90}
91
92$s = new xmlrpc_server(array(
93 "InstaDisc.checkRegistration" => array("function" => "checkRegistration"),
94 "InstaDisc.deleteItem" => array("function" => "deleteItem"),
95 "InstaDisc.resendItem" => array("function" => "resendItem"),
96 "InstaDisc.requestRetained" => array("function" => "requestRetained")
97 ));
98
99?>