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
b5d75d3b
Commit
b5d75d3b
authored
Mar 10, 2014
by
MatrixCrawler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduced PDO-SQL and new config file into rate.php
parent
e0d86ffb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
25 deletions
+28
-25
rate.php
rate.php
+28
-25
No files found.
rate.php
View file @
b5d75d3b
...
...
@@ -35,31 +35,37 @@ $("#rating").prop( "value", value )
<body>
<div
style=
"height:500px;width:900px;"
>
<?php
include
(
'db/config.php'
);
$dbh
=
pg_connect
(
"dbname=
$pgdb
user=
$pguser
password=
$pgpass
"
);
if
(
!
$dbh
)
{
die
(
"Error in connection: "
.
pg_last_error
());
}
if
(
is_null
(
$_GET
[
'domain'
]))
{
die
(
"domain not specified"
);
}
$sql
=
"SELECT * FROM rating_comments WHERE domain = $1"
;
$result
=
pg_query_params
(
$dbh
,
$sql
,
array
(
$_GET
[
'domain'
]));
if
(
!
$result
)
{
die
(
"Error in SQL query: "
.
pg_last_error
());
}
$numrows
=
pg_num_rows
(
$result
);
if
(
!
isset
(
$_GET
[
'domain'
]))
{
die
(
"domain not specified"
);
}
require_once
'db/config.inc.php'
;
require_once
'db/db.class.php'
;
$dbConnection
=
DB
::
connectDB
();
if
(
!
$dbConnection
)
{
die
(
"Error in connection: "
.
$dbConnection
->
errorInfo
()[
2
]);
}
$sql
=
"SELECT * FROM rating_comments WHERE domain = "
.
$dbConnection
->
quote
(
$_GET
[
'domain'
]);
$result
=
$dbConnection
->
query
(
$sql
);
if
(
!
$result
)
{
die
(
"Error in SQL query: "
.
$dbConnection
->
errorInfo
()[
2
]);
}
$numrows
=
$result
->
rowCount
();
echo
"<input id='addrating' class='btn primary' style='float:right;margin-right:15px;' type='submit' value='Add a Rating'><h3>Podupti.me ratings for "
.
$_GET
[
"domain"
]
.
" pod (beta feature)</h3><div id='ratings'><hr>"
;
if
(
!
$numrows
)
{
echo
"<b>This pod has no rating yet!</b>"
;}
while
(
$row
=
pg_fetch_array
(
$result
)
)
{
if
(
$row
[
"admin"
]
==
1
)
{
echo
"Poduptime Approved Comment - User: <b>"
.
$row
[
"username"
]
.
"</b> Url: <a href='"
.
$row
[
"userurl"
]
.
"'>"
.
$row
[
"userurl"
]
.
"</a> Rating: <b>"
.
$row
[
"rating"
]
.
"</b> <br>"
;
echo
"<i>"
.
$row
[
"comment"
]
.
"</i><span class='label' title='id: "
.
$row
[
"id"
]
.
"' style='float:right;margin-right:115px;'>"
.
$row
[
"date"
]
.
"</span><hr>"
;
}
elseif
(
$row
[
"admin"
]
==
0
)
{
echo
"User Comment - User: <b>"
.
$row
[
"username"
]
.
"</b> Url: <a href='"
.
$row
[
"userurl"
]
.
"'>"
.
$row
[
"userurl"
]
.
"</a> Rating: <b>"
.
$row
[
"rating"
]
.
"</b> <br>"
;
echo
"<i>"
.
$row
[
"comment"
]
.
"</i><span class='label' title='id: "
.
$row
[
"id"
]
.
"' style='float:right;margin-right:115px;'>"
.
$row
[
"date"
]
.
"</span><hr style='margin-top:0;margin-bottom:15px;'>"
;
}
foreach
(
$result
->
fetchAll
()
as
$row
)
{
if
(
$row
[
"admin"
]
==
1
)
{
echo
"Poduptime Approved Comment - User: <b>"
.
$row
[
"username"
]
.
"</b> Url: <a href='"
.
$row
[
"userurl"
]
.
"'>"
.
$row
[
"userurl"
]
.
"</a> Rating: <b>"
.
$row
[
"rating"
]
.
"</b> <br>"
;
echo
"<i>"
.
$row
[
"comment"
]
.
"</i><span class='label' title='id: "
.
$row
[
"id"
]
.
"' style='float:right;margin-right:115px;'>"
.
$row
[
"date"
]
.
"</span><hr>"
;
}
elseif
(
$row
[
"admin"
]
==
0
)
{
echo
"User Comment - User: <b>"
.
$row
[
"username"
]
.
"</b> Url: <a href='"
.
$row
[
"userurl"
]
.
"'>"
.
$row
[
"userurl"
]
.
"</a> Rating: <b>"
.
$row
[
"rating"
]
.
"</b> <br>"
;
echo
"<i>"
.
$row
[
"comment"
]
.
"</i><span class='label' title='id: "
.
$row
[
"id"
]
.
"' style='float:right;margin-right:115px;'>"
.
$row
[
"date"
]
.
"</span><hr style='margin-top:0;margin-bottom:15px;'>"
;
}
}
echo
<<<EOF
</div>
<div id="commentform" style="display:none">
...
...
@@ -73,8 +79,5 @@ Rating (1-10 scale, 10 high)<br><div id="slider"></div><input class="disabled" d
</div>
EOF;
pg_free_result
(
$result
);
pg_close
(
$dbh
);
?>
</div>
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