├── img
├── br.png
├── da.png
├── de.png
├── en.png
├── es.png
├── fr.png
├── it.png
├── nl.png
├── pl.png
├── pt.png
├── se.png
├── homer.png
├── candy
│ ├── 0.png
│ ├── 377.png
│ ├── 378.png
│ ├── 379.png
│ └── 486.png
├── discord.png
├── nav
│ ├── egg.png
│ ├── gym.png
│ ├── lure.png
│ ├── mons.png
│ ├── nest.png
│ ├── quest.png
│ ├── invasion.png
│ └── raid.svg
├── raid_1.png
├── raid_10.png
├── raid_11.png
├── raid_13.png
├── raid_14.png
├── raid_15.png
├── raid_3.png
├── raid_4.png
├── raid_5.png
├── raid_6.png
├── raid_7.png
├── raid_8.png
├── raid_9.png
├── raid_90.png
├── no_avatar.png
├── position.png
└── telegram.png
├── favicon.png
├── lures
├── 501.png
├── 502.png
├── 503.png
├── 504.png
├── 505.png
└── 506.png
├── .gitignore
├── package.json
├── logout.php
├── Dockerfile
├── actions
├── set_language.php
├── roles.php
├── action_error.php
├── areas.php
├── migrate.php
├── server_settings.php
├── set_location.php
├── channel_sync.php
├── lures.php
└── nests.php
├── composer.json
├── examples
├── apache_http.example.conf
├── apache_ssl.example.conf
├── config_example.php
└── nginx.example.conf
├── include
├── defaults.php
├── uicons_repo.php
├── geo_cache.php
├── db_connect.php
├── edit_area_distance.php
├── add_area_distance.php
├── db_mad.php
├── db_rdm.php
├── toplinks.php
└── cache_handler.php
├── .github
└── workflows
│ ├── php.yml
│ └── publish.yml
├── modal
├── logout_modal.php
├── delete_quests_modal.php
├── delete_gyms_modal.php
├── delete_nests_modal.php
├── delete_lures_modal.php
├── delete_invasions_modal.php
├── delete_monster_raids_modal.php
├── delete_eggs_modal.php
├── delete_raids_modal.php
├── areapic_modal.php
├── delete_monsters_modal.php
├── distance_show_modal.php
├── location_modal.php
├── distance_quests_modal.php
├── distance_gyms_modal.php
├── distance_pokemons_modal.php
├── distance_lures_modal.php
├── distance_nests_modal.php
├── distance_invasions_modal.php
├── distance_raids_modal.php
├── edit_lures_modal.php
├── areas_modal.php
├── edit_quests_modal.php
├── edit_raids_modal.php
├── edit_eggs_modal.php
├── edit_nests_modal.php
└── edit_invasions_modal.php
├── docker-compose.example.yml
├── js
├── nav.js
├── get_position.js
├── scripts.js
└── functions.js
├── search_mons.php
├── config.env.php
├── search_mons.js
├── telegram_auth.php
├── css
└── nav.css
├── admin_connect.php
├── pages
└── display
│ ├── manage_roles.php
│ ├── profiles.php
│ ├── manage_users.php
│ └── migrate.php
├── discord_auth.php
├── README.md
├── unregistered.php
├── index.php
└── login.php
/img/br.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/br.png
--------------------------------------------------------------------------------
/img/da.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/da.png
--------------------------------------------------------------------------------
/img/de.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/de.png
--------------------------------------------------------------------------------
/img/en.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/en.png
--------------------------------------------------------------------------------
/img/es.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/es.png
--------------------------------------------------------------------------------
/img/fr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/fr.png
--------------------------------------------------------------------------------
/img/it.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/it.png
--------------------------------------------------------------------------------
/img/nl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/nl.png
--------------------------------------------------------------------------------
/img/pl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/pl.png
--------------------------------------------------------------------------------
/img/pt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/pt.png
--------------------------------------------------------------------------------
/img/se.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/se.png
--------------------------------------------------------------------------------
/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/favicon.png
--------------------------------------------------------------------------------
/img/homer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/homer.png
--------------------------------------------------------------------------------
/lures/501.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/lures/501.png
--------------------------------------------------------------------------------
/lures/502.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/lures/502.png
--------------------------------------------------------------------------------
/lures/503.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/lures/503.png
--------------------------------------------------------------------------------
/lures/504.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/lures/504.png
--------------------------------------------------------------------------------
/lures/505.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/lures/505.png
--------------------------------------------------------------------------------
/lures/506.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/lures/506.png
--------------------------------------------------------------------------------
/img/candy/0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/candy/0.png
--------------------------------------------------------------------------------
/img/discord.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/discord.png
--------------------------------------------------------------------------------
/img/nav/egg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/nav/egg.png
--------------------------------------------------------------------------------
/img/nav/gym.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/nav/gym.png
--------------------------------------------------------------------------------
/img/raid_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/raid_1.png
--------------------------------------------------------------------------------
/img/raid_10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/raid_10.png
--------------------------------------------------------------------------------
/img/raid_11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/raid_11.png
--------------------------------------------------------------------------------
/img/raid_13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/raid_13.png
--------------------------------------------------------------------------------
/img/raid_14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/raid_14.png
--------------------------------------------------------------------------------
/img/raid_15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/raid_15.png
--------------------------------------------------------------------------------
/img/raid_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/raid_3.png
--------------------------------------------------------------------------------
/img/raid_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/raid_4.png
--------------------------------------------------------------------------------
/img/raid_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/raid_5.png
--------------------------------------------------------------------------------
/img/raid_6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/raid_6.png
--------------------------------------------------------------------------------
/img/raid_7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/raid_7.png
--------------------------------------------------------------------------------
/img/raid_8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/raid_8.png
--------------------------------------------------------------------------------
/img/raid_9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/raid_9.png
--------------------------------------------------------------------------------
/img/raid_90.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/raid_90.png
--------------------------------------------------------------------------------
/img/candy/377.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/candy/377.png
--------------------------------------------------------------------------------
/img/candy/378.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/candy/378.png
--------------------------------------------------------------------------------
/img/candy/379.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/candy/379.png
--------------------------------------------------------------------------------
/img/candy/486.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/candy/486.png
--------------------------------------------------------------------------------
/img/nav/lure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/nav/lure.png
--------------------------------------------------------------------------------
/img/nav/mons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/nav/mons.png
--------------------------------------------------------------------------------
/img/nav/nest.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/nav/nest.png
--------------------------------------------------------------------------------
/img/nav/quest.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/nav/quest.png
--------------------------------------------------------------------------------
/img/no_avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/no_avatar.png
--------------------------------------------------------------------------------
/img/position.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/position.png
--------------------------------------------------------------------------------
/img/telegram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/telegram.png
--------------------------------------------------------------------------------
/img/nav/invasion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bbdoc/PoracleWeb/HEAD/img/nav/invasion.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | config.php
2 | *.OLD
3 | *.swp
4 | test*
5 | subs*
6 | composer.lock
7 | node_modules/
8 | .cache
9 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "PoracleWeb",
3 | "version": "1.0.0",
4 | "dependencies": {
5 | "@fortawesome/fontawesome-free": "^5.15.1",
6 | "bootstrap": "^4.5.3",
7 | "jquery": "^3.5.1",
8 | "jquery.easing": "^1.4.1"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/logout.php:
--------------------------------------------------------------------------------
1 | prepare("UPDATE humans SET language = ? WHERE id = ?");
15 | $stmt->bind_param("ss", $_GET['lng'], $_SESSION['id']);
16 | $stmt->execute() or die(mysqli_error($conn));
17 | $stmt->close();
18 |
19 | header("Location: $redirect_url");
20 |
21 | ?>
22 |
--------------------------------------------------------------------------------
/actions/roles.php:
--------------------------------------------------------------------------------
1 | array(
8 | 'method'=>"POST",
9 | 'header'=>"Accept-language: en\r\n" .
10 | "X-Poracle-Secret: $api_secret\r\n"
11 | )
12 | );
13 |
14 | $context = stream_context_create($opts);
15 |
16 | $result = @file_get_contents("$api_address/api/humans/".$_SESSION['id']."/roles/".$_GET['type']."/".$_GET['id'], false, $context);
17 |
18 | header("Location: $redirect_url?type=display&page=manage_roles");
19 |
20 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bbdoc/poracleweb",
3 | "description": "Web Inteface to handle alarms configuration in PoracleJS",
4 | "license": "AGPL-3.0-or-later",
5 | "homepage": "https://github.com/bbdoc/PoracleWeb",
6 | "authors": [
7 | {
8 | "name": "bbdoc"
9 | }
10 | ],
11 | "require": {
12 | "php": ">= 7.0"
13 | },
14 | "require-dev": {
15 | "php-parallel-lint/php-console-highlighter": "0.5.0",
16 | "php-parallel-lint/php-parallel-lint": "1.2.0"
17 | },
18 | "scripts": {
19 | "test": [
20 | "parallel-lint . --exclude vendor"
21 | ]
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/examples/apache_http.example.conf:
--------------------------------------------------------------------------------
1 |
2 | ServerAdmin admin@domain.de
3 | ServerName sub.domain.de
4 | ServerAlias sub.domain.de
5 |
6 | DocumentRoot /var/www/html/PoracleWeb
7 |
8 | ErrorLog ${APACHE_LOG_DIR}/error.log
9 | CustomLog ${APACHE_LOG_DIR}/access.log combined
10 |
11 | RewriteCond %{HTTP_HOST} !^sub\.domain\.de$ [NC]
12 | RewriteRule ^/$ http://%{HTTP_HOST}/ [L,R=301]
13 | RewriteEngine on
14 | RewriteCond %{SERVER_NAME} =sub.domain.de
15 | RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
16 |
17 |
--------------------------------------------------------------------------------
/include/defaults.php:
--------------------------------------------------------------------------------
1 | 0,
5 | "pvp_ranking_worst"=>4096,
6 | "pvp_ranking_min_cp"=>0,
7 | "ultra_league_ranking_min_cp"=>0,
8 | "min_iv"=>0,
9 | "max_iv"=>100,
10 | "min_cp"=>0,
11 | "max_cp"=>9000,
12 | "min_level"=>0,
13 | "max_level"=>55,
14 | "min_weight"=>0,
15 | "max_weight"=>9000000,
16 | "atk"=>0,
17 | "def"=>0,
18 | "sta"=>0,
19 | "max_atk"=>15,
20 | "max_def"=>15,
21 | "max_sta"=>15,
22 | "gender"=>0,
23 | "size"=>-1,
24 | "max_size"=>5
25 | );
26 |
27 | $min_poracle_version = "4.8.3";
28 | $max_pokemon="1008";
29 |
30 | $other_grunt_types = array(
31 | "7"=>"gold-stop",
32 | "8"=>"kecleon",
33 | "9"=>"showcase"
34 | );
35 |
36 | ?>
37 |
--------------------------------------------------------------------------------
/include/uicons_repo.php:
--------------------------------------------------------------------------------
1 | "https://raw.githubusercontent.com/whitewillem/PogoAssets/main/uicons",
4 | "Whitewillem Outline" => "https://raw.githubusercontent.com/whitewillem/PogoAssets/main/uicons-outline",
5 | "Nileplumb Home" => "https://raw.githubusercontent.com/nileplumb/PkmnHomeIcons/master/UICONS",
6 | "Nileplumb Outline" => "https://raw.githubusercontent.com/nileplumb/PkmnHomeIcons/master/UICONS_OS_128",
7 | "Nileplumn Shuffle" => "https://raw.githubusercontent.com/nileplumb/PkmnShuffleMap/master/UICONS",
8 | "Jms412 Shuffle" => "https://raw.githubusercontent.com/jms412/PkmnShuffleMap/master/UICONS_Half_Shiny_128",
9 | "Jms412 Home" => "https://raw.githubusercontent.com/jms412/PkmnHomeIcons/master/UICONS_Half_Shiny_128"
10 | );
11 | ?>
12 |
--------------------------------------------------------------------------------
/.github/workflows/php.yml:
--------------------------------------------------------------------------------
1 | name: PHP Composer
2 |
3 | on:
4 | push:
5 | pull_request:
6 |
7 | jobs:
8 | run:
9 | runs-on: ubuntu-latest
10 | strategy:
11 | matrix:
12 | php-versions:
13 | - "7.0"
14 | - "7.1"
15 | - "7.2"
16 | - "7.3"
17 | - "7.4"
18 | - "8.0"
19 | - "8.1"
20 |
21 | name: PHP ${{ matrix.php-versions }} test
22 | steps:
23 | - name: Checkout
24 | uses: actions/checkout@v4
25 |
26 | - name: Setup PHP
27 | uses: shivammathur/setup-php@v2
28 | with:
29 | php-version: ${{ matrix.php-versions }}
30 | coverage: none
31 | tools: composer
32 |
33 | - name: Install dependencies
34 | run: composer install --prefer-dist --no-progress
35 |
36 | - name: Run tests
37 | run: composer test
38 |
--------------------------------------------------------------------------------
/examples/apache_ssl.example.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 | ServerAdmin admin@domain.de
4 | ServerName sub.domain.de
5 | ServerAlias sub.domain.de
6 |
7 |
8 | Options Indexes FollowSymLinks
9 | AllowOverride All
10 | Require all granted
11 |
12 |
13 | DocumentRoot /var/www/html/PoracleWeb
14 |
15 | ErrorLog ${APACHE_LOG_DIR}/PoracleWeberror.log
16 | CustomLog ${APACHE_LOG_DIR}/PoracleWebaccess.log combined
17 |
18 | RewriteCond %{HTTP_HOST} !^sub\.domain\.de$ [NC]
19 | RewriteRule ^/$ http://%{HTTP_HOST}/ [L,R=301]
20 |
21 |
22 | SSLCertificateFile /etc/letsencrypt/live/mysite/fullchain.pem
23 | SSLCertificateKeyFile /etc/letsencrypt/live/mysite/privkey.pem
24 | Include /etc/letsencrypt/options-ssl-apache.conf
25 |
26 |
27 |
--------------------------------------------------------------------------------
/modal/logout_modal.php:
--------------------------------------------------------------------------------
1 |
3 |
4 |
12 |
13 |
14 | .
15 |
16 |
17 |
30 |
31 |
--------------------------------------------------------------------------------
/config.env.php:
--------------------------------------------------------------------------------
1 | connect_errno) {
19 | echo "Failed to connect to MySQL: " . $conn->connect_error;
20 | exit();
21 | }
22 | }
23 |
24 | // Get DB Settings into variables
25 |
26 | $sql = "SHOW TABLES LIKE 'pweb_settings'";
27 | $result = $conn->query($sql);
28 |
29 | if ($result->num_rows <> 0) {
30 |
31 | $sql = "select * FROM pweb_settings";
32 | $result = $conn->query($sql);
33 |
34 | while ($row = $result->fetch_assoc()) {
35 | ${$row['setting']} = $row['value'];
36 | if ( ${$row['setting']} == "") { unset( ${$row['setting']} ); }
37 | }
38 |
39 | }
40 |
41 | // Set Default UICONS Repo
42 |
43 | if (!isset($uicons_pkmn)) { $uicons_pkmn = "https://raw.githubusercontent.com/whitewillem/PogoAssets/main/uicons"; }
44 | if (!isset($uicons_raid)) { $uicons_raid = "https://raw.githubusercontent.com/whitewillem/PogoAssets/main/uicons"; }
45 | if (!isset($uicons_gym)) { $uicons_gym = "https://raw.githubusercontent.com/whitewillem/PogoAssets/main/uicons"; }
46 | if (!isset($uicons_reward)) { $uicons_reward = "https://raw.githubusercontent.com/whitewillem/PogoAssets/main/uicons"; }
47 |
--------------------------------------------------------------------------------
/modal/distance_show_modal.php:
--------------------------------------------------------------------------------
1 |
5 |
4 |
5 |
6 | "True") { ?>
7 |
8 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/discord_auth.php:
--------------------------------------------------------------------------------
1 | OAUTH2_CLIENT_ID,
27 | 'redirect_uri' => $redirect_url."/discord_auth.php",
28 | 'response_type' => 'code',
29 | 'scope' => 'identify guilds'
30 | );
31 |
32 | // Redirect the user to Discord's authorization page
33 | header('Location: https://discordapp.com/api/oauth2/authorize' . '?' . http_build_query($params));
34 | die();
35 | }
36 |
37 |
38 | // When Discord redirects the user back here, there will be a "code" and "state" parameter in the query string
39 | if(get('code')) {
40 |
41 | // Exchange the auth code for a token
42 | $token = apiRequest($tokenURL, array(
43 | "grant_type" => "authorization_code",
44 | 'client_id' => OAUTH2_CLIENT_ID,
45 | 'client_secret' => OAUTH2_CLIENT_SECRET,
46 | 'redirect_uri' => $redirect_url."/discord_auth.php",
47 | 'code' => get('code')
48 | ));
49 | $logout_token = $token->access_token;
50 | $_SESSION['access_token'] = $token->access_token;
51 |
52 |
53 | header('Location: ' . $_SERVER['PHP_SELF']);
54 | }
55 |
56 | if(session('access_token')) {
57 | $user = apiRequest($apiURLBase);
58 |
59 | $_SESSION['username']=$user->username;
60 | $_SESSION['type']="discord:user";
61 | $_SESSION['id']=$user->id;
62 | $_SESSION['avatar_id']=$user->avatar;
63 | $_SESSION['avatar'] = "https://cdn.discordapp.com/avatars/" . $_SESSION['id'] . "/" . $_SESSION['avatar_id'] . ".png";
64 |
65 | include_once "./session.php";
66 |
67 | if (isset($no_api) && $no_api == "True")
68 | {
69 | header("Location: $redirect_url?type=display&page=server_settings");
70 | }
71 | else if ( version_compare($_SESSION['poracleVersion'], $min_poracle_version) < 0 )
72 | {
73 | header("Location: $redirect_url?type=display&page=server_settings");
74 | }
75 | else
76 | {
77 | header("Location: $redirect_url");
78 | }
79 |
80 | } else {
81 | echo '
Not logged in
';
82 | echo '
Log In
';
83 | }
84 |
85 |
86 | if(get('action') == 'logout') {
87 | // This must to logout you, but it didn't worked(
88 |
89 | $params = array(
90 | 'access_token' => $logout_token
91 | );
92 |
93 | // Redirect the user to Discord's revoke page
94 | header('Location: https://discordapp.com/api/oauth2/token/revoke' . '?' . http_build_query($params));
95 | die();
96 | }
97 |
98 | function apiRequest($url, $post=FALSE, $headers=array()) {
99 | $ch = curl_init($url);
100 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
101 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
102 |
103 | $response = curl_exec($ch);
104 |
105 |
106 | if($post)
107 | curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
108 |
109 | $headers[] = 'Accept: application/json';
110 |
111 | if(session('access_token'))
112 | $headers[] = 'Authorization: Bearer ' . session('access_token');
113 |
114 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
115 |
116 | $response = curl_exec($ch);
117 | return json_decode($response);
118 | }
119 |
120 | function get($key, $default=NULL) {
121 | return array_key_exists($key, $_GET) ? $_GET[$key] : $default;
122 | }
123 |
124 | function session($key, $default=NULL) {
125 | return array_key_exists($key, $_SESSION) ? $_SESSION[$key] : $default;
126 | }
127 |
--------------------------------------------------------------------------------
/actions/set_location.php:
--------------------------------------------------------------------------------
1 | prepare("UPDATE monsters set distance = 0 WHERE id = ? AND profile_no = ?");
14 | $stmt->bind_param("si", $_SESSION['id'], $_SESSION['profile']);
15 | $stmt->execute();
16 | $stmt->close();
17 | $stmt = $conn->prepare("UPDATE raid set distance = 0 WHERE id = ? AND profile_no = ?");
18 | $stmt->bind_param("si", $_SESSION['id'], $_SESSION['profile']);
19 | $stmt->execute();
20 | $stmt->close();
21 | $stmt = $conn->prepare("UPDATE egg set distance = 0 WHERE id = ? AND profile_no = ?");
22 | $stmt->bind_param("si", $_SESSION['id'], $_SESSION['profile']);
23 | $stmt->execute();
24 | $stmt->close();
25 | $stmt = $conn->prepare("UPDATE quest set distance = 0 WHERE id = ? AND profile_no = ?");
26 | $stmt->bind_param("si", $_SESSION['id'], $_SESSION['profile']);
27 | $stmt->execute();
28 | $stmt->close();
29 | $stmt = $conn->prepare("UPDATE invasion set distance = 0 WHERE id = ? AND profile_no = ?");
30 | $stmt->bind_param("si", $_SESSION['id'], $_SESSION['profile']);
31 | $stmt->execute();
32 | $stmt->close();
33 |
34 | } else if ( isset($_GET['lat']) && isset($_GET['lon']) ) {
35 |
36 | $lat = $_GET['lat'];
37 | $lon = $_GET['lon'];
38 |
39 | } else {
40 |
41 | $street = str_replace(" ", "%20", $_POST['street']);
42 | $city = str_replace(" ", "%20", $_POST['city']);
43 |
44 | $filepath=$_SESSION['providerURL']."/?addressdetails=1&q=".$street."%20".$city."&format=json&limit=1";
45 | if ( strlen($_SESSION['staticKey']) == 32 ) {
46 | $filepath.="&key=".$_SESSION['staticKey'];
47 | }
48 |
49 | $request = file_get_contents($filepath);
50 |
51 | if ( $request == "[]" ) {
52 | header("Location: $redirect_url?type=display&page=area&return=error_update_location");
53 | exit();
54 | }
55 |
56 | $json = json_decode($request, true);
57 |
58 | foreach ($json as $key => $value) {
59 | foreach ($value as $key => $value2) {
60 | if ($key == "lat") { $lat = $value2; }
61 | if ($key == "lon") { $lon = $value2; }
62 | }
63 | }
64 |
65 | }
66 |
67 | // Update Lat and Lon from Humans if current profile is active
68 |
69 | $stmt = $conn->prepare("UPDATE humans set latitude = ?, longitude = ? WHERE id = ? AND current_profile_no = ?");
70 | if (false === $stmt) {
71 | header("Location: $redirect_url?type=display&page=area&return=sql_error&phase=ESLH1&sql=$stmt->error");
72 | exit();
73 | }
74 | $rs = $stmt->bind_param("sssi", $lat, $lon, $_SESSION['id'], $_SESSION['profile']);
75 | if (false === $rs) {
76 | header("Location: $redirect_url?type=display&page=area&return=sql_error&phase=ESLH2&sql=$stmt->error");
77 | exit();
78 | }
79 | $rs = $stmt->execute();
80 | if (false === $rs) {
81 | header("Location: $redirect_url?type=display&page=area&return=sql_error&phase=ESLH3&sql=$stmt->error");
82 | exit();
83 | }
84 |
85 | // Update Lat and Lon from Profile if exist
86 |
87 | $stmt = $conn->prepare("UPDATE profiles set latitude = ?, longitude = ? WHERE id = ? AND profile_no = ?");
88 | if (false === $stmt) {
89 | header("Location: $redirect_url?type=display&page=area&return=sql_error&phase=ESLP1&sql=$stmt->error");
90 | exit();
91 | }
92 | $rs = $stmt->bind_param("sssi", $lat, $lon, $_SESSION['id'], $_SESSION['profile']);
93 | if (false === $rs) {
94 | header("Location: $redirect_url?type=display&page=area&return=sql_error&phase=ESLP2&sql=$stmt->error");
95 | exit();
96 | }
97 | $rs = $stmt->execute();
98 | if (false === $rs) {
99 | header("Location: $redirect_url?type=display&page=area&return=sql_error&phase=ESLP3&sql=$stmt->error");
100 | exit();
101 | }
102 |
103 |
104 | if ( isset($_POST['delete']) ) {
105 | header("Location: $redirect_url?type=display&page=area&return=success_delete_location");
106 | exit();
107 | } else {
108 | header("Location: $redirect_url?type=display&page=area&return=success_update_location");
109 | exit();
110 | }
111 |
112 |
113 | ?>
114 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PoracleWeb
2 |
3 |
4 | [![Contributors][contributors-shield]][contributors-url]
5 | [![Forks][forks-shield]][forks-url]
6 | [![Stargazers][stars-shield]][stars-url]
7 | [![Issues][issues-shield]][issues-url]
8 |
9 | ---
10 |
11 | REQUIRES MYSQL !
12 |
13 | This tool is an add-on to [PoracleJS](https://github.com/KartulUdus/PoracleJS)
14 |
15 | It requires a working webserver (typically Apache or nginx) + PHP.
16 | Alternatively it can be run out of Docker (Dockerfile is provided).
17 |
18 | ---
19 |
20 | **PoracleWeb handles:**
21 | - [x] Monsters
22 | - [x] Raids & Eggs
23 | - [x] Quests
24 | - [x] Invasions
25 | - [x] Lures
26 | - [x] Nests
27 |
28 | Any other suggestions are welcome, please use [GitHub Issues][issues-url] for your suggestions.
29 |
30 | ---
31 |
32 | ### Prerequisites
33 |
34 | * [NodeJS & NPM](https://nodejs.org/en/download/)
35 | * [Composer](https://getcomposer.org/download/)
36 |
37 | ---
38 |
39 | ### Installation
40 |
41 | 1. Clone the repo
42 | ```sh
43 | git clone https://github.com/bbdoc/PoracleWeb.git
44 | ```
45 | 2. Install NPM packages
46 | ```sh
47 | npm install
48 | ```
49 | 3. Copy `config_example.php` to `config.php` and adapt to your needs
50 | 4. Have a Web Server pointing to your install directory (This tool doesn't include any standalone WebServer)
51 |
52 | 5. You will need to configure your some basic settings in config.php:
53 | - Access Parameters to your Poracle DB
54 | - Admin ID. From discord, right click on your avatar and use "Copy ID". This defines the ID of the administrator who will be able to perform further configuration tasks.
55 | - Discord Bot. If you use PMSF, you can reuse the same parameters for `discordBotClientId` and `discordBotClientSecret` or find them on the [Discord application Portal](https://discord.com/developers/applications). `redirect_url` should point to your PoracleWeb base directory and should be configured as a Redirects in your Discord bot.
56 |
57 | For those parameters go to :
58 | - [Discord application Portal](https://discord.com/developers/applications)
59 | - Select your Bot (or create a new one).
60 | - Go to OAuth2 and add your `https://yourdomain.com/discord_auth.php` (`https://yourdomain.com`) being your `redirect_url`
61 | - Client ID can be found under "General Information"
62 | - Client Secret can be found under "General Information" by clicking the "Click to reveal" link.A
63 |
64 | 6. Go to your PoracleWeb site and head to Admin Tools / Server Settings for additional configuration steps and parameters. You need to be logged in as an admin (as defined by `admin_id` par
65 | ameter to be able to access this page.
66 |
67 |
68 | ### Setting Up Telegram Authentication
69 |
70 | You can enable Telegram authentication from the Server Settings page. You'll need to indicate a Bot Name for it to work.
71 |
72 | This means you first need to [create a bot] (https://core.telegram.org/bots#3-how-do-i-create-a-bot)
73 | Once you have chosen/created a bot, send the /setdomain command to @Botfather to link your website's domain to the bot.
74 |
75 | ---
76 |
77 | ## Contributing
78 |
79 | 1. Fork the Project
80 | 2. Clone your forked project
81 | ```sh
82 | git clone https://github.com/YourUserName/PoracleWeb.git
83 | ```
84 | 3. Create your New Feature branch (`git checkout -b new_feature`)
85 | 4. Create a new remote for the upstream repo with the command:
86 | ```sh
87 | git remote add upstream https://github.com/bbdoc/PoracleWeb
88 | ```
89 | 3. Commit your Changes
90 | ```sh
91 | git commit -m 'Add some New Feature'
92 | ```
93 | 4. Push to the Branch
94 | ```sh
95 | git push origin new_feature
96 | ```
97 |
98 | [contributors-shield]: https://img.shields.io/github/contributors/bbdoc/PoracleWeb.svg?style=for-the-badge
99 | [contributors-url]: https://github.com/bbdoc/PoracleWeb/graphs/contributors
100 | [forks-shield]: https://img.shields.io/github/forks/bbdoc/PoracleWeb.svg?style=for-the-badge
101 | [forks-url]: https://github.com/bbdoc/PoracleWeb/network/members
102 | [stars-shield]: https://img.shields.io/github/stars/bbdoc/PoracleWeb.svg?style=for-the-badge
103 | [stars-url]: https://github.com/bbdoc/PoracleWeb/stargazers
104 | [issues-shield]: https://img.shields.io/github/issues/bbdoc/PoracleWeb.svg?style=for-the-badge
105 | [issues-url]: https://github.com/bbdoc/PoracleWeb/issues
106 |
--------------------------------------------------------------------------------
/include/db_mad.php:
--------------------------------------------------------------------------------
1 | 0 AND quest_reward_type = 7 order by quest_pokemon_id;";
12 | $result = $scan_conn->query($sql);
13 |
14 | $mons=array();
15 | while($row = $result->fetch_assoc()) {
16 | array_push($mons, $row['id']."_".$row['form']);
17 | }
18 |
19 | if (isset($additional_quest_mons) && !empty($additional_quest_mons)) {
20 | $add_mons = explode(",", $additional_quest_mons);
21 | foreach ($add_mons as &$mon) {
22 | array_push($mons, $mon);
23 | }
24 | }
25 |
26 | $mons=array_unique($mons);
27 | sort($mons);
28 | return $mons;
29 |
30 | }
31 |
32 | function get_gym_list() {
33 |
34 | global $scan_conn;
35 | $sql = "SELECT gym_id, name FROM gymdetails WHERE name IS NOT NULL ORDER BY name;";
36 | $result = $scan_conn->query($sql);
37 |
38 | $gyms=array();
39 | while($row = $result->fetch_assoc()) {
40 | array_push($gyms, $row['gym_id']."_".$row['name']);
41 | }
42 |
43 | return $gyms;
44 |
45 | }
46 |
47 | function get_quest_items() {
48 |
49 | global $scan_conn;
50 | $sql = "SELECT distinct quest_item_id id FROM trs_quest WHERE quest_item_id > 0 order by quest_item_id;";
51 | $result = $scan_conn->query($sql);
52 |
53 | $items=array();
54 | while($row = $result->fetch_assoc()) {
55 | array_push($items, $row['id']);
56 | }
57 |
58 | return $items;
59 |
60 | }
61 |
62 | function get_quest_energy() {
63 |
64 | global $scan_conn;
65 | $sql = "SELECT distinct(quest_pokemon_id) id FROM trs_quest WHERE quest_reward_type = 12 ORDER BY quest_pokemon_id;";
66 | $result = $scan_conn->query($sql);
67 |
68 | $mons=array();
69 | while($row = $result->fetch_assoc()) {
70 | array_push($mons, $row['id']);
71 | }
72 |
73 | return $mons;
74 |
75 | }
76 |
77 | function get_quest_candy() {
78 |
79 | global $scan_conn;
80 | $sql = "SELECT distinct(quest_pokemon_id) id FROM trs_quest WHERE quest_reward_type = 4 ORDER BY quest_pokemon_id;";
81 | $result = $scan_conn->query($sql);
82 |
83 | $mons=array();
84 | while($row = $result->fetch_assoc()) {
85 | array_push($mons, $row['id']);
86 | }
87 |
88 | return $mons;
89 |
90 | }
91 |
92 |
93 | function get_raid_bosses() {
94 |
95 | global $scan_conn;
96 | $sql = "SELECT level, pokemon_id, form, evolution, costume FROM raid
97 | WHERE pokemon_id is not null and last_scanned > now() - INTERVAL 1 DAY
98 | GROUP BY level, pokemon_id, form, evolution, costume ORDER BY level, pokemon_id;";
99 | $result = $scan_conn->query($sql);
100 |
101 | $bosses=array();
102 | while($row = $result->fetch_assoc()) {
103 | $pokemon_id=$row['pokemon_id'];
104 | $form=$row['form'];
105 | $costume=$row['costume'];
106 | $evolution=$row['evolution'];
107 | if ( $evolution <> '0' ) { $boss = $pokemon_id."_".$form."_".$evolution; }
108 | else { $boss = $pokemon_id."_".$form."_".$costume; }
109 | array_push($bosses, $boss);
110 | }
111 |
112 | return $bosses;
113 |
114 | }
115 |
116 | function get_gym_by_id($id) {
117 |
118 | global $scan_conn;
119 | $stmt = $scan_conn->prepare("SELECT name from gymdetails where gym_id = ?");
120 | $stmt->bind_param("s", $id);
121 | $stmt->execute();
122 | $result = $stmt->get_result();
123 |
124 | while($row = $result->fetch_assoc()) {
125 | $gym_name = $row['name'];
126 | }
127 | $stmt->close();
128 |
129 | return $gym_name;
130 |
131 | }
132 |
133 | function get_gym_url($id) {
134 |
135 | global $scan_conn;
136 | $stmt = $scan_conn->prepare("SELECT url from gymdetails where gym_id = ?");
137 | $stmt->bind_param("s", $id);
138 | $stmt->execute();
139 | $result = $stmt->get_result();
140 |
141 | while($row = $result->fetch_assoc()) {
142 | $gym_url = $row['url'];
143 | }
144 | $stmt->close();
145 |
146 | return $gym_url;
147 |
148 | }
149 |
150 |
--------------------------------------------------------------------------------
/unregistered.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
-
16 |
17 |
18 |
19 |
20 |
21 |
24 |
25 |
26 |
27 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | .
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/modal/areas_modal.php:
--------------------------------------------------------------------------------
1 | prepare("SELECT area FROM humans WHERE id = ?");
7 | $stmt->bind_param("s", $_SESSION['id']);
8 | }
9 | else {
10 | $stmt = $conn->prepare("SELECT area FROM profiles WHERE id = ? AND profile_no = ?");
11 | $stmt->bind_param("si", $_SESSION['id'], $_SESSION['profile']);
12 | }
13 |
14 | $stmt->execute();
15 | $result = $stmt->get_result();
16 |
17 | while ($row = $result->fetch_assoc()) {
18 | $existing_area = $row['area'];
19 | $existing_area = json_decode($row['area']);
20 | }
21 | $stmt->close();
22 |
23 | echo "
24 |
113 | ";
114 |
--------------------------------------------------------------------------------
/modal/edit_quests_modal.php:
--------------------------------------------------------------------------------
1 |
5 | ";
6 |
7 | echo "
";
8 | if ( $row['reward_type'] == "7") {
9 | if ($row['form'] <> 0 ) { $addform = "_f".$row['form']; } else { $addform = ""; }
10 | echo "

";
11 | } elseif ( $row['reward_type'] == "2") {
12 | echo "

";
13 | } elseif ( $row['reward_type'] == "12") {
14 | echo "

";
15 | } elseif ( $row['reward_type'] == "4") {
16 | echo "

";
17 | if ( $row['reward'] <> 0 ) {
18 | echo "

";
19 | }
20 | echo "
";
21 | }
22 | echo "
";
23 |
24 | ?>
25 |
26 |
27 |
28 |
29 |
'>
30 |
31 |
32 |
33 |
34 |
35 |
43 |
44 |
45 |
46 |
47 |
72 |
73 | 1 ) {
74 | echo '
';
90 | } ?>
91 |
92 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/include/db_rdm.php:
--------------------------------------------------------------------------------
1 | 0 AND quest_reward_type = 7 order by quest_pokemon_id;";
13 | $result = $scan_conn->query($sql);
14 |
15 | $mons=array();
16 | while($row = $result->fetch_assoc()) {
17 | array_push($mons, $row['id']."_".$row['form']);
18 | }
19 |
20 | if (isset($additional_quest_mons) && !empty($additional_quest_mons)) {
21 | $add_mons = explode(",", $additional_quest_mons);
22 | foreach ($add_mons as &$mon) {
23 | array_push($mons, $mon);
24 | }
25 | }
26 |
27 | $mons=array_unique($mons);
28 | sort($mons);
29 | return $mons;
30 |
31 | }
32 |
33 | function get_gym_list() {
34 |
35 | global $scan_conn;
36 | $sql = "SELECT id, name FROM gym WHERE name IS NOT NULL ORDER BY name;";
37 | $result = $scan_conn->query($sql);
38 |
39 | $gyms=array();
40 | while($row = $result->fetch_assoc()) {
41 | array_push($gyms, $row['id']."_".$row['name']);
42 | }
43 |
44 | return $gyms;
45 |
46 | }
47 |
48 | function get_quest_items() {
49 |
50 | global $scan_conn;
51 | $sql = "SELECT distinct quest_item_id id FROM pokestop WHERE quest_item_id > 0 order by quest_item_id;";
52 | $result = $scan_conn->query($sql);
53 |
54 | $items=array();
55 | while($row = $result->fetch_assoc()) {
56 | array_push($items, $row['id']);
57 | }
58 |
59 | return $items;
60 |
61 | }
62 |
63 | function get_quest_energy() {
64 |
65 | global $scan_conn;
66 | $sql = "SELECT distinct json_extract(json_extract(`quest_rewards`,'$[*].info.pokemon_id'),'$[0]') AS id
67 | FROM pokestop WHERE quest_reward_type = 12;";
68 | $result = $scan_conn->query($sql);
69 |
70 | $mons=array();
71 | while($row = $result->fetch_assoc()) {
72 | array_push($mons, $row['id']);
73 | }
74 |
75 | return $mons;
76 |
77 | }
78 |
79 | function get_quest_candy() {
80 |
81 | global $scan_conn;
82 | $sql = "SELECT distinct json_extract(json_extract(`quest_rewards`,'$[*].info.pokemon_id'),'$[0]') AS id
83 | FROM pokestop WHERE quest_reward_type = 4;";
84 | $result = $scan_conn->query($sql);
85 |
86 | $mons=array();
87 | while($row = $result->fetch_assoc()) {
88 | array_push($mons, $row['id']);
89 | }
90 |
91 | return $mons;
92 |
93 | }
94 |
95 |
96 | function get_raid_bosses() {
97 |
98 | global $scan_conn;
99 | $sql = "SELECT raid_level, raid_pokemon_id, raid_pokemon_form, raid_pokemon_evolution, raid_pokemon_costume FROM gym
100 | WHERE raid_pokemon_id <> 0 AND raid_end_timestamp > UNIX_TIMESTAMP(DATE_SUB(now(), INTERVAL 1 DAY))
101 | GROUP BY raid_level, raid_pokemon_id, raid_pokemon_form, raid_pokemon_evolution, raid_pokemon_costume ORDER BY raid_level, raid_pokemon_id;";
102 | $result = $scan_conn->query($sql);
103 |
104 | $bosses=array();
105 | while($row = $result->fetch_assoc()) {
106 | $pokemon_id=$row['raid_pokemon_id'];
107 | $form=$row['raid_pokemon_form'];
108 | $costume=$row['raid_pokemon_costume'];
109 | $evolution=$row['raid_pokemon_evolution'];
110 | if ( $evolution <> '0' ) { $boss = $pokemon_id."_".$form."_".$evolution; }
111 | else { $boss = $pokemon_id."_".$form."_".$costume; }
112 | array_push($bosses, $boss);
113 | }
114 |
115 | return $bosses;
116 |
117 | }
118 |
119 | function get_gym_by_id($id) {
120 |
121 | global $scan_conn;
122 | $stmt = $scan_conn->prepare("SELECT name from gym where id = ?");
123 | $stmt->bind_param("s", $id);
124 | $stmt->execute();
125 | $result = $stmt->get_result();
126 |
127 | while($row = $result->fetch_assoc()) {
128 | $gym_name = $row['name'];
129 | }
130 | $stmt->close();
131 |
132 | return $gym_name;
133 |
134 | }
135 |
136 | function get_gym_url($id) {
137 |
138 | global $scan_conn;
139 | $stmt = $scan_conn->prepare("SELECT url from gym where id = ?");
140 | $stmt->bind_param("s", $id);
141 | $stmt->execute();
142 | $result = $stmt->get_result();
143 |
144 | while($row = $result->fetch_assoc()) {
145 | $gym_url = $row['url'];
146 | }
147 | $stmt->close();
148 |
149 | return $gym_url;
150 |
151 | }
152 |
153 |
--------------------------------------------------------------------------------
/modal/edit_raids_modal.php:
--------------------------------------------------------------------------------
1 |
5 | ";
6 |
7 | echo "
";
8 | if ($row['level'] == "9000") {
9 | echo "

";
10 | } else {
11 | echo "

";
12 | }
13 |
14 | if ( !is_null($row['gym_id']) ) {
15 | echo "

";
16 | }
17 |
18 | echo "
";
19 | if ( $row['level'] <> 90 && $row['level'] <> 9000) {
20 | echo i8ln("Raids")." ".$row['level'];
21 | } else if ( $row['level'] == 9000 ) {
22 | echo i8ln("Raids")." ".$pokemon_name." ".$form_name;
23 | } else {
24 | echo i8ln("All Raids");
25 | }
26 |
27 | echo "
";
28 |
29 | echo "
";
30 |
31 | ?>
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
'>
43 |
44 |
45 |
46 |
47 |
48 |
56 |
57 |
58 |
59 |
60 |
85 |
86 | 1 ) {
87 | echo '
';
103 | } ?>
104 |
105 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/modal/edit_eggs_modal.php:
--------------------------------------------------------------------------------
1 |
5 | ";
6 |
7 | echo "
";
8 |
9 | if ( $row['level'] == 90 ) {
10 | echo "

";
11 | echo "

";
12 | echo "

";
13 | echo "

";
14 | } else {
15 | echo "

";
16 | }
17 |
18 | if ( !is_null($row['gym_id']) ) {
19 | echo '
.')
';
20 | }
21 |
22 | echo "
";
23 | if ( $row['level'] <> 90 ) {
24 | echo i8ln("Eggs Level")." " . $row['level'];
25 | } else {
26 | echo i8ln("All Eggs");
27 | }
28 | echo "
";
29 | echo "
";
30 |
31 | ?>
32 |
33 |
34 |
35 | ';
38 | echo get_gym_by_id($row['gym_id']);
39 | echo '';
40 | }
41 | ?>
42 |
43 |
44 |
'>
45 |
46 |
47 |
48 |
49 |
50 |
58 |
59 |
60 |
61 |
62 |
87 |
88 | 1 ) {
89 | echo '
';
105 | } ?>
106 |
107 |
118 |
119 |
120 |
--------------------------------------------------------------------------------
/pages/display/manage_users.php:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | $_SESSION['id']) { ?>
25 |
26 |
27 |
28 |
29 |
32 |
33 |
34 |
35 | $_SESSION['id']) { ?>
36 |
37 |
38 |
39 |
40 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
62 |
63 |
64 |
65 | "True" ) {
68 |
69 | $dbnames = explode(",", $dbname);
70 | foreach ($dbnames as &$db) {
71 |
72 | // Get Discord Users
73 |
74 | $conn = new mysqli($dbhost.":".$dbport, $dbuser, $dbpass, $db);
75 | $sql = "select id, name, type FROM humans WHERE type like 'discord:user' ORDER by type,name";
76 | $result = $conn->query($sql);
77 | ?>
78 |
79 | num_rows <> 0) { ?>
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | - DISCORD
88 | 1) { echo "
".$db; } ?>
89 |
90 |
91 |
92 |
93 |
94 |
95 | fetch_assoc()) { ?>
96 |
btn-icon-split m-1">
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 | query($sql);
112 | ?>
113 |
114 | num_rows <> 0) { ?>
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | - TELEGRAM
123 | 1) { echo "
".$db; } ?>
124 |
125 |
126 |
127 |
128 |
129 |
130 | fetch_assoc()) { ?>
131 |
btn-icon-split m-1">
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
--------------------------------------------------------------------------------
/modal/edit_nests_modal.php:
--------------------------------------------------------------------------------
1 |
5 | ";
6 |
7 | echo "
";
8 | if ($row['pokemon_id'] == "0") {
9 | echo "
".i8ln("ALL")."";
10 | } else {
11 | if ($row['form'] <> 0 ) { $addform = "_f".$row['form']; } else { $addform = ""; }
12 | $PkmnImg = "$uicons_pkmn/pokemon/" . $row['pokemon_id'] . $addform . ".png";
13 | echo "

";
14 | echo "
".i8ln(get_mons($row['pokemon_id']))."";
15 | }
16 | echo "
";
17 |
18 | ?>
19 |
20 |
21 |
22 |
23 |
'>
24 |
25 |
26 |
27 |
28 |
29 |
43 |
44 |
45 |
46 |
54 |
55 |
56 |
57 |
58 |
83 |
84 | 1 ) {
85 | echo '
';
101 | } ?>
102 |
103 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
18 |
19 | ";
25 | }
26 | ?>
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
43 |
44 |
45 |
46 |
47 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
135 |
136 |
--------------------------------------------------------------------------------
/pages/display/migrate.php:
--------------------------------------------------------------------------------
1 | "True" ) {
6 | header("Location: $redirect_url");
7 | exit();
8 | }
9 |
10 | # Only Allow Migration if SESSION type is set to User
11 |
12 | if ( $_SESSION['type'] <> "discord:user" && $_SESSION['type'] <> "telegram:user") {
13 | header("Location: $redirect_url");
14 | exit();
15 | }
16 |
17 | ?>
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | prepare("SELECT * from humans WHERE id = ?");
52 | $stmt->bind_param("s", $_GET['id']);
53 | $stmt->execute();
54 | $stmt->store_result();
55 | if ( $stmt->num_rows > 0 ) {
56 | ?>
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
78 |
79 |
80 | !
81 |
89 |
90 |
91 |
92 | close(); ?>
93 |
94 |
95 |
96 |
97 |
98 |
104 |
105 |
106 |
107 |
108 |
109 |
110 | .
111 |
112 |
113 |
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/include/toplinks.php:
--------------------------------------------------------------------------------
1 |
2 | prepare($sql);
25 | $stmt->bind_param("sisisisisisisisi", $user_id, $profile_id, $user_id, $profile_id, $user_id, $profile_id, $user_id, $profile_id, $user_id, $profile_id, $user_id, $profile_id, $user_id, $profile_id, $user_id, $profile_id);
26 | $stmt->execute();
27 | $result = $stmt->get_result();
28 | while ($row = $result->fetch_assoc()) {
29 | switch ($row['Type']) {
30 | case 'monsters':
31 | $num_mon_tracked = $row['Total'];
32 | break;
33 | case 'raid':
34 | $num_raid_tracked = $row['Total'];
35 | break;
36 | case 'egg':
37 | $num_raid_tracked += $row['Total'];
38 | break;
39 | case 'quest':
40 | $num_quest_tracked = $row['Total'];
41 | break;
42 | case 'invasion':
43 | $num_invasion_tracked = $row['Total'];
44 | break;
45 | case 'lures':
46 | $num_lure_tracked = $row['Total'];
47 | break;
48 | case 'nests':
49 | $num_nest_tracked = $row['Total'];
50 | break;
51 | case 'gym':
52 | $num_gym_tracked = $row['Total'];
53 | break;
54 | };
55 | }
56 | $stmt->close();
57 |
58 | ?>
59 |
60 |
134 |
135 |
--------------------------------------------------------------------------------
/actions/channel_sync.php:
--------------------------------------------------------------------------------
1 | $value) {
9 | if (substr($key, 0, 7) == "target_") {
10 | $target = ltrim($key, 'target_');
11 | $target_fields = explode("|", $target);
12 | $target_db=$target_fields[0];
13 | $target_id=$target_fields[1];
14 | $target_id=str_replace("_com", ".com", $target_id);
15 |
16 | // Database names cannot be parameterized in prepared statements (they are identifiers, not values)
17 | // so we use a whitelist to validate the database name before using string interpolation
18 | $allowed_dbs = explode(",", $dbname);
19 | if (!in_array($target_db, $allowed_dbs)) {
20 | die("Invalid database");
21 | }
22 |
23 | // Delete All Previous Trackings
24 | $stmt = $conn->prepare("DELETE FROM ".$target_db.".monsters WHERE id = ?");
25 | $rs = $stmt->bind_param("s", $target_id);
26 | $rs = $stmt->execute();
27 | $stmt->close();
28 |
29 | $stmt = $conn->prepare("DELETE FROM ".$target_db.".egg WHERE id = ?");
30 | $rs = $stmt->bind_param("s", $target_id);
31 | $rs = $stmt->execute();
32 | $stmt->close();
33 |
34 | $stmt = $conn->prepare("DELETE FROM ".$target_db.".raid WHERE id = ?");
35 | $rs = $stmt->bind_param("s", $target_id);
36 | $rs = $stmt->execute();
37 | $stmt->close();
38 |
39 | $stmt = $conn->prepare("DELETE FROM ".$target_db.".quest WHERE id = ?");
40 | $rs = $stmt->bind_param("s", $target_id);
41 | $rs = $stmt->execute();
42 | $stmt->close();
43 |
44 | // Insert New Monsters Tracking
45 |
46 | $stmt = $conn->prepare("INSERT INTO ".$target_db.".monsters
47 | (id, ping, clean, pokemon_id, distance,
48 | min_iv, max_iv,
49 | min_cp, max_cp,
50 | min_level, max_level,
51 | atk, def, sta,
52 | template, min_weight, max_weight, form, max_atk,
53 | max_def, max_sta, gender,
54 | pvp_ranking_worst, pvp_ranking_best, pvp_ranking_min_cp, pvp_ranking_league, pvp_ranking_cap,
55 | profile_no, min_time, rarity, max_rarity,
56 | size, max_size
57 | )
58 | SELECT REPLACE(id, ?, ? ),
59 | ping, clean, pokemon_id, distance,
60 | min_iv, max_iv,
61 | min_cp, max_cp,
62 | min_level, max_level,
63 | atk, def, sta,
64 | template, min_weight, max_weight, form, max_atk,
65 | max_def, max_sta, gender,
66 | pvp_ranking_worst, pvp_ranking_best, pvp_ranking_min_cp, pvp_ranking_league, pvp_ranking_cap,
67 | profile_no, min_time, rarity, max_rarity,
68 | size, max_size
69 | FROM monsters
70 | WHERE id = ?
71 | ");
72 |
73 | $rs = $stmt->bind_param("sss", $_SESSION['id'], $target_id, $_SESSION['id']);
74 | $rs = $stmt->execute();
75 | $stmt->close();
76 |
77 | // Insert New Eggs Tracking
78 |
79 | $stmt = $conn->prepare("INSERT INTO ".$target_db.".egg
80 | (id,ping, clean, exclusive, template, distance, team, level, profile_no)
81 | SELECT REPLACE(id, ?, ? ),
82 | ping, clean, exclusive, template, distance, team, level, profile_no
83 | FROM egg
84 | WHERE id = ?
85 | ");
86 |
87 | $rs = $stmt->bind_param("sss", $_SESSION['id'], $target_id, $_SESSION['id']);
88 | $rs = $stmt->execute();
89 | $stmt->close();
90 |
91 | // Insert New Raids Tracking
92 |
93 | $stmt = $conn->prepare("INSERT INTO ".$target_db.".raid
94 | (id, ping, clean, pokemon_id, exclusive, template, distance, team, level, form, profile_no)
95 | SELECT REPLACE(id, ?, ? ),
96 | ping, clean, pokemon_id, exclusive, template, distance, team, level, form, profile_no
97 | FROM raid
98 | WHERE id = ?
99 | ");
100 |
101 | $rs = $stmt->bind_param("sss", $_SESSION['id'], $target_id, $_SESSION['id']);
102 | $rs = $stmt->execute();
103 | $stmt->close();
104 |
105 | // Insert New Quests Tracking
106 |
107 | $stmt = $conn->prepare("INSERT INTO ".$target_db.".quest
108 | (id, ping, clean, reward, template, shiny, reward_type, distance, profile_no)
109 | SELECT REPLACE(id, ?, ? ),
110 | ping, clean, reward, template, shiny, reward_type, distance, profile_no
111 | FROM quest
112 | WHERE id = ?
113 | ");
114 |
115 | $rs = $stmt->bind_param("sss", $_SESSION['id'], $target_id, $_SESSION['id']);
116 | $rs = $stmt->execute();
117 | $stmt->close();
118 |
119 | }
120 | }
121 |
122 | header("Location: $redirect_url?return=success_channel_sync");
123 | exit();
124 |
125 | }
126 |
127 | include "./action_error.php";
128 |
129 |
--------------------------------------------------------------------------------
/modal/edit_invasions_modal.php:
--------------------------------------------------------------------------------
1 |
5 | ";
6 |
7 | echo "
";
8 |
9 | if ( $row['gender'] <> 0 ) {
10 | echo "

";
11 | } else {
12 | if ( isset($grunt_id_male) ) {
13 | echo "

";
14 | }
15 | if ( isset($grunt_id_female) ) {
16 | echo "

";
17 | }
18 | }
19 |
20 |
21 | echo "
";
22 |
23 | ?>
24 |
25 |
26 |
27 |
28 |
'>
29 |
30 |
31 |
32 |
33 |
66 |
67 |
68 |
69 |
77 |
78 |
79 |
80 |
81 |
106 |
107 | 1 ) {
108 | echo '
';
124 | } ?>
125 |
126 |
137 |
138 |
139 |
--------------------------------------------------------------------------------
/login.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
- Login
14 |
15 |
16 |
17 |
18 |
19 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
35 |
36 |
37 |
40 |
41 |
44 |
45 |
48 |
49 |
50 |
53 |
54 |
57 |
58 |
61 |
62 |
63 |
66 |
67 |
70 |
71 |
74 |
75 |
76 |
79 |
80 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | 'False' ){ ?>
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
--------------------------------------------------------------------------------
/include/cache_handler.php:
--------------------------------------------------------------------------------
1 | array(
54 | 'method'=>"GET",
55 | 'header'=>"Accept-language: en\r\n" .
56 | "X-Poracle-Secret: $api_secret\r\n"
57 | )
58 | );
59 | $context = stream_context_create($opts);
60 |
61 | // Cache Monsters.json
62 |
63 | global $monsters_json;
64 | if (file_exists($file_monsters) && (filemtime($file_monsters) > (time() - 60 * 60 * $repo_MasterData_cache ))) {
65 | $monsters_json = file_get_contents($file_monsters);
66 | } else {
67 | $MasterData_json = file_get_contents($repo_MasterData);
68 | $json = json_decode($MasterData_json, true);
69 | $monsters_json = json_encode($json['monsters'],JSON_PRETTY_PRINT);
70 | file_put_contents($file_monsters, $monsters_json);
71 | }
72 |
73 | // Cache Items.json
74 |
75 | global $items_json;
76 | if (file_exists($file_items) && (filemtime($file_items) > (time() - 60 * 60 * $repo_MasterData_cache ))) {
77 | $items_json = file_get_contents($file_items);
78 | } else {
79 | $MasterData_json = file_get_contents($repo_MasterData);
80 | $json = json_decode($MasterData_json, true);
81 | $items_json = json_encode($json['items'],JSON_PRETTY_PRINT);
82 | file_put_contents($file_items, $items_json);
83 | }
84 |
85 |
86 | // Cache Util.json
87 |
88 | global $grunts_json;
89 | if (file_exists($file_grunts) && (filemtime($file_grunts) > (time() - 60 * 60 * $repo_poracle_cache ))) {
90 | $grunts_json = file_get_contents($file_grunts);
91 |
92 | } else {
93 | $grunts_api_json = file_get_contents("$api_address/api/masterdata/grunts", false, $context);
94 | $json = json_decode($grunts_api_json, true);
95 | $grunts_json = json_encode($json,JSON_PRETTY_PRINT);
96 | file_put_contents($file_grunts, $grunts_json);
97 | }
98 |
99 | // Cache raid-bosses.json
100 |
101 | global $bosses_json;
102 | if (file_exists($file_raid_bosses) && (filemtime($file_raid_bosses) > (time() - 60 * 60 * $repo_pogoinfo_cache ))) {
103 | $bosses_json = file_get_contents($file_raid_bosses);
104 |
105 | } else {
106 | #$bosses_json = file_get_contents($repo_pogoinfo."/info/raid-bosses.json");
107 | $bosses_json = file_get_contents($repo_pogoinfo."/v2/active/raids.json");
108 | file_put_contents($file_raid_bosses, $bosses_json);
109 | }
110 |
111 | // Cache nest_species.json
112 |
113 | global $nest_species_json;
114 | if (file_exists($file_nest_species) && (filemtime($file_nest_species) > (time() - 60 * 60 * $repo_pogoinfo_cache ))) {
115 | $nest_species_json = file_get_contents($file_nest_species);
116 |
117 | } else {
118 | $nest_species_json = file_get_contents($repo_pogoinfo."/v2/nests/species-ids.json");
119 | file_put_contents($file_nest_species, $nest_species_json);
120 | }
121 |
122 | // Cache pokemonNames locale file
123 |
124 | global $localePkmnData_json;
125 | if (file_exists($file_localePkmnData) && (filemtime($file_localePkmnData) > (time() - 60 * 60 * $repo_locales_cache ))) {
126 | $localePkmnData_json = file_get_contents($file_localePkmnData);
127 | } else if ( @fopen($repo_locales."/pokemon_".$locale.".json", 'r') ) {
128 | $localePkmnData_json = file_get_contents($repo_locales."/pokemon_".$locale.".json");
129 | file_put_contents($file_localePkmnData, $localePkmnData_json);
130 | } else if (isset($locale)) {
131 | $localePkmnData_json = file_get_contents($repo_locales."pokemon_en.json");
132 | }
133 |
134 | // Cache FormsNames locale file
135 |
136 | global $localeFormsData_json;
137 | if (file_exists($file_localeFormsData) && (filemtime($file_localeFormsData) > (time() - 60 * 60 * $repo_locales_cache ))) {
138 | $localeFormsData_json = file_get_contents($file_localeFormsData);
139 | } else if ( @fopen($repo_locales."/forms_".$locale.".json", 'r') ) {
140 | $localeFormsData_json = file_get_contents($repo_locales."/forms_".$locale.".json");
141 | file_put_contents($file_localeFormsData, $localeFormsData_json);
142 | } else if (isset($locale)) {
143 | $localeFormsData_json = file_get_contents($repo_locales."forms_en.json");
144 | }
145 |
146 |
147 | // Cache itemNames locale file
148 |
149 | global $localeItemsData_json;
150 | if (file_exists($file_localeItemsData) && (filemtime($file_localeItemsData) > (time() - 60 * 60 * $repo_locales_cache ))) {
151 | $localeItemsData_json = file_get_contents($file_localeItemsData);
152 | } else if ( @fopen($repo_locales."/items_".$locale.".json", 'r') ) {
153 | $localeItemsData_json = file_get_contents($repo_locales."/items_".$locale.".json");
154 | file_put_contents($file_localeItemsData, $localeItemsData_json);
155 | } else if (isset($locale)) {
156 | $localeItemsData_json = file_get_contents($repo_locales."items_en.json");
157 | }
158 |
159 |
160 | ?>
161 |
--------------------------------------------------------------------------------
/actions/lures.php:
--------------------------------------------------------------------------------
1 | $value) {
11 | if (substr($value, 0, 6) === "clean_") {
12 | $clean = ltrim($value, 'clean_');
13 | }
14 | }
15 | $template = !empty($_POST['template']) ? $_POST['template'] : $_SESSION['defaultTemplateName'];
16 |
17 | $stmt = $conn->prepare("
18 | UPDATE lures
19 | SET distance = ?, clean = ?, template = ?, ping = ?
20 | WHERE uid = ?");
21 |
22 | if (false === $stmt) {
23 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=UL1&sql=$stmt->error");
24 | exit();
25 | }
26 |
27 | $rs = $stmt->bind_param(
28 | "iissi",
29 | $_POST['distance'],
30 | $clean,
31 | $template,
32 | $_POST['content'],
33 | $_POST['uid']
34 | );
35 |
36 | if (false === $rs) {
37 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=UL2&sql=$stmt->error");
38 | exit();
39 | }
40 |
41 | $rs = $stmt->execute();
42 |
43 | if (false === $rs) {
44 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=UL3&sql=$stmt->error");
45 | exit();
46 | }
47 |
48 | $stmt->close();
49 | header("Location: $redirect_url?type=display&page=lure&return=success_update_lure");
50 | exit();
51 | }
52 |
53 |
54 | // DELETE LURES
55 |
56 | if (isset($_POST['delete']) && isset($_POST['type']) && $_POST['type'] == 'lures') {
57 |
58 | $stmt = $conn->prepare("
59 | DELETE FROM lures
60 | WHERE uid = ?");
61 |
62 | if (false === $stmt) {
63 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=DL1&sql=$stmt->error");
64 | exit();
65 | }
66 |
67 | $rs = $stmt->bind_param(
68 | "i",
69 | $_POST['uid']
70 | );
71 |
72 | if (false === $rs) {
73 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=DL2&sql=$stmt->error");
74 | exit();
75 | }
76 |
77 | $rs = $stmt->execute();
78 |
79 | if (false === $rs) {
80 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=DL3&sql=$stmt->error");
81 | exit();
82 | }
83 |
84 | $stmt->close();
85 | header("Location: $redirect_url?type=display&page=lure&return=success_delete_lure");
86 | exit();
87 | }
88 |
89 |
90 | // ADD LURE
91 |
92 | if (isset($_POST['add_lures'])) {
93 |
94 | foreach ($_POST as $key => $value) {
95 | if (substr($value, 0, 6) === "clean_") {
96 | $clean = ltrim($value, 'clean_');
97 | }
98 | }
99 | $template = !empty($_POST['template']) ? $_POST['template'] : $_SESSION['defaultTemplateName'];
100 |
101 | foreach ($_POST as $key => $value) {
102 | if (substr($key, 0, 5) === "lure_") {
103 | $lure = substr($key, 5);
104 |
105 | $stmt = $conn->prepare("INSERT INTO lures ( id, ping, clean, distance, template, lure_id, profile_no)
106 | VALUES ( ?, ?, ? , ?, ?, ?, ?)");
107 | if (false === $stmt) {
108 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=AL1&sql=$stmt->error");
109 | exit();
110 | }
111 | $rs = $stmt->bind_param("ssiisii", $_SESSION['id'], $_POST['content'], $clean, $_POST['distance'], $template, $lure, $_SESSION['profile']);
112 | if (false === $rs) {
113 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=AL2&sql=$stmt->error");
114 | exit();
115 | }
116 | $rs = $stmt->execute();
117 | if (false === $rs) {
118 | if ( stristr($stmt->error, "Duplicate") ) {
119 | header("Location: $redirect_url?type=display&page=lure&return=duplicate");
120 | exit();
121 | }
122 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=AL3&sql=$stmt->error");
123 | exit();
124 | }
125 | $stmt->close();
126 | }
127 | }
128 |
129 | header("Location: $redirect_url?type=display&page=lure&return=success_added_lures");
130 | exit();
131 | }
132 |
133 | // DELETE ALL LURES
134 |
135 | if (isset($_GET['action']) && $_GET['action'] == 'delete_all_lures') {
136 |
137 | $stmt = $conn->prepare("DELETE FROM lures WHERE id = ? AND profile_no = ?");
138 | if (false === $stmt) {
139 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=DAL1&sql=$stmt->error");
140 | exit();
141 | }
142 | $rs = $stmt->bind_param("si", $_SESSION['id'], $_SESSION['profile']);
143 | if (false === $rs) {
144 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=DAL2&sql=$stmt->error");
145 | exit();
146 | }
147 | $rs = $stmt->execute();
148 | if (false === $rs) {
149 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=DAL3&sql=$stmt->error");
150 | exit();
151 | }
152 | $stmt->close();
153 |
154 | header("Location: $redirect_url?type=display&page=lure&return=success_delete_lures");
155 | exit();
156 | }
157 |
158 |
159 | // UPDATE ALL LURES DISTANCE
160 |
161 | if (isset($_GET['action']) && $_GET['action'] == 'update_lures_distance') {
162 |
163 | $stmt = $conn->prepare("UPDATE lures set distance = ? WHERE id = ? AND profile_no = ?");
164 | if (false === $stmt) {
165 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=ULD1&sql=$stmt->error");
166 | exit();
167 | }
168 | $rs = $stmt->bind_param("isi", $_POST['distance'], $_SESSION['id'], $_SESSION['profile']);
169 | if (false === $rs) {
170 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=ULD2&sql=$stmt->error");
171 | exit();
172 | }
173 | $rs = $stmt->execute();
174 | if (false === $rs) {
175 | header("Location: $redirect_url?type=display&page=lure&return=sql_error&phase=ULD3&sql=$stmt->error");
176 | exit();
177 | }
178 | $stmt->close();
179 |
180 | header("Location: $redirect_url?type=display&page=lure&return=success_update_lures_distance");
181 | exit();
182 |
183 | }
184 |
185 | include "./action_error.php";
186 |
187 |
--------------------------------------------------------------------------------
/actions/nests.php:
--------------------------------------------------------------------------------
1 | $value) {
11 | if (substr($value, 0, 6) === "clean_") {
12 | $clean = ltrim($value, 'clean_');
13 | }
14 | }
15 | $template = !empty($_POST['template']) ? $_POST['template'] : $_SESSION['defaultTemplateName'];
16 |
17 | $stmt = $conn->prepare("
18 | UPDATE nests
19 | SET distance = ?, clean = ?, min_spawn_avg = ?, template = ?, ping = ?
20 | WHERE uid = ?");
21 |
22 | if (false === $stmt) {
23 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=UN1&sql=$stmt->error");
24 | exit();
25 | }
26 |
27 | $rs = $stmt->bind_param(
28 | "iiissi",
29 | $_POST['distance'],
30 | $clean,
31 | $_POST['min_spawns'],
32 | $template,
33 | $_POST['content'],
34 | $_POST['uid']
35 | );
36 |
37 | if (false === $rs) {
38 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=UN2&sql=$stmt->error");
39 | exit();
40 | }
41 |
42 | $rs = $stmt->execute();
43 |
44 | if (false === $rs) {
45 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=UN3&sql=$stmt->error");
46 | exit();
47 | }
48 |
49 | $stmt->close();
50 | header("Location: $redirect_url?type=display&page=nest&return=success_update_nest");
51 | exit();
52 | }
53 |
54 |
55 | // DELETE NESTS
56 |
57 | if (isset($_POST['delete']) && isset($_POST['type']) && $_POST['type'] == 'nests') {
58 |
59 | $stmt = $conn->prepare("
60 | DELETE FROM nests
61 | WHERE uid = ?");
62 |
63 | if (false === $stmt) {
64 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=DN1&sql=$stmt->error");
65 | exit();
66 | }
67 |
68 | $rs = $stmt->bind_param(
69 | "i",
70 | $_POST['uid']
71 | );
72 |
73 | if (false === $rs) {
74 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=DN2&sql=$stmt->error");
75 | exit();
76 | }
77 |
78 | $rs = $stmt->execute();
79 |
80 | if (false === $rs) {
81 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=DN3&sql=$stmt->error");
82 | exit();
83 | }
84 |
85 | $stmt->close();
86 | header("Location: $redirect_url?type=display&page=nest&return=success_delete_nest");
87 | exit();
88 | }
89 |
90 |
91 | // ADD NEST
92 |
93 | if (isset($_POST['add_nests'])) {
94 |
95 | foreach ($_POST as $key => $value) {
96 | if (substr($value, 0, 6) === "clean_") {
97 | $clean = ltrim($value, 'clean_');
98 | }
99 | }
100 | $template = !empty($_POST['template']) ? $_POST['template'] : $_SESSION['defaultTemplateName'];
101 |
102 | foreach ($_POST as $key => $value) {
103 | if (substr($key, 0, 5) === "nest_") {
104 | $nest = substr($key, 5);
105 |
106 | $stmt = $conn->prepare("INSERT INTO nests ( id, ping, clean, distance, template, pokemon_id, min_spawn_avg, form, profile_no)
107 | VALUES ( ?, ?, ? , ?, ?, ?, ?, 0, ?)");
108 | if (false === $stmt) {
109 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=AN1&sql=$stmt->error");
110 | exit();
111 | }
112 | $rs = $stmt->bind_param("ssiisiii", $_SESSION['id'], $_POST['content'], $clean, $_POST['distance'], $template, $nest, $_POST['min_spawns'], $_SESSION['profile']);
113 | if (false === $rs) {
114 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=AN2&sql=$stmt->error");
115 | exit();
116 | }
117 | $rs = $stmt->execute();
118 | if (false === $rs) {
119 | if ( stristr($stmt->error, "Duplicate") ) {
120 | header("Location: $redirect_url?type=display&page=nest&return=duplicate");
121 | exit();
122 | }
123 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=AN3&sql=$stmt->error");
124 | exit();
125 | }
126 | $stmt->close();
127 | }
128 | }
129 |
130 | header("Location: $redirect_url?type=display&page=nest&return=success_added_nests");
131 | exit();
132 | }
133 |
134 | // DELETE ALL NESTS
135 |
136 | if (isset($_GET['action']) && $_GET['action'] == 'delete_all_nests') {
137 |
138 | $stmt = $conn->prepare("DELETE FROM nests WHERE id = ? AND profile_no = ?");
139 | if (false === $stmt) {
140 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=DAN1&sql=$stmt->error");
141 | exit();
142 | }
143 | $rs = $stmt->bind_param("si", $_SESSION['id'], $_SESSION['profile']);
144 | if (false === $rs) {
145 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=DAN2&sql=$stmt->error");
146 | exit();
147 | }
148 | $rs = $stmt->execute();
149 | if (false === $rs) {
150 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=DAN3&sql=$stmt->error");
151 | exit();
152 | }
153 | $stmt->close();
154 |
155 | header("Location: $redirect_url?type=display&page=nest&return=success_delete_nests");
156 | exit();
157 | }
158 |
159 |
160 | // UPDATE ALL NESTS DISTANCE
161 |
162 | if (isset($_GET['action']) && $_GET['action'] == 'update_nests_distance') {
163 |
164 | $stmt = $conn->prepare("UPDATE nests set distance = ? WHERE id = ? AND profile_no = ?");
165 | if (false === $stmt) {
166 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=UND1&sql=$stmt->error");
167 | exit();
168 | }
169 | $rs = $stmt->bind_param("isi", $_POST['distance'], $_SESSION['id'], $_SESSION['profile']);
170 | if (false === $rs) {
171 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=UND2&sql=$stmt->error");
172 | exit();
173 | }
174 | $rs = $stmt->execute();
175 | if (false === $rs) {
176 | header("Location: $redirect_url?type=display&page=nest&return=sql_error&phase=UND3&sql=$stmt->error");
177 | exit();
178 | }
179 | $stmt->close();
180 |
181 | header("Location: $redirect_url?type=display&page=nest&return=success_update_nests_distance");
182 | exit();
183 |
184 | }
185 |
186 | include "./action_error.php";
187 |
188 |
--------------------------------------------------------------------------------