Comments (11)
I have a solution:
I added this page and named it admin-index.php.
This page can only be viewed by the admin.
(Might not be perfect, but it works great!)
<?PHP
error_reporting(-1);
ini_set("display_errors", "on");
require('config.php');
require('common.php');
require('inc/header.php');
echo "<br><div align='center'><font size='+2'>ADMINISTRATION AREA</font></div><br>";
$url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
if (isset($_SESSION['admin'])) {
$showExtensions = array('jpg', 'jpeg', 'png', 'gif');
$dir = opendir("images/");
$template = <<<EOT
<a href="images/{basename}"><img src="images/{basename}" style="max-height: 100px; max-width:100px;" align="ABSmiddle" /></a> <strong>--></strong>
<input type="text" value="http://$url/images/{basename}" style="width:500px" onmouseover="this.select()">
<a href="view.php?id={filename}">Edit/Delete/Ban</a>
<br /><br />
EOT;
while ($file = readdir($dir)) {
$info = pathinfo($file);
if (!in_array($info['extension'], $showExtensions)) continue;
echo str_replace(
array('{basename}', '{filename}'),
array($info['basename'], $info['filename']),
$template
);
}
} else {
echo "<br><div align='center'><font size='+2'>You are not allowed to view this page.<br><br>PLEASE <a href='login.php'>LOGIN</a> FIRST.</font></div><br>";
}
require('inc/footer.php');
echo "<br><br>";
?>
Then I changed this div in the inc/footer.php
<div id="footer">
<a href="faq.php">FAQ</a>|<a href="tc.php">Terms & Conditions</a>|<a href="contact.php">Contact</a>
<!-- page generated in <?php echo round((microtime(true) - $start), 5); ?> seconds with <?php echo $db_queries; ?> DB quer<?php echo ($db_queries === 1 ? 'y' : 'ies'); ?> -->
</div>
To look like this:
This adds a link that can only be viewed by admin that takes you to the view page where you can delete and/or ban, (administer).
<div id="footer">
<a href="faq.php">FAQ</a>|<a href="tc.php">Terms & Conditions</a>|<a href="contact.php">Contact</a><?PHP if (isset($_SESSION['admin'])) { ?>|<a href="admin-index.php">Admin</a><?PHP } ?>
<!-- page generated in <?php echo round((microtime(true) - $start), 5); ?> seconds with <?php echo $db_queries; ?> DB quer<?php echo ($db_queries === 1 ? 'y' : 'ies'); ?> -->
</div>
from upld.
Better than nothing, but show all images can kill the browser :P
We need a proper admin panel where we can see all reports, users stats or the file uploaded from other user.
from upld.
New improved solution for an admin section.
I added two pages, one admin.tpl.html and admin-index.php.
This page can only be viewed by the admin.
(Might not be perfect, but it works great!)
readme.txt
`+----------------------------------------------------+
| Admin section for upld, Image Hosting Script
| https://github.com/lfiore/upld
| Administration Section - v.1.1
| Donations are accepted for Erik on Paypal: http://paypal.me/ErikGroen
| Donations are accepted for Iron Tongue on Paypal: http://paypal.me/lomsc
| Contents: admin-index.php, admin.tpl.html & this file.
+----------------------------------------------------+
Features:
Admin Index Section
--- 10 most recently registered users.
------ Showing Email, User IP and date registered.
--------- Clicking user's email address will take you to user's details.
--- 10 most recently uploaded images.
------ Showing user's email, user IP, image name and date uploaded.
--------- Clicking user's email address will take you to user's details.
--------- Ability to mark images for removal to permanently delete them one at a time or as a group of removed images later from the Manage Images section.
--------- Ability to unmark for removal.
--------- With confirmation of each action taken.
--- 10 most recently unhandled reports
------ Showing Email, image name and extension and date image was uploaded.
--------- Clicking user's email address will take you to user's details.
--------- Ability to mark images for removal to permanently delete them one at a time or as a group of removed images later from the Manage Images section.
--------- Ability to unmark for removal.
--------- Ability to acknowledge the report and leave the image or to delete the image permanently from the Manage Images section.
--------- With confirmation of each action taken.
+++++++++++++++++++++++++++++++++++++++++++
Manage Users Section
--- Shows total users in database.
--- Change order of users by Ascending/Descending.
------ Shows all users in the database, 20 per page.( Editable in the admin.tpl.html file. )
------ Shows User Email, User IP, Number of Images Uploaded, Ban Status, Admin Status and the option to Delete the User.
--------- Clicking user's email address will take you to user's details.
--------- Ability to Ban the user, Unban the User and Delete User.
--------- Ability to Add Admin Status and Remove Admin Status.
--------- With Pagination.
--------- With confirmation of each action taken.
+++++++++++++++++++++++++++++++++++++++++++
Manage Images Section
--- Shows total images in the database.
--- Change order of users by Ascending/Descending.
------ Shows a thumbanil image of all images in database, 10 per page.( Editable in the admin.tpl.html file. )
------ Clicking and image takes you to the view page.
--------- Shows image name and extension, date image was uploaded, user's IP at the time of upload and the user's email.
--------- Clicking user's email address will take you to user's details.
--------- Ability to mark images for removal to permanently delete them one at a time or as a group of removed images later from the Manage Images section.
--------- Ability to unmark for removal.
--------- Ability to acknowledge the report and leave the image or to delete the image permanently form the Manage Images section.
--------- With confirmation of each action taken.
--------- Ability to Ban the user, Unban the User.
--------- Bottom of this page allows you to permanently delete all removed images at once.
--------- With Pagination.
--------- With confirmation of each action taken.
+++++++++++++++++++++++++++++++++++++++++++
Manage Reports Section
--- Shows all images reported.
--- Change order of users by Ascending/Descending.
------ Shows a thumbanil image of all images in database, 10 per page.( Editable in the admin.tpl.html file. )
------ Clicking and image takes you to the view page.
--------- Shows image name and extension, date image was uploaded, user's IP at the time of upload and the user's email.
--------- Clicking user's email address will take you to user's details.
--------- Ability to mark images for removal to permanently delete them one at a time or as a group of removed images later from the Manage Images section.
--------- Ability to unmark for removal.
--------- Ability to acknowledge the report and leave the image or to delete the image permanently form the Manage Images section.
--------- With confirmation of each action taken.
--------- Ability to Ban the user, Unban the User.
--------- With Pagination.
--------- With confirmation of each action taken.
+++++++++++++++++++++++++++++++++++++++++++
User Info Section
--- Get to this section by clicking user's email address anywhere.
------ This section shows the user's stats.
------ Shows user's email address.
------ Shows user's IP address at the time of registration.
------ Whether the user is banned or not and the ability to ben the user or unban the user.
------ Ability to give or revoke admin from the user.
------ Shows total number of images this user has uploaded.
------ Shows a DELETE link to take you to the MANAGE USERS section to delete the user.
--------- Shows all thumbanil images of that user in database, 10 per page.( Editable in the admin.tpl.html file. )
--------- Clicking and image takes you to the view page.
--------- Shows image name and extension, date image was uploaded, user's IP at the time of upload and the user's email.
--------- Ability to mark images for removal to permanently delete them one at a time or as a group of removed images later from the Manage Images section.
--------- Ability to unmark for removal.
--------- Ability to acknowledge the report and leave the image or to delete the image permanently form the Manage Images section.
--------- With confirmation of each action taken.
--------- With Pagination.
--------- With confirmation of each action taken.
+++++++++++++++++++++++++++++++++++++++++++
TO INSTALL
--- Upload admin-index.php & admin.tpl.html into the root directory of your image host.
TO ADD AN ADMIN LINK (HEADER LINK RECOMMENDED)
--- Open inc/header.php
--- Find:
--><li><a href="account.php">my account</a></li><!--
--><li><a href="logout.php">logout</a></li>
--- Replace with:
This adds a link that can only be viewed by admin.
--><li><?PHP if (isset($_SESSION['admin'])) { ?><a href="admin-index.php">Admin</a><?PHP } ?></li><!--
--><li><a href="account.php">my account</a></li><!--
--><li><a href="logout.php">logout</a></li>
OR ADD A LINK IN THE FOOTER
---Open inc/footer.php
--- Find:
<div id="footer">
<a href="faq.php">FAQ</a>|<a href="tc.php">Terms & Conditions</a>|<a href="contact.php">Contact</a>
<!-- page generated in <?php echo round((microtime(true) - $start), 5); ?> seconds with <?php echo $db_queries; ?> DB quer<?php echo ($db_queries === 1 ? 'y' : 'ies'); ?> -->
</div>
Replace with:
This adds a link that can only be viewed by admin.
<div id="footer">
<a href="faq.php">FAQ</a>|<a href="tc.php">Terms & Conditions</a>|<a href="contact.php">Contact</a><?PHP if (isset($_SESSION['admin'])) { ?>|<a href="admin-index.php">Admin</a><?PHP } ?>
<!-- page generated in <?php echo round((microtime(true) - $start), 5); ?> seconds with <?php echo $db_queries; ?> DB quer<?php echo ($db_queries === 1 ? 'y' : 'ies'); ?> -->
</div>`
Download Here ---> image-host.zip
from upld.
Currently, if you know the offensive image id, you can go to the view page and ban them there (as well as deleting all images uploaded by that user).
from upld.
Better than nothing, but show all images can kill the browser :P
We need a proper admin panel where we can see all reports, users stats or the file uploaded from other user.
Almost done with a new solution. :)
from upld.
The original idea of this script was just a way for users to easily upload any images they have to share with others, so I don't think it's necessary for the admin to be able to easily browse through all uploaded images.
However, I have added another option on the "view image" page to allow the admin to view all images uploaded by that specific user/IP address, just as a way to deal with possible abuse issues.
This also required a fix for Cloudflare users, since the real IP address wasn't being passed to the script.
from upld.
Opened this back up so people could find it. :)
... or to mention it in your README.MD :p
from upld.
Opened this back up so people could find it. :)
from upld.
Opened this back up so people could find it. :)
... or to mention it in your README.MD :p
It's not my readme.md file. I was only contributing.
from upld.
New improved solution for an admin section.
I added two pages, one admin.tpl.html and admin-index.php.
This page can only be viewed by the admin.
(Might not be perfect, but it works great!)
readme.txt `+----------------------------------------------------+ | Admin section for upld, Image Hosting Script | https://github.com/lfiore/upld | Administration Section - v.1.1 | Donations are accepted for Erik on Paypal: http://paypal.me/ErikGroen | Donations are accepted for Iron Tongue on Paypal: http://paypal.me/lomsc | Contents: admin-index.php, admin.tpl.html & this file. +----------------------------------------------------+
Features:
Admin Index Section --- 10 most recently registered users. ------ Showing Email, User IP and date registered. --------- Clicking user's email address will take you to user's details.
--- 10 most recently uploaded images. ------ Showing user's email, user IP, image name and date uploaded. --------- Clicking user's email address will take you to user's details. --------- Ability to mark images for removal to permanently delete them one at a time or as a group of removed images later from the Manage Images section. --------- Ability to unmark for removal. --------- With confirmation of each action taken.
--- 10 most recently unhandled reports ------ Showing Email, image name and extension and date image was uploaded. --------- Clicking user's email address will take you to user's details. --------- Ability to mark images for removal to permanently delete them one at a time or as a group of removed images later from the Manage Images section. --------- Ability to unmark for removal. --------- Ability to acknowledge the report and leave the image or to delete the image permanently from the Manage Images section. --------- With confirmation of each action taken.
+++++++++++++++++++++++++++++++++++++++++++
Manage Users Section --- Shows total users in database. --- Change order of users by Ascending/Descending. ------ Shows all users in the database, 20 per page.( Editable in the admin.tpl.html file. ) ------ Shows User Email, User IP, Number of Images Uploaded, Ban Status, Admin Status and the option to Delete the User. --------- Clicking user's email address will take you to user's details. --------- Ability to Ban the user, Unban the User and Delete User. --------- Ability to Add Admin Status and Remove Admin Status. --------- With Pagination. --------- With confirmation of each action taken.
+++++++++++++++++++++++++++++++++++++++++++
Manage Images Section
--- Shows total images in the database. --- Change order of users by Ascending/Descending. ------ Shows a thumbanil image of all images in database, 10 per page.( Editable in the admin.tpl.html file. ) ------ Clicking and image takes you to the view page. --------- Shows image name and extension, date image was uploaded, user's IP at the time of upload and the user's email. --------- Clicking user's email address will take you to user's details. --------- Ability to mark images for removal to permanently delete them one at a time or as a group of removed images later from the Manage Images section. --------- Ability to unmark for removal. --------- Ability to acknowledge the report and leave the image or to delete the image permanently form the Manage Images section. --------- With confirmation of each action taken. --------- Ability to Ban the user, Unban the User. --------- Bottom of this page allows you to permanently delete all removed images at once. --------- With Pagination. --------- With confirmation of each action taken.
+++++++++++++++++++++++++++++++++++++++++++
Manage Reports Section
--- Shows all images reported. --- Change order of users by Ascending/Descending. ------ Shows a thumbanil image of all images in database, 10 per page.( Editable in the admin.tpl.html file. ) ------ Clicking and image takes you to the view page. --------- Shows image name and extension, date image was uploaded, user's IP at the time of upload and the user's email. --------- Clicking user's email address will take you to user's details. --------- Ability to mark images for removal to permanently delete them one at a time or as a group of removed images later from the Manage Images section. --------- Ability to unmark for removal. --------- Ability to acknowledge the report and leave the image or to delete the image permanently form the Manage Images section. --------- With confirmation of each action taken. --------- Ability to Ban the user, Unban the User. --------- With Pagination. --------- With confirmation of each action taken.
+++++++++++++++++++++++++++++++++++++++++++
User Info Section
--- Get to this section by clicking user's email address anywhere. ------ This section shows the user's stats. ------ Shows user's email address. ------ Shows user's IP address at the time of registration. ------ Whether the user is banned or not and the ability to ben the user or unban the user. ------ Ability to give or revoke admin from the user. ------ Shows total number of images this user has uploaded. ------ Shows a DELETE link to take you to the MANAGE USERS section to delete the user. --------- Shows all thumbanil images of that user in database, 10 per page.( Editable in the admin.tpl.html file. ) --------- Clicking and image takes you to the view page. --------- Shows image name and extension, date image was uploaded, user's IP at the time of upload and the user's email. --------- Ability to mark images for removal to permanently delete them one at a time or as a group of removed images later from the Manage Images section. --------- Ability to unmark for removal. --------- Ability to acknowledge the report and leave the image or to delete the image permanently form the Manage Images section. --------- With confirmation of each action taken. --------- With Pagination. --------- With confirmation of each action taken.
+++++++++++++++++++++++++++++++++++++++++++
TO INSTALL
--- Upload admin-index.php & admin.tpl.html into the root directory of your image host.
TO ADD AN ADMIN LINK (HEADER LINK RECOMMENDED) --- Open inc/header.php
--- Find:
--><li><a href="account.php">my account</a></li><!-- --><li><a href="logout.php">logout</a></li>
--- Replace with:
This adds a link that can only be viewed by admin.
--><li><?PHP if (isset($_SESSION['admin'])) { ?><a href="admin-index.php">Admin</a><?PHP } ?></li><!-- --><li><a href="account.php">my account</a></li><!-- --><li><a href="logout.php">logout</a></li>
OR ADD A LINK IN THE FOOTER
---Open inc/footer.php
--- Find:
<div id="footer"> <a href="faq.php">FAQ</a>|<a href="tc.php">Terms & Conditions</a>|<a href="contact.php">Contact</a> <!-- page generated in <?php echo round((microtime(true) - $start), 5); ?> seconds with <?php echo $db_queries; ?> DB quer<?php echo ($db_queries === 1 ? 'y' : 'ies'); ?> --> </div>
Replace with:
This adds a link that can only be viewed by admin.
<div id="footer"> <a href="faq.php">FAQ</a>|<a href="tc.php">Terms & Conditions</a>|<a href="contact.php">Contact</a><?PHP if (isset($_SESSION['admin'])) { ?>|<a href="admin-index.php">Admin</a><?PHP } ?> <!-- page generated in <?php echo round((microtime(true) - $start), 5); ?> seconds with <?php echo $db_queries; ?> DB quer<?php echo ($db_queries === 1 ? 'y' : 'ies'); ?> --> </div>`
Download Here ---> image-host.zip
i got this error and admin panel not working
Warning: Array to string conversion in admin-index.php on line 55
any help?
from upld.
I found a solution
change line 55:
return str_replace('{{', "{\f{", isset($value[$current_index])?$value[$current_index]:'');
to this:
return is_array($value[$current_index]) ? $value[$current_index] : str_replace('{{', "{\f{", isset($value[$current_index])?$value[$current_index]:'');
You get some new warning, but the admin panel works fine
from upld.
Related Issues (15)
- Feature Request: Drag-and-drop / Paste from Clipboard HOT 3
- Google fonts URL hardcoded insecure HOT 1
- Error on non transparent gif HOT 1
- login issue HOT 5
- Feature request: scan image folder HOT 2
- active mail
- Security contact HOT 1
- possible to add extention HOT 5
- Friendly URLs for nginx? HOT 1
- recaptcha HOT 1
- feature request: allowed websites HOT 1
- feature request: disallow anonymous upload HOT 1
- feature request: View All image & perpage , Sort by upload time HOT 2
- Add CSRF protection for actions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from upld.