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
3c20f042
Commit
3c20f042
authored
Sep 30, 2011
by
David Morley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check db for existing data on add
parent
25d0b421
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
+29
-2
db/add.php
db/add.php
+27
-0
db/show.php
db/show.php
+1
-1
db/tables.sql
db/tables.sql
+1
-1
No files found.
db/add.php
View file @
3c20f042
<?php
<?php
include
(
'config.php'
);
include
(
'config.php'
);
if
(
!
$_POST
[
'url'
]){
echo
"no url given"
;
die
;
}
if
(
!
$_POST
[
'email'
]){
echo
"no email given"
;
die
;
}
if
(
!
$_POST
[
'domain'
]){
echo
"no pod domain given"
;
die
;
}
$dbh
=
pg_connect
(
"dbname=
$pgdb
user=
$pguser
password=
$pgpass
"
);
$dbh
=
pg_connect
(
"dbname=
$pgdb
user=
$pguser
password=
$pgpass
"
);
if
(
!
$dbh
)
{
if
(
!
$dbh
)
{
die
(
"Error in connection: "
.
pg_last_error
());
die
(
"Error in connection: "
.
pg_last_error
());
}
}
$sql
=
"SELECT domain,pingdomurl FROM pods"
;
$result
=
pg_query
(
$dbh
,
$sql
);
if
(
!
$result
)
{
die
(
"Error in SQL query: "
.
pg_last_error
());
}
while
(
$row
=
pg_fetch_array
(
$result
))
{
if
(
$row
[
"domain"
]
==
$_POST
[
'domain'
])
{
echo
"domain already exists"
;
die
;
}
if
(
$row
[
"pingdomurl"
]
==
$_POST
[
'url'
])
{
echo
"pingdom report already exists"
;
die
;
}
}
$pingdomurl
=
pg_escape_string
(
$_POST
[
'url'
]);
$pingdomurl
=
pg_escape_string
(
$_POST
[
'url'
]);
$domain
=
pg_escape_string
(
$_POST
[
'domain'
]);
$domain
=
pg_escape_string
(
$_POST
[
'domain'
]);
...
...
db/show.php
View file @
3c20f042
...
@@ -19,7 +19,7 @@ od last updated from the main Diaspora code.">?</a></th>
...
@@ -19,7 +19,7 @@ od last updated from the main Diaspora code.">?</a></th>
if
(
!
$dbh
)
{
if
(
!
$dbh
)
{
die
(
"Error in connection: "
.
pg_last_error
());
die
(
"Error in connection: "
.
pg_last_error
());
}
}
$sql
=
"SELECT * FROM pods"
;
$sql
=
"SELECT * FROM pods
WHERE hidden <> 'no'
"
;
$result
=
pg_query
(
$dbh
,
$sql
);
$result
=
pg_query
(
$dbh
,
$sql
);
if
(
!
$result
)
{
if
(
!
$result
)
{
die
(
"Error in SQL query: "
.
pg_last_error
());
die
(
"Error in SQL query: "
.
pg_last_error
());
...
...
db/tables.sql
View file @
3c20f042
...
@@ -2,7 +2,7 @@ CREATE TABLE pods (
...
@@ -2,7 +2,7 @@ CREATE TABLE pods (
id
serial8
UNIQUE
PRIMARY
KEY
,
id
serial8
UNIQUE
PRIMARY
KEY
,
domain
text
UNIQUE
NOT
NULL
,
domain
text
UNIQUE
NOT
NULL
,
whois
text
,
whois
text
,
hidden
text
DEFAULT
'
no
'
,
hidden
text
DEFAULT
'
yes
'
,
ip
cidr
,
ip
cidr
,
ptr
text
,
ptr
text
,
email
text
,
email
text
,
...
...
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