Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Poduptime
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
diasporg
Poduptime
Commits
c98e670d
Unverified
Commit
c98e670d
authored
Jan 29, 2017
by
dmorley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
few misses
parent
0095c9f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
64 deletions
+15
-64
db/add.php
db/add.php
+15
-14
showstats.php
showstats.php
+0
-50
No files found.
db/add.php
View file @
c98e670d
...
@@ -71,25 +71,26 @@ if (stristr($outputssl, 'openRegistrations')) {
...
@@ -71,25 +71,26 @@ if (stristr($outputssl, 'openRegistrations')) {
echo
'Your pod has ssl and is valid<br>'
;
echo
'Your pod has ssl and is valid<br>'
;
$publickey
=
md5
(
uniqid
(
$domain
,
true
));
$publickey
=
md5
(
uniqid
(
$domain
,
true
));
$sql
=
'INSERT INTO pods (domain, email, terms, publickey) VALUES ($1, $2, $3, $4
, $5
)'
;
$sql
=
'INSERT INTO pods (domain, email, terms, publickey) VALUES ($1, $2, $3, $4)'
;
$result
=
pg_query_params
(
$dbh
,
$sql
,
[
$_domain
,
$_email
,
$_terms
,
$publickey
]);
$result
=
pg_query_params
(
$dbh
,
$sql
,
[
$_domain
,
$_email
,
$_terms
,
$publickey
]);
$result
||
die
(
'Error in SQL query: '
.
pg_last_error
());
$result
||
die
(
'Error in SQL query: '
.
pg_last_error
());
$to
=
$adminemail
;
if
(
$_email
)
{
$subject
=
'New pod added to '
.
$_SERVER
[
'HTTP_HOST'
];
$to
=
$adminemail
;
$headers
=
[
'From: '
.
$_email
,
'Reply-To: '
.
$_email
,
'Cc: '
.
$_email
];
$subject
=
'New pod added to '
.
$_SERVER
[
'HTTP_HOST'
];
$headers
=
[
'From: '
.
$_email
,
'Reply-To: '
.
$_email
,
'Cc: '
.
$_email
];
$message_lines
=
[
$message_lines
=
[
'https://'
.
$_SERVER
[
'HTTP_HOST'
],
'https://'
.
$_SERVER
[
'HTTP_HOST'
],
'Stats Url: https://api.uptimerobot.com/getMonitors?format=json&noJsonCallback=1&customUptimeRatio=7-30-60-90&apiKey='
.
$_stats_apikey
,
'Pod: https://'
.
$_SERVER
[
'HTTP_HOST'
]
.
'/db/pull.php?debug=1&domain='
.
$_domain
,
'Pod: https://'
.
$_SERVER
[
'HTTP_HOST'
]
.
'/db/pull.php?debug=1&domain='
.
$_domain
,
''
,
''
,
'Your pod will not show up right away, as it needs to pass a few checks first.'
,
'Your pod will not show up right away, as it needs to pass a few checks first.'
,
'Give it a few hours!'
,
'Give it a few hours!'
,
];
];
@
mail
(
$to
,
$subject
,
implode
(
"
\r\n
"
,
$message_lines
),
implode
(
"
\r\n
"
,
$headers
));
@
mail
(
$to
,
$subject
,
implode
(
"
\r\n
"
,
$message_lines
),
implode
(
"
\r\n
"
,
$headers
));
}
echo
'Data successfully inserted! Your pod will be reviewed and live on the list in a few hours!'
;
echo
'Data successfully inserted! Your pod will be reviewed and live on the list in a few hours!'
;
}
else
{
}
else
{
...
...
showstats.php
deleted
100644 → 0
View file @
0095c9f0
<?php
//* Copyright (c) 2011-2016, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */
$debug
=
1
;
// Other parameters.
$_domain
=
$_GET
[
'domain'
]
??
null
;
require_once
__DIR__
.
'/config.php'
;
$dbh
=
pg_connect
(
"dbname=
$pgdb
user=
$pguser
password=
$pgpass
"
);
$dbh
||
die
(
'Error in connection: '
.
pg_last_error
());
$sql
=
'SELECT stats_apikey FROM pods WHERE domain = $1'
;
$result
=
pg_query_params
(
$dbh
,
$sql
,
[
$_domain
]);
$result
||
die
(
'Error in SQL query: '
.
pg_last_error
());
$apikey
=
pg_fetch_all
(
$result
);
$upti
=
curl_init
();
$key
=
$apikey
[
0
][
'stats_apikey'
];
$data
=
[
'all_time_uptime_ratio'
=>
1
,
'format'
=>
'json'
,
'custom_uptime_ratios'
=>
'7-30-60-90'
,
'response_times'
=>
1
,
'response_times_average'
=>
86400
,
'api_key'
=>
$key
];
curl_setopt
(
$upti
,
CURLOPT_URL
,
'https://api.uptimerobot.com/v2/getMonitors'
);
curl_setopt
(
$upti
,
CURLOPT_HEADER
,
0
);
curl_setopt
(
$upti
,
CURLOPT_POST
,
1
);
curl_setopt
(
$upti
,
CURLOPT_POSTFIELDS
,
http_build_query
(
$data
));
curl_setopt
(
$upti
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$upti
,
CURLOPT_CONNECTTIMEOUT
,
8
);
$uptr
=
json_decode
(
curl_exec
(
$upti
));
curl_close
(
$upti
);
echo
'<b>UptimeRobot Json displayed in Human</b><br><br>'
;
echo
'Name: '
.
$uptr
->
monitors
[
0
]
->
friendly_name
.
'<br>'
;
echo
'Url: '
.
$uptr
->
monitors
[
0
]
->
url
.
'<br>'
;
echo
'Interval: '
.
$uptr
->
monitors
[
0
]
->
interval
.
'ms<br>'
;
echo
'Uptime: '
.
$uptr
->
monitors
[
0
]
->
all_time_uptime_ratio
.
'%<br>'
;
echo
'Response Time: '
.
round
(
$uptr
->
monitors
[
0
]
->
average_response_time
)
.
'ms<br>'
;
if
(
$uptr
->
monitors
[
0
]
->
status
==
2
)
{
$live
=
'Up'
;
}
if
(
$uptr
->
monitors
[
0
]
->
status
==
0
)
{
$live
=
'Paused'
;
}
if
(
$uptr
->
monitors
[
0
]
->
status
==
1
)
{
$live
=
'Not Checked Yet'
;
}
if
(
$uptr
->
monitors
[
0
]
->
status
==
8
)
{
$live
=
'Seems Down'
;
}
if
(
$uptr
->
monitors
[
0
]
->
status
==
9
)
{
$live
=
'Down'
;
}
echo
'Status: '
.
$live
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment