234 | * Set the ad server URL to the user passed URL argument.
235 | * If no argument is passed, look for the CustomAds meta data value in the manifest.
236 | * Defaults to ad server URL in string values.
237 | */
238 | private String getAdUrl() {
239 | if (adUrl.equals("")) {
240 | try {
241 | ApplicationInfo ai = mContext.getPackageManager().getApplicationInfo(mContext.getPackageName(), PackageManager.GET_META_DATA);
242 | Object value = ai.metaData.get("CustomAds");
243 | return value != null ? value.toString() : "";
244 | } catch (PackageManager.NameNotFoundException e) {
245 | e.printStackTrace();
246 | return mContext.getString(R.string.ad_url);
247 | } catch (NullPointerException e) {
248 | e.printStackTrace();
249 | return mContext.getString(R.string.ad_url);
250 | }
251 | }
252 |
253 | return adUrl;
254 | }
255 |
256 | /**
257 | * Get data passed by intent.
258 | */
259 | private void getData() {
260 | if (getArguments() != null) {
261 | Bundle bundle = getArguments();
262 | //Get ad server URL.
263 | if (bundle.getString(AdActivity.AD_URL) != null) {
264 | adUrl = bundle.getString(AdActivity.AD_URL);
265 | }
266 | }
267 | }
268 |
269 | public class MainAdapter extends RecyclerView.Adapter
Ad Added";
70 | }
71 | else
72 | {
73 | echo "\r
Ad Exists - Not Added";
74 | }
75 |
76 | unset($ad);
77 | echo "\r
Add Ad - END";
78 |
79 | } catch (Exception $e) {
80 |
81 | die ($e->getMessage());
82 | }
83 |
--------------------------------------------------------------------------------
/server/ads.get.php:
--------------------------------------------------------------------------------
1 | true,
17 | "error_code" => ERROR_UNKNOWN);
18 |
19 | $ads = new ads($dbo);
20 | $result = $ads->get($updateAt);
21 |
22 | echo json_encode($result);
23 | exit;
24 | }
25 |
--------------------------------------------------------------------------------
/server/class.ads.php:
--------------------------------------------------------------------------------
1 | setRequestFrom($requestFrom);
12 | }
13 |
14 | public function getAllCount()
15 | {
16 | $stmt = $this->db->prepare("SELECT count(*) FROM ads");
17 | $stmt->execute();
18 |
19 | return $number_of_rows = $stmt->fetchColumn();
20 | }
21 |
22 | public function getMaxIdAds()
23 | {
24 | $stmt = $this->db->prepare("SELECT MAX(id) FROM ads");
25 | $stmt->execute();
26 |
27 | return $number_of_rows = $stmt->fetchColumn();
28 | }
29 |
30 | public function exists($adsId)
31 | {
32 | $result = array("error" => true,
33 | "error_code" => ERROR_UNKNOWN);
34 |
35 | $stmt = $this->db->prepare("SELECT * FROM ads WHERE id = (:adsId) LIMIT 1");
36 | $stmt->bindParam(":adsId", $adsId, PDO::PARAM_INT);
37 |
38 | if ($stmt->execute()) {
39 |
40 | if ($stmt->rowCount() > 0) {
41 |
42 | $result = array("error" => false,
43 | "error_code" => ERROR_SUCCESS);
44 | }
45 | }
46 |
47 | return $result;
48 | }
49 |
50 | public function existsApp($app)
51 | {
52 | $result = array("error" => true,
53 | "error_code" => ERROR_UNKNOWN);
54 |
55 | $stmt = $this->db->prepare("SELECT * FROM ads WHERE packageName = (:packageName) LIMIT 1");
56 | $stmt->bindParam(":packageName", $app, PDO::PARAM_INT);
57 |
58 | if ($stmt->execute()) {
59 |
60 | if ($stmt->rowCount() > 0) {
61 |
62 | $result = array("error" => false,
63 | "error_code" => ERROR_SUCCESS);
64 | }
65 | }
66 |
67 | return $result;
68 | }
69 |
70 | public function info($adsId)
71 | {
72 | $result = array("error" => true,
73 | "error_code" => ERROR_UNKNOWN);
74 |
75 | $stmt = $this->db->prepare("SELECT * FROM ads WHERE id = (:adsId) LIMIT 1");
76 | $stmt->bindParam(":adsId", $adsId, PDO::PARAM_INT);
77 |
78 | if ($stmt->execute()) {
79 |
80 | if ($stmt->rowCount() > 0) {
81 |
82 | $row = $stmt->fetch();
83 |
84 | $result = array("error" => false,
85 | "id" => $row['id'],
86 | "fromUserId" => $row['fromUserId'],
87 | "adType" => $row['adType'],
88 | "status" => $row['status'],
89 | "segment" => $row['segment'],
90 | "location" => $row['location'],
91 | "deviceVersion" => $row['deviceVersion'],
92 | "weight" => $row['weight'],
93 | "price" => $row['price'],
94 | "title" => $row['title'],
95 | "subtitle" => $row['subtitle'],
96 | "description" => $row['description'],
97 | "descriptionShort" => $row['descriptionShort'],
98 | "category" => $row['category'],
99 | "rating" => $row['rating'],
100 | "installs" => $row['installs'],
101 | "version" => $row['version'],
102 | "developer" => $row['developer'],
103 | "email" => $row['email'],
104 | "address" => $row['address'],
105 | "website" => $row['website'],
106 | "linkUrl" => $row['linkUrl'],
107 | "packageName" => $row['packageName'],
108 | "previewImgUrl" => $row['previewImgUrl'],
109 | "imgUrl" => $row['imgUrl'],
110 | "previewVideoImgUrl" => $row['previewVideoImgUrl'],
111 | "videoUrl" => $row['videoUrl'],
112 | "text1" => $row['text1'],
113 | "text2" => $row['text2'],
114 | "text3" => $row['text3'],
115 | "number1" => $row['number1'],
116 | "number2" => $row['number2'],
117 | "number3" => $row['number3'],
118 | "createAt" => $row['createAt'],
119 | "updateAt" => $row['updateAt'],
120 | "startAt" => $row['startAt'],
121 | "endAt" => $row['endAt'],
122 | "removeAt" => $row['removeAt'],
123 | "views" => $row['views'],
124 | "clicks" => $row['clicks'],
125 | "sales" => $row['sales']);
126 | }
127 | }
128 |
129 | return $result;
130 | }
131 |
132 | public function add($ad)
133 | {
134 | $result = array("error" => false,
135 | "error_code" => ERROR_SUCCESS,
136 | "items" => array());
137 |
138 | $currentTime = time();
139 | $stmt = $this->db->prepare("INSERT INTO ads (fromUserId, adType, status, segment, location, deviceVersion,
140 | weight, price, title, subtitle, description, descriptionShort, category, rating, installs, version, developer, email, address,
141 | website, linkUrl, packageName, previewImgUrl, imgUrl, previewVideoImgUrl, videoUrl, text1, text2, text3, number1, number2,
142 | number3, createAt, updateAt, startAt, endAt) value (:fromUserId, :adType, :status, :segment, :location, :deviceVersion,
143 | :weight, :price, :title, :subtitle, :description, :descriptionShort, :category, :rating, :installs, :version, :developer,
144 | :email, :address, :website, :linkUrl, :packageName, :previewImgUrl, :imgUrl, :previewVideoImgUrl, :videoUrl, :text1, :text2,
145 | :text3, :number1, :number2, :number3, :createAt, :updateAt, :startAt, :endAt)");
146 | $stmt->bindParam('fromUserId', $ad['fromUserId'], PDO::PARAM_INT);
147 | $stmt->bindParam('adType', $ad['adType'], PDO::PARAM_INT);
148 | $stmt->bindParam('status', $ad['status'], PDO::PARAM_INT);
149 | $stmt->bindParam('segment', $ad['segment'], PDO::PARAM_STR);
150 | $stmt->bindParam('location', $ad['location'], PDO::PARAM_STR);
151 | $stmt->bindParam('deviceVersion', $ad['deviceVersion'], PDO::PARAM_INT);
152 | $stmt->bindParam('weight', $ad['weight'], PDO::PARAM_INT);
153 | $stmt->bindParam('price', $ad['price'], PDO::PARAM_INT);
154 | $stmt->bindParam('title', $ad['title'], PDO::PARAM_STR);
155 | $stmt->bindParam('subtitle', $ad['subtitle'], PDO::PARAM_STR);
156 | $stmt->bindParam('description', $ad['description'], PDO::PARAM_STR);
157 | $stmt->bindParam('descriptionShort', $ad['descriptionShort'], PDO::PARAM_STR);
158 | $stmt->bindParam('category', $ad['category'], PDO::PARAM_STR);
159 | $stmt->bindParam('rating', $ad['rating'], PDO::PARAM_STR);
160 | $stmt->bindParam('installs', $ad['installs'], PDO::PARAM_INT);
161 | $stmt->bindParam('version', $ad['version'], PDO::PARAM_STR);
162 | $stmt->bindParam('developer', $ad['developer'], PDO::PARAM_STR);
163 | $stmt->bindParam('email', $ad['email'], PDO::PARAM_STR);
164 | $stmt->bindParam('address', $ad['address'], PDO::PARAM_STR);
165 | $stmt->bindParam('website', $ad['website'], PDO::PARAM_STR);
166 | $stmt->bindParam('linkUrl', $ad['linkUrl'], PDO::PARAM_STR);
167 | $stmt->bindParam('packageName', $ad['packageName'], PDO::PARAM_STR);
168 | $stmt->bindParam('previewImgUrl', $ad['previewImgUrl'], PDO::PARAM_STR);
169 | $stmt->bindParam('imgUrl', $ad['imgUrl'], PDO::PARAM_STR);
170 | $stmt->bindParam('previewVideoImgUrl', $ad['previewVideoImgUrl'], PDO::PARAM_STR);
171 | $stmt->bindParam('videoUrl', $ad['videoUrl'], PDO::PARAM_STR);
172 | $stmt->bindParam('text1', $ad['text1'], PDO::PARAM_STR);
173 | $stmt->bindParam('text2', $ad['text2'], PDO::PARAM_STR);
174 | $stmt->bindParam('text3', $ad['text3'], PDO::PARAM_STR);
175 | $stmt->bindParam('number1', $ad['number1'], PDO::PARAM_INT);
176 | $stmt->bindParam('number2', $ad['number2'], PDO::PARAM_INT);
177 | $stmt->bindParam('number3', $ad['number3'], PDO::PARAM_INT);
178 | $stmt->bindParam('createAt', $currentTime, PDO::PARAM_INT);
179 | $stmt->bindParam('updateAt', $currentTime, PDO::PARAM_INT);
180 | $stmt->bindParam('startAt', $ad['startAt'], PDO::PARAM_INT);
181 | $stmt->bindParam('endAt', $ad['endAt'], PDO::PARAM_INT);
182 |
183 | if ($stmt->execute()) {
184 |
185 | $result = array("error" => false,
186 | "error_code" => ERROR_SUCCESS,
187 | "itemId" => $this->db->lastInsertId(),
188 | "item" => $this->info($this->db->lastInsertId()));
189 | }
190 |
191 | return $result;
192 | }
193 |
194 | public function get($updateAt = 0)
195 | {
196 | $result = array("error" => false,
197 | "error_code" => ERROR_SUCCESS,
198 | "items" => array());
199 |
200 | $currentTime = time();
201 | $stmt = $this->db->prepare("SELECT * FROM ads WHERE removeAt = 0 AND updateAt > (:updateAt) AND endAt > (:currentTime) ORDER BY id DESC");
202 | $stmt->bindParam(':updateAt', $updateAt, PDO::PARAM_INT);
203 | $stmt->bindParam(':currentTime', $currentTime, PDO::PARAM_INT);
204 |
205 | if ($stmt->execute()) {
206 |
207 | if ($stmt->rowCount() > 0) {
208 |
209 | while ($row = $stmt->fetch()) {
210 |
211 | $ad = array("id" => $row['id'],
212 | "fromUserId" => $row['fromUserId'],
213 | "adType" => $row['adType'],
214 | "status" => $row['status'],
215 | "segment" => $row['segment'],
216 | "location" => $row['location'],
217 | "deviceVersion" => $row['deviceVersion'],
218 | "weight" => $row['weight'],
219 | "price" => $row['price'],
220 | "title" => $row['title'],
221 | "subtitle" => $row['subtitle'],
222 | "description" => $row['description'],
223 | "descriptionShort" => $row['descriptionShort'],
224 | "category" => $row['category'],
225 | "rating" => $row['rating'],
226 | "installs" => $row['installs'],
227 | "version" => $row['version'],
228 | "developer" => $row['developer'],
229 | "email" => $row['email'],
230 | "address" => $row['address'],
231 | "website" => $row['website'],
232 | "linkUrl" => $row['linkUrl'],
233 | "packageName" => $row['packageName'],
234 | "previewImgUrl" => $row['previewImgUrl'],
235 | "imgUrl" => $row['imgUrl'],
236 | "previewVideoImgUrl" => $row['previewVideoImgUrl'],
237 | "videoUrl" => $row['videoUrl'],
238 | "text1" => $row['text1'],
239 | "text2" => $row['text2'],
240 | "text3" => $row['text3'],
241 | "number1" => $row['number1'],
242 | "number2" => $row['number2'],
243 | "number3" => $row['number3'],
244 | "createAt" => $row['createAt'],
245 | "updateAt" => $row['updateAt'],
246 | "startAt" => $row['startAt'],
247 | "endAt" => $row['endAt'],
248 | "removeAt" => $row['removeAt']);
249 |
250 | array_push($result['items'], $ad);
251 | unset($ad);
252 | }
253 | }
254 | }
255 |
256 | return $result;
257 | }
258 |
259 | public function removeByUser($fromUserId)
260 | {
261 |
262 | $result = array("error" => true,
263 | "error_code" => ERROR_UNKNOWN,
264 | "count" => 0);
265 |
266 | $stmt = $this->db->prepare("SELECT id FROM ads WHERE fromUserId = (:fromUserId) AND removeAt = 0");
267 | $stmt->bindParam(':fromUserId', $fromUserId, PDO::PARAM_STR);
268 |
269 | if ($stmt->execute()) {
270 |
271 | while ($row = $stmt->fetch()) {
272 |
273 | $this->remove($row['id']);
274 | }
275 |
276 | $result = array("error" => false,
277 | "error_code" => ERROR_SUCCESS,
278 | "count" => $stmt->rowCount());
279 | }
280 |
281 | return $result;
282 | }
283 |
284 | public function remove($adsId)
285 | {
286 | $result = array("error" => true);
287 |
288 | $itemInfo = $this->exists($adsId);
289 |
290 | if ($itemInfo['error'] === true) {
291 |
292 | return $result;
293 | }
294 |
295 | $currentTime = time();
296 |
297 | $stmt = $this->db->prepare("UPDATE ads SET removeAt = (:removeAt) WHERE id = (:adsId)");
298 | $stmt->bindParam(":adsId", $adsId, PDO::PARAM_INT);
299 | $stmt->bindParam(":removeAt", $currentTime, PDO::PARAM_INT);
300 |
301 | if ($stmt->execute()) {
302 |
303 | $result = array("error" => false);
304 | }
305 |
306 | return $result;
307 | }
308 |
309 | public function setLanguage($language)
310 | {
311 | $this->language = $language;
312 | }
313 |
314 | public function getLanguage()
315 | {
316 | return $this->language;
317 | }
318 |
319 | public function setRequestFrom($requestFrom)
320 | {
321 | $this->requestFrom = $requestFrom;
322 | }
323 |
324 | public function getRequestFrom()
325 | {
326 | return $this->requestFrom;
327 | }
328 | }
329 |
--------------------------------------------------------------------------------
/server/class.api.php:
--------------------------------------------------------------------------------
1 | true,
12 | "error_code" => $error_code,
13 | "error_description" => $error_description);
14 |
15 | echo json_encode($result);
16 | exit;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/server/class.db_connect.php:
--------------------------------------------------------------------------------
1 | db = $db;
11 |
12 | } else {
13 |
14 | $dsn = "mysql:host=".DB_HOST.";dbname=".DB_NAME;
15 |
16 | try {
17 |
18 | $this->db = new PDO($dsn, DB_USER, DB_PASS, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8mb4"));
19 |
20 | } catch (Exception $e) {
21 |
22 | die ($e->getMessage());
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/server/class.helper.php:
--------------------------------------------------------------------------------
1 | real_escape_string($text);
37 |
38 | return $text;
39 | }
40 |
41 | function clean($string) {
42 |
43 | $string = str_replace(' ', '', $string); // Replaces all spaces with hyphens.
44 |
45 | return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
46 | }
47 |
48 | static function clearInt($value)
49 | {
50 | $value = intval($value);
51 | if ($value < 0) {
52 |
53 | $value = 0;
54 | }
55 |
56 | return $value;
57 | }
58 |
59 | static function ip_addr()
60 | {
61 | (string) $ip_addr = 'undefined';
62 |
63 | if (isset($_SERVER['REMOTE_ADDR'])) $ip_addr = $_SERVER['REMOTE_ADDR'];
64 |
65 | return $ip_addr;
66 | }
67 |
68 | static function u_agent()
69 | {
70 | (string) $u_agent = 'undefined';
71 |
72 | if (isset($_SERVER['HTTP_USER_AGENT'])) $u_agent = $_SERVER['HTTP_USER_AGENT'];
73 |
74 | return $u_agent;
75 | }
76 | }
77 |
78 |
--------------------------------------------------------------------------------
/server/db.php:
--------------------------------------------------------------------------------
1 | $val) {
5 |
6 | define($name, $val);
7 | }
8 |
9 | foreach ($B as $name => $val) {
10 |
11 | define($name, $val);
12 | }
13 |
14 | $dsn = "mysql:host=".DB_HOST.";dbname=".DB_NAME;
15 | $dbo = new PDO($dsn, DB_USER, DB_PASS, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8mb4"));
16 |
17 | function __autoload($class)
18 | {
19 | $filename = "class.".$class.".php";
20 |
21 | if (file_exists($filename)) {
22 |
23 | include_once($filename);
24 | }
25 | }
--------------------------------------------------------------------------------
/server/initialize.php:
--------------------------------------------------------------------------------
1 | prepare("CREATE TABLE IF NOT EXISTS ads (
33 | id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
34 | fromUserId int(11) UNSIGNED DEFAULT 0,
35 | adType int(11) UNSIGNED DEFAULT 0,
36 | status int(11) UNSIGNED DEFAULT 0,
37 | segment VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
38 | location VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
39 | deviceVersion int(11) UNSIGNED DEFAULT 0,
40 | weight int(11) UNSIGNED DEFAULT 0,
41 | price int(11) UNSIGNED DEFAULT 0,
42 | title varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
43 | subtitle varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
44 | description varchar(4000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
45 | descriptionShort varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
46 | category VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
47 | rating DECIMAL(4, 3) NOT NULL DEFAULT 5.0,
48 | installs int(11) UNSIGNED DEFAULT 0,
49 | version VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
50 | developer VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
51 | email VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
52 | address VARCHAR(80) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
53 | website VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
54 | linkUrl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
55 | packageName VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
56 | previewImgUrl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
57 | imgUrl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
58 | previewVideoImgUrl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
59 | videoUrl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
60 | text1 VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
61 | text2 VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
62 | text3 VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
63 | number1 int(11) UNSIGNED DEFAULT 0,
64 | number2 int(11) UNSIGNED DEFAULT 0,
65 | number3 int(11) UNSIGNED DEFAULT 0,
66 | createAt int(11) UNSIGNED DEFAULT 0,
67 | updateAt int(11) UNSIGNED DEFAULT 0,
68 | startAt int(11) UNSIGNED DEFAULT 0,
69 | endAt int(11) UNSIGNED DEFAULT 0,
70 | removeAt int(11) UNSIGNED DEFAULT 0,
71 | views int(11) UNSIGNED DEFAULT 0,
72 | clicks int(11) UNSIGNED DEFAULT 0,
73 | sales int(11) UNSIGNED DEFAULT 0,
74 | PRIMARY KEY (id)) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci");
75 | if ($sth->execute())
76 | {
77 | echo "\r
Ads Table Creation - SUCCESS";
78 | }
79 | else
80 | {
81 | echo "\r
Ads Table Creation - FAILED";
82 | }
83 |
84 | /*
85 | * Extra Ad Images Table
86 | * id - primary key.
87 | * adId - id of ad the image is tied to.
88 | * imgUrl, previewImageUrl - high and low res ad images.
89 | * createAt - image created time in UTC.
90 | * removeAt - image removed time.
91 | */
92 | $sth = $dbo->prepare("CREATE TABLE IF NOT EXISTS images (
93 | id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
94 | adId int(11) UNSIGNED DEFAULT 0,
95 | previewImgUrl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
96 | imgUrl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
97 | createAt int(11) UNSIGNED DEFAULT 0,
98 | removeAt int(11) UNSIGNED DEFAULT 0,
99 | PRIMARY KEY (id)) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci");
100 | if ($sth->execute())
101 | {
102 | echo "\r
Images Table Creation - SUCCESS";
103 | }
104 | else
105 | {
106 | echo "\r
Images Table Creation - FAILED";
107 | }
108 |
109 | /*
110 | * Users Table
111 | * id - primary key.
112 | * advertisingId - unique user identifier.
113 | * accessToken - generated security token.
114 | * fcm_regid - Android FCM id.
115 | * ios_fcm_regid - iOS FCM id.
116 | * firstname, lastname, fullname, username - user data.
117 | * createAt - user creation time in UTC.
118 | * updateAt - user updated time.
119 | * u_agent - user device info.
120 | * ip_addr - user ip address.
121 | */
122 | $sth = $dbo->prepare("CREATE TABLE IF NOT EXISTS users (
123 | id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
124 | advertisingId varchar(50) DEFAULT '',
125 | accessToken varchar(50) DEFAULT '',
126 | gcm_regid TEXT,
127 | ios_fcm_regid TEXT,
128 | firstname VARCHAR(75) NOT NULL DEFAULT '',
129 | lastname VARCHAR(75) NOT NULL DEFAULT '',
130 | fullname VARCHAR(150) NOT NULL DEFAULT '',
131 | username VARCHAR(50) NOT NULL DEFAULT '',
132 | createAt int(11) UNSIGNED DEFAULT 0,
133 | updateAt int(11) UNSIGNED DEFAULT 0,
134 | u_agent varchar(300) DEFAULT '',
135 | ip_addr CHAR(32) NOT NULL DEFAULT '',
136 | PRIMARY KEY (id), UNIQUE KEY (advertisingId)) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci");
137 | if ($sth->execute())
138 | {
139 | echo "\r
Users Table Creation - SUCCESS";
140 | }
141 | else
142 | {
143 | echo "\r
Users Table Creation - FAILED";
144 | }
145 |
146 | /*
147 | * Ad Request Log Table
148 | * id - primary key.
149 | * accountId - id of user requesting ad.
150 | * accessToken - generated security token.
151 | * createAt - ad request time in UTC.
152 | * u_agent - user device info.
153 | * ip_addr - user ip address.
154 | */
155 | $sth = $dbo->prepare("CREATE TABLE IF NOT EXISTS access_data (
156 | id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
157 | accountId int(11) UNSIGNED NOT NULL,
158 | accessToken varchar(50) DEFAULT '',
159 | createAt int(10) UNSIGNED DEFAULT 0,
160 | u_agent varchar(300) DEFAULT '',
161 | ip_addr CHAR(32) NOT NULL DEFAULT '',
162 | PRIMARY KEY (id)) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci");
163 | if ($sth->execute())
164 | {
165 | echo "\r
Access Table Creation - SUCCESS";
166 | }
167 | else
168 | {
169 | echo "\r
Access Table Creation - FAILED";
170 | }
171 |
172 | /*
173 | * Ad Analytics Events Table
174 | * id - primary key.
175 | * accountId - id of user analytic event is tied to.
176 | * analytics_type - category type of analytics event (e.g. click, view, sale)
177 | * statId - id of ad analytic event is tied to.
178 | * statInt - integer stat value.
179 | * statText - text stat value.
180 | * notifyId - internal notification id.
181 | * createAt - analytic event created time in UTC.
182 | * removeAt - analytic event remove time.
183 | * u_agent - user device info.
184 | * ip_addr - user ip address.
185 | */
186 | $sth = $dbo->prepare("CREATE TABLE IF NOT EXISTS analytics (
187 | id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
188 | accountId int(11) UNSIGNED DEFAULT 0,
189 | analytics_type int(11) UNSIGNED DEFAULT 0,
190 | statId int(11) UNSIGNED DEFAULT 0,
191 | statInt int(11) UNSIGNED DEFAULT 0,
192 | statText varchar(50) DEFAULT '',
193 | notifyId int(11) UNSIGNED DEFAULT 0,
194 | createAt int(11) UNSIGNED DEFAULT 0,
195 | removeAt int(11) UNSIGNED DEFAULT 0,
196 | u_agent varchar(300) DEFAULT '',
197 | ip_addr CHAR(32) NOT NULL DEFAULT '',
198 | PRIMARY KEY (id)) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci");
199 | if ($sth->execute())
200 | {
201 | echo "\r
Analytics Table Creation - SUCCESS";
202 | }
203 | else
204 | {
205 | echo "\r
Analytics Table Creation - FAILED";
206 | }
207 |
208 | echo "\r
Database Creation - END";
209 |
210 | include 'sampledata.php';
211 |
212 | } catch (Exception $e) {
213 |
214 | die ($e->getMessage());
215 | }
216 |
--------------------------------------------------------------------------------
/server/sampledata.php:
--------------------------------------------------------------------------------
1 | Sample Data Creation - START";
5 |
6 | $currentTime = time();
7 | $ads = new ads($dbo);
8 |
9 |
10 | $ad = array("fromUserId" => 1,
11 | "adType" => 0,
12 | "status" => 0,
13 | "segment" => "Default",
14 | "location" => "Global",
15 | "deviceVersion" => 21,
16 | "weight" => 50,
17 | "price" => 0,
18 | "title" => "Message AI - Write Better Messages (Free)",
19 | "subtitle" => "Send better, more positive messages and improve relationships 💝",
20 | "description" => "Have you ever sent a text you later regretted? Maybe you were too negative or angry at the time. Message AI warns you when you're about to send a message that could harm your relationships!
21 |
22 | In addition, Message AI helps you understand how people really feel by analyzing conversations in Messenger, WhatsApp, Tinder, Snapchat, Kik, Instagram, and Line. All messaging apps are supported!
23 |
24 | How it works:
25 | Our MessageIQ artificial intelligence analyzes your messages and shows you your Positivity Score. We score each word from -100 to 100 so you can identify positive/negative emotions.
26 |
27 | Better communication is the #1 way to improve relationships. Many people don't realize how angry they sound when tired and end up hurting the people they care about unintentionally!
28 |
29 | We're in this together
30 | Message AI is the friend that always looks out for you. We'll not only warn you if you sound negative, we'll also show you when your friends are being negative.
31 |
32 | Features:
33 | Find out if your crush likes you back ❤️
34 | Who secretly likes you? Discover your secret admirers 😙
35 | Monitor your relationship with artificial intelligence!
36 | Be more positive and increase your likability 🔥
37 | Identify passive aggressiveness so you can defuse toxic situations.
38 | Uncover hidden attitudes people have. How do people REALLY feel?
39 | Pick up on warning signals that someone's about to ghost you with AI 👻
40 | Build better relationships with improve communication.
41 | Be a better friend and more positive person!",
42 | "descriptionShort" => "Message AI helps you sound more positive in your messages, increasing your likability and improving relationships 💝",
43 | "category" => "Social",
44 | "rating" => 5.0,
45 | "installs" => 500,
46 | "version" => "0.9.4",
47 | "developer" => "Straight Up",
48 | "email" => "support@messageai.co",
49 | "address" => "Kansas City, Kansas",
50 | "website" => "http://messageai.co",
51 | "linkUrl" => "https://play.google.com/store/apps/details?id=ai.message.lite",
52 | "packageName" => "ai.message.lite",
53 | "previewImgUrl" => "https://lh3.googleusercontent.com/5wtW75qqbqk1-iprBeW4hAxy6iw56zX6EQ8mRBfoUlWWZtxYDpvtZw8EnjpdjJ7VnAUg=s128-rw",
54 | "imgUrl" => "https://lh3.googleusercontent.com/5wtW75qqbqk1-iprBeW4hAxy6iw56zX6EQ8mRBfoUlWWZtxYDpvtZw8EnjpdjJ7VnAUg=s256-rw",
55 | "previewVideoImgUrl" => "https://lh3.googleusercontent.com/gTxlSPIPzfe1NoBsryU5dkw5I9kuJRE6RsznCWav76MaoKHfm0YwbD7oF4AbuAxe6QE=w360",
56 | "videoUrl" => "",
57 | "text1" => "",
58 | "text2" => "",
59 | "text3" => "",
60 | "number1" => 0,
61 | "number2" => 0,
62 | "number3" => 0,
63 | "startAt" => $currentTime,
64 | "endAt" => 2000000000);
65 | $ads->add($ad);
66 | unset($ad);
67 |
68 | $ad = array("fromUserId" => 1,
69 | "adType" => 0,
70 | "status" => 0,
71 | "segment" => "Default",
72 | "location" => "Global",
73 | "deviceVersion" => 21,
74 | "weight" => 49,
75 | "price" => 0,
76 | "title" => "Crowdfunding Projects",
77 | "subtitle" => "Browse all crowdfunding projects in one app!",
78 | "description" => "What's inside?
79 | ✓ Crowdfunding Community - join the best crowdfunding community today!
80 | ✓ Top Project Feed - all crowdfunding projects from Kickstarter and Indiegogo ranked by popularity!
81 | ✓ Latest Projects Feed - find the newest projects here first.
82 | ✓ Vote on projects to level up and earn cool rewards.
83 | ✓ Comments - discuss projects with the crowdfunding community.
84 | ✓ Leaderboards - track your crowdfunding score and compete to be the top crowdfunder!
85 | ✓ Submit new crowdfunding projects.
86 |
87 | App Features:
88 | ☆ Native Android app w/smooth and elegant design.
89 | ☆ Personalizable profile page.
90 | ☆ Real time voting and commenting platform.
91 | ☆ In-app messaging to chat with other crowdfunders.
92 | ☆ Integrated browser to view projects without leaving the app.
93 |
94 | ★ Where you can find us:
95 | Web - http://crowdfunding.stream/
96 | Twitter - http://twitter.com/crowdfunding
97 | Email - admin@crowdfunding.stream",
98 | "descriptionShort" => "Browse all crowdfunding projects from Kickstarter and Indiegogo in one app! Built by crowdfunding enthusiasts, Crowdfunding Projects is the place to share and talk about the hottest new crowdfunding projects with fellow crowdfunding addicts.",
99 | "category" => "Social",
100 | "rating" => 5.0,
101 | "installs" => 10000,
102 | "version" => "4.3.1",
103 | "developer" => "Stream Inc",
104 | "email" => "admin@crowdfunding.stream",
105 | "address" => "Kansas City, Kansas",
106 | "website" => "http://crowdfunding.stream",
107 | "linkUrl" => "https://play.google.com/store/apps/details?id=io.ideastarter",
108 | "packageName" => "io.ideastarter",
109 | "previewImgUrl" => "http://lh3.googleusercontent.com/R-vJInTblK1KBOqZaSDm_ac270QBHsiIcU9agHnN-rrp9K_lkN8rLzGIH8asCfkb420Q=w128-rw",
110 | "imgUrl" => "http://lh3.googleusercontent.com/R-vJInTblK1KBOqZaSDm_ac270QBHsiIcU9agHnN-rrp9K_lkN8rLzGIH8asCfkb420Q=w256-rw",
111 | "previewVideoImgUrl" => "https://lh3.googleusercontent.com/3coPDBP3zFcy0vriR2rhVn8BbpxIk_iXUOMzhLGHeIx35ZJ_JfyytshxvFt1QrVgnwc=h360-rw",
112 | "videoUrl" => "",
113 | "text1" => "",
114 | "text2" => "",
115 | "text3" => "",
116 | "number1" => 0,
117 | "number2" => 0,
118 | "number3" => 0,
119 | "startAt" => $currentTime,
120 | "endAt" => 2000000000);
121 | $ads->add($ad);
122 | unset($ad);
123 |
124 | $ad = array("fromUserId" => 1,
125 | "adType" => 0,
126 | "status" => 0,
127 | "segment" => "Default",
128 | "location" => "Global",
129 | "deviceVersion" => 15,
130 | "weight" => 48,
131 | "price" => 0,
132 | "title" => "Rocket Notes",
133 | "subtitle" => "The World's Fastest Note Taking App!",
134 | "description" => "Rocket Notes Features:
135 | 🚀 Creating a new note is as easy as typing a text message!
136 | 🚀 Just start writing and Rocket Note will do the rest.
137 | 🚀 Notes are saved automatically.
138 | 🚀 Minimalistic - no more worrying about formatting or how the note looks.
139 | 🚀 Taking a note is easy; leave the fonts, colors, and bold/italics to Microsoft Word.
140 | 🚀 Recent notes are always visible from your home screen and never more than ONE tap away.
141 | 🚀 No more opening an app to take notes; just start writing instead!
142 |
143 | Rocket Images Features:
144 | ☆ Forget writing, snap a picture instead!
145 | ☆ Recent photo notes are displayed in a home screen gallery and instantly visible.
146 | ☆ Image notes are only ONE tap away!
147 | ☆ Tapping on a thumbnail opens the picture in full screen mode for viewing and sharing.
148 | ☆ Photos are stored separate from your gallery app.
149 | ☆ No more searching for important notes buried under your selfies, having work documents show up in your slideshows, or getting boring images backed up via Google Photos.
150 |
151 | Rocket Share Features:
152 | ✓ Share text and images directly to Rocket Notes.
153 | ✓ Does not interrupt what you are doing.
154 | ✓ Image URLs shared to the app are automatically downloaded!
155 |
156 | ★ Where you can find us: ★
157 | Twitter - http://twitter.com/rayliverified",
158 | "descriptionShort" => "Fast. Simple. Create a note in one tap! Create image and text notes directly from your home screen!",
159 | "category" => "Productivity",
160 | "rating" => 5.0,
161 | "installs" => 500,
162 | "version" => "1.5.0",
163 | "developer" => "Stream Inc",
164 | "email" => "admin@apprewards.org",
165 | "address" => "Kansas City, Kansas",
166 | "website" => "http://apprewards.org/rocketnotes/index.html",
167 | "linkUrl" => "https://play.google.com/store/apps/details?id=stream.rocketnotes",
168 | "packageName" => "stream.rocketnotes",
169 | "previewImgUrl" => "https://lh3.googleusercontent.com/tYGJBG8mc7lwC0ZxQUxif2FVMFI8L8xRkPON0ytkWVPTI67ggkrgDl3JpRu9jW0W3sLJ=w128-rw",
170 | "imgUrl" => "https://lh3.googleusercontent.com/tYGJBG8mc7lwC0ZxQUxif2FVMFI8L8xRkPON0ytkWVPTI67ggkrgDl3JpRu9jW0W3sLJ=w256-rw",
171 | "previewVideoImgUrl" => "https://lh3.googleusercontent.com/s1IcJ6DUCPUgl2ZxGLqld8ROsARVBPDemnsfcfda0vJ8SQsoAOmbinTCcqpFfc48IA=h360-rw",
172 | "videoUrl" => "",
173 | "text1" => "",
174 | "text2" => "",
175 | "text3" => "",
176 | "number1" => 0,
177 | "number2" => 0,
178 | "number3" => 0,
179 | "startAt" => $currentTime,
180 | "endAt" => 2000000000);
181 | $ads->add($ad);
182 | unset($ad);
183 |
184 | $ad = array("fromUserId" => 1,
185 | "adType" => 0,
186 | "status" => 0,
187 | "segment" => "Default",
188 | "location" => "Global",
189 | "deviceVersion" => 15,
190 | "weight" => 47,
191 | "price" => 0,
192 | "title" => "Doodle Donut",
193 | "subtitle" => "Play the yummiest arcade game ever!",
194 | "description" => "Gameplay Highlights:
195 | ✓ Satisfy your donut cravings without gaining a single pound!
196 | ✓ Feast on visually delightful doodle art!
197 | ✓ Experience classic arcade style gameplay!
198 | ✓ Fight against mouthwatering donuts!
199 | ✓ Collect refreshing coffees and level up!
200 | ✓ Test your reflexes with daring acrobatic maneuvers!
201 | ✓ Realistic donut calorie counts!
202 | ✓ Help Tummy Yummy™ burn calories and lose weight!
203 |
204 | Game Features:
205 | ☆ Enjoy beautiful high definition doodle art
206 | ☆ Fabulously fluid 60 FPS action
207 | ☆ No personal information collected, safe for kids!
208 | ☆ Impressively intuitive and responsive controls
209 | ☆ Discover over 12 flavor-filled donuts
210 | ☆ Uncover new donut powers
211 | ☆ Unlock over 30 achievements
212 | ☆ Compete in global leaderboards
213 | ☆ Track realistic calorie counts and number of donuts ate
214 | ☆ Relax in the coffee store with great music
215 | ☆ Can you discover all the easter eggs?
216 |
217 | ★ Where you can find us:
218 | Web - http://apprewards.org/doodledonut/index.html
219 | Twitter - http://twitter.com/rayliverified",
220 | "descriptionShort" => "Jump to battle tasty donuts and drink delicious coffees in the most action-packed donut game ever! Start your coffee fueled adventure today and jump as high as you can in the yummiest game ever!",
221 | "category" => "Arcade",
222 | "rating" => 5.0,
223 | "installs" => 500,
224 | "version" => "6.0",
225 | "developer" => "Stream Inc",
226 | "email" => "admin@apprewards.org",
227 | "address" => "Kansas City, Kansas",
228 | "website" => "http://apprewards.org/doodledonut/index.html",
229 | "linkUrl" => "https://play.google.com/store/apps/details?id=com.DoodleDonut",
230 | "packageName" => "com.DoodleDonut",
231 | "previewImgUrl" => "https://lh3.googleusercontent.com/L2veVvuA8k1yjpYQj7hxb1yocpGgt-lvFEfpzMYCqPUsTwZihcev2pg5zkeBD3ChrSI=w128-rw",
232 | "imgUrl" => "https://lh3.googleusercontent.com/L2veVvuA8k1yjpYQj7hxb1yocpGgt-lvFEfpzMYCqPUsTwZihcev2pg5zkeBD3ChrSI=w256-rw",
233 | "previewVideoImgUrl" => "https://lh3.googleusercontent.com/cq0RTFJCsoRqujcSA64kzqJr2tO9U5n8XsypMFRITq8oB2ui_8N09DpzGsYfFiG4W_Y=h360-rw",
234 | "videoUrl" => "",
235 | "text1" => "",
236 | "text2" => "",
237 | "text3" => "",
238 | "number1" => 0,
239 | "number2" => 0,
240 | "number3" => 0,
241 | "startAt" => $currentTime,
242 | "endAt" => 2000000000);
243 | $ads->add($ad);
244 | unset($ad);
245 |
246 | $ad = array("fromUserId" => 1,
247 | "adType" => 0,
248 | "status" => 0,
249 | "segment" => "Default",
250 | "location" => "Global",
251 | "deviceVersion" => 15,
252 | "weight" => 46,
253 | "price" => 0,
254 | "title" => "Blank Icon/Widget",
255 | "subtitle" => "100% transparent app icon and widgets.",
256 | "description" => "Amazing Features:
257 | ✓ Most blank and transparent app in the app store
258 | ✓ Invisible app icon and widget
259 | ✓ Blank Widgets help customize homescreen
260 | ✓ Use blank icons as placeholders to add additional screens to your launcher
261 | ✓ Prevent newly installed apps from messing up your app layout
262 | ✓ Prank your friends by placing invisible widgets on their homescreen
263 |
264 | NOTE: The new Adaptive Icons introduced in Android Oreo makes the app icon white and not transparent. The only way to create a blank icon placeholder is to use Blank Widgets. (applies to Android 8.0+ and Samsung users)
265 |
266 | ★ Where you can find us:
267 | Twitter - http://twitter.com/rayliverified",
268 | "descriptionShort" => "Blank Icon is a completely transparent app icon for homescreen customization and testing purposes. Blank Icon also includes Blank Widgets that can be used to customize the homescreen. Check out these amazing features!",
269 | "category" => "Tools",
270 | "rating" => 5.0,
271 | "installs" => 10000,
272 | "version" => "2.3.2",
273 | "developer" => "Stream Inc",
274 | "email" => "Kansas City, Kansas",
275 | "address" => "801 Eldridge St.",
276 | "website" => "http://apprewards.org/blankicon/index.html",
277 | "linkUrl" => "https://play.google.com/store/apps/details?id=com.blankicon",
278 | "packageName" => "com.blankicon",
279 | "previewImgUrl" => "https://lh3.googleusercontent.com/CT1M2pKlUhGx4w5UHqarn6oSU_sa7L7XRW2-hQrfNi9oou6W81PbJnWi-9PbEfC_3g=w128-rw",
280 | "imgUrl" => "https://lh3.googleusercontent.com/CT1M2pKlUhGx4w5UHqarn6oSU_sa7L7XRW2-hQrfNi9oou6W81PbJnWi-9PbEfC_3g=w256-rw",
281 | "previewVideoImgUrl" => "https://lh3.googleusercontent.com/JMQxI2HkyWvWMgeBmVg7cUOsoqdym5lnxEjKQeZ8D0wTqe2UFJRGklJT-_dQXVlNJPeg=h360-rw",
282 | "videoUrl" => "",
283 | "text1" => "",
284 | "text2" => "",
285 | "text3" => "",
286 | "number1" => 0,
287 | "number2" => 0,
288 | "number3" => 0,
289 | "startAt" => $currentTime,
290 | "endAt" => 2000000000);
291 | $ads->add($ad);
292 | unset($ad);
293 |
294 | echo "\r
Sample Data Creation - END";
295 |
296 | } catch (Exception $e) {
297 |
298 | die ($e->getMessage());
299 | }
300 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':crosspromotion'
2 |
--------------------------------------------------------------------------------