about summary refs log tree commit diff stats
path: root/series/trunk/includes/instadisc.php
diff options
context:
space:
mode:
Diffstat (limited to 'series/trunk/includes/instadisc.php')
-rw-r--r--series/trunk/includes/instadisc.php167
1 files changed, 0 insertions, 167 deletions
diff --git a/series/trunk/includes/instadisc.php b/series/trunk/includes/instadisc.php deleted file mode 100644 index f4aed39..0000000 --- a/series/trunk/includes/instadisc.php +++ /dev/null
@@ -1,167 +0,0 @@
1<?php
2
3/* InstaDisc Series - A Four Island Project */
4
5include('includes/db.php');
6include('includes/template.php');
7include('includes/xmlrpc/xmlrpc.inc');
8include('includes/xmlrpc/xmlrpcs.inc');
9
10function instaDisc_subscriptionExists($id)
11{
12 $getsub = "SELECT * FROM subscriptions WHERE identity = \"" . mysql_real_escape_string($id) . "\"";
13 $getsub2 = mysql_query($getsub);
14 $getsub3 = mysql_fetch_array($getsub2);
15 if ($getsub3['identity'] != $id)
16 {
17 return 'false';
18 } else {
19 return 'true';
20 }
21}
22
23function instaDisc_getSubscription($id)
24{
25 $getsub = "SELECT * FROM subscriptions WHERE identity = \"" . mysql_real_escape_string($id) . "\"";
26 $getsub2 = mysql_query($getsub);
27 $getsub3 = mysql_fetch_array($getsub2);
28
29 return $getsub3;
30}
31
32function instaDisc_getAllSubscriptions()
33{
34 $getsubs = "SELECT * FROM subscriptions";
35 $getsubs2 = mysql_query($getsubs);
36 $i=0;
37 while ($getsubs3[$i] = mysql_fetch_array($getsubs2))
38 {
39 $i++;
40 }
41
42 return $getsubs3;
43}
44
45function instaDisc_getConfig($name)
46{
47 $getconfig = "SELECT * FROM config WHERE name = \"" . mysql_real_escape_string($name) . "\"";
48 $getconfig2 = mysql_query($getconfig);
49 $getconfig3 = mysql_fetch_array($getconfig2);
50
51 return $getconfig3['value'];
52}
53
54function instaDisc_verifyUser($username, $password)
55{
56 $getusers = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\" AND password = \"" . mysql_real_escape_string(md5($password)) . "\"";
57 $getusers2 = mysql_query($getusers);
58 $getusers3 = mysql_fetch_array($getusers2);
59
60 return ($getusers3['username'] == $username);
61}
62
63function instaDisc_changePassword($username, $password)
64{
65 $setconfig = "UPDATE users SET password = \"" . mysql_real_escape_string(md5($password)) . "\" WHERE username = \"" . mysql_real_escape_string($username) . "\"";
66 $setconfig2 = mysql_query($setconfig);
67 $setconfig3 = mysql_fetch_array($setconfig2);
68}
69
70function instaDisc_initSubscription($username, $subscriptionID, $subscriptionURL, $subscriptionTitle, $subscriptionCategory, $subscriptionPassword)
71{
72 $getuser = "SELECT * FROM users WHERE username = \"" . $username . "\"";
73 $getuser2 = mysql_query($getuser);
74 $getuser3 = mysql_fetch_array($getuser2);
75 if ($getuser3['username'] == $username)
76 {
77 $getsub = "SELECT * FROM subscriptions WHERE identity = \"" . mysql_real_escape_string($subscriptionID) . "\"";
78 $getsub2 = mysql_query($getsub);
79 $getsub3 = mysql_fetch_array($getsub2);
80 if ($getsub3['identity'] == $subscriptionID)
81 {
82 if (!instaDisc_isAdmin($username) && ($getsub3['username'] != $username))
83 {
84 return false;
85 }
86
87 $setsub = "UPDATE subscriptions SET title = \"" . mysql_real_escape_string($subscriptionTitle) . "\", url = \"" . mysql_real_escape_string($subscriptionURL) . "\", category = \"" . mysql_real_escape_string($subscriptionCategory) . "\", password = \"" . mysql_real_escape_string($subscriptionPassword) . "\" WHERE identity = \"" . mysql_real_escape_string($subscriptionID) . "\"";
88 $setsub2 = mysql_query($setsub);
89 } else {
90 $inssub = "INSERT INTO subscriptions (identity, title, url, category, username, password) VALUES (\"" . mysql_real_escape_string($subscriptionID) . "\",\"" . mysql_real_escape_string($subscriptionTitle) . "\",\"" . mysql_real_escape_string($subscriptionURL) . "\",\"" . mysql_real_escape_string($subscriptionCategory) . "\",\"" . mysql_real_escape_string($username) . "\",\"" . mysql_real_escape_string($subscriptionPassword) . "\")";
91 $inssub2 = mysql_query($inssub);
92 }
93
94 return true;
95 } else {
96 return false;
97 }
98}
99
100function instaDisc_listSubscriptions($username)
101{
102 $getsubs = "SELECT * FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\"";
103 $getsubs2 = mysql_query($getsubs);
104 $i=0;
105 while ($getsubs3[$i] = mysql_fetch_array($getsubs2))
106 {
107 $i++;
108 }
109
110 return $getsubs3;
111}
112
113function instaDisc_deleteSubscription($id)
114{
115 $delsub = "DELETE FROM subscriptions WHERE id = " . $id;
116 $delsub2 = mysql_query($delsub);
117}
118
119function instaDisc_isAdmin($username)
120{
121 return ($username == instaDisc_getConfig('adminUser'));
122}
123
124function instaDisc_getSubscriptionByID($id)
125{
126 $getsub = "SELECT * FROM subscriptions WHERE id = " . $id;
127 $getsub2 = mysql_query($getsub);
128 $getsub3 = mysql_fetch_array($getsub2);
129
130 return $getsub3;
131}
132
133function instaDisc_addUser($username, $password)
134{
135 $insuser = "INSERT INTO users (username,password) VALUES (\"" . mysql_real_escape_string($username) . "\",\"" . mysql_real_escape_string(md5($password)) . "\")";
136 $insuser2 = mysql_query($insuser);
137}
138
139function instaDisc_deleteUser($id)
140{
141 $deluser = "DELETE FROM users WHERE id = " . $id;
142 $deluser2 = mysql_query($deluser);
143}
144
145function instaDisc_getAllUsers()
146{
147 $getusers = "SELECT * FROM users";
148 $getusers2 = mysql_query($getusers);
149 $i=0;
150 while ($getusers3[$i] = mysql_fetch_array($getusers2))
151 {
152 $i++;
153 }
154
155 return $getusers3;
156}
157
158function instaDisc_getUserByID($id)
159{
160 $getuser = "SELECT * FROM users WHERE id = " . $id;
161 $getuser2 = mysql_query($getuser);
162 $getuser3 = mysql_fetch_array($getuser2);
163
164 return $getuser3;
165}
166
167?>