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
c55772b4
Unverified
Commit
c55772b4
authored
Dec 23, 2016
by
David Morley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
protect go from going to sites other than ones we know about in the pod table
parent
7f562d51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
7 deletions
+17
-7
go.php
go.php
+17
-7
No files found.
go.php
View file @
c55772b4
...
...
@@ -7,12 +7,22 @@ $dbh || die('Error in connection: ' . pg_last_error());
$url
=
$_GET
[
'url'
];
if
(
$url
)
{
header
(
'Location:'
.
$url
);
$host
=
parse_url
(
$url
,
PHP_URL_HOST
);
$sql
=
"SELECT domain FROM pods WHERE domain LIKE '
$host
'"
;
$result
=
pg_query
(
$dbh
,
$sql
);
$result
||
die
(
'Error in SQL query: '
.
pg_last_error
());
$row
=
pg_fetch_all
(
$result
);
if
(
$row
)
{
//Add click counter +1 for $row[0]['domain'] clicks in future, seperate click table
header
(
'Location:'
.
$url
);
}
else
{
die
(
'unknown url'
);
}
}
else
{
$sql
=
"SELECT secure,domain FROM pods WHERE score > 90 AND masterversion = shortversion AND signup = 1 ORDER BY RANDOM() LIMIT 1"
;
$result
=
pg_query
(
$dbh
,
$sql
);
$result
||
die
(
'Error in SQL query: '
.
pg_last_error
());
$row
=
pg_fetch_all
(
$result
);
$scheme
=
$row
[
0
][
'secure'
]
===
'true'
?
'https://'
:
'http://'
;
header
(
'Location:'
.
$scheme
.
$row
[
0
][
'domain'
]
.
'/users/sign_up'
);
$sql
=
"SELECT secure,domain FROM pods WHERE score > 90 AND masterversion = shortversion AND signup = 1 ORDER BY RANDOM() LIMIT 1"
;
$result
=
pg_query
(
$dbh
,
$sql
);
$result
||
die
(
'Error in SQL query: '
.
pg_last_error
());
$row
=
pg_fetch_all
(
$result
);
$scheme
=
$row
[
0
][
'secure'
]
===
'true'
?
'https://'
:
'http://'
;
header
(
'Location:'
.
$scheme
.
$row
[
0
][
'domain'
]
.
'/users/sign_up'
);
}
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