[MOD] Admin Uploads Only

Any hacks and modifications will be in here...

[MOD] Admin Uploads Only

Postby PeterS » Sun Mar 13, 2011 6:30 pm

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Mod Title: Admin Uploads Only
Date released: 13.03.11
Description: Users cannot upload any files to the file hoster and only the admin is allowed to. This mod is very handy for people who want to use DFH as a download manager for their users.
Versions Supported: v1.0, v1.1
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Follow these steps:

1) Open upload.php
2) Find
Code: Select all
require_once("./config.php");

3) Add after it
Code: Select all
session_start();
if(isset($_SESSION['logged_in']) && $_SESSION['logged_in']==md5(md5($adminpass))) {

4) Go to the end of ./upload.php and add after the line
Code: Select all
</td></tr></table></center>
this
Code: Select all
<?php
} else {
echo "Sorry, but you need to be an admin to upload files on our website.";
}
?>

5) Go into upload.php and find
Code: Select all
if(isset($_SESSION['logged_in']) && $_SESSION['logged_in']==md5(md5($adminpass))) {

6) Add above that piece of code
Code: Select all
$_SESSION['logged_in'] = $_POST['check'];

7) Go into ./styles/Indigo/file_upload_form.php and add this code on the very first line.
Code: Select all
<?php
session_start();
?>

8) After that, find
Code: Select all
swfu.addPostParam("pprotect", $("input#pprotect").val());
and add below that
Code: Select all
swfu.addPostParam("check", $("input#check").val());

9) Now find
Code: Select all
<tr><td align=center colspan=2><?php if(isset($categorylist)) { echo $categorylist; } ?></td></tr></table>
and add below that code
Code: Select all
<input type="hidden" name="check" value = "<?php echo $_SESSION['logged_in'];?>" id ="check" size="40" />


P.S.: I advise you to add the below code in file_upload_form.php to inform you whether you are logged in as Admin or not to avoid uploading a large file just to get an error back saying you must be an admin to upload files. If you are already logged in as Admin and a message was not displayed, refresh the page to update the session ID on the javascript flash progress bar. In other words, do not upload any files unless you see the message "You are logged in as Admin".

1) Find
Code: Select all
<h1><center><? echo $lang[upload];?></center></h1>
and after that line
Code: Select all
<?php
if(isset($_SESSION['logged_in'])) {
?>
<h1><center><font color="#FF0000">You are logged in as Admin</font></center></h1>
<?php
}
?>
PeterS
Global Moderator
 
Posts: 159
Joined: Mon Feb 21, 2011 4:58 am

Re: [MOD] Admin Uploads Only

Postby Noname » Sun Jan 29, 2012 8:19 am

is this mod for v.1.2.3 ok?
Noname
Newbie Member
 
Posts: 3
Joined: Sat Nov 26, 2011 11:34 am

Re: [MOD] Admin Uploads Only

Postby Noname123 » Tue May 29, 2012 6:12 am

its ok for v1.2.3 but i want to put a message before anyone upload file except admin to write....You are not upload any file...or something that. And where i put the message?
i hope you understand me
Noname123
Standard Member
 
Posts: 10
Joined: Fri Dec 30, 2011 9:33 am

Re: [MOD] Admin Uploads Only

Postby SamEA » Tue May 29, 2012 6:25 am

Just place the following code where you want to hide content from users in ./styles/[STYLE_NAME]/file_upload_form.php:
Code: Select all
if(isset($_SESSION['logged_in']) && $_SESSION['logged_in']==md5(md5($adminpass))) {
// CONTENT TO HIDE
}


For example, you can place the above code before the first form (<form>) tag and place the } symbol after the ending form tag (</form>).
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Re: [MOD] Admin Uploads Only

Postby Noname123 » Mon Jun 04, 2012 2:33 pm

i put the code as you said...i think... but nothing...you see my code here
i dont know if the code in first post must to delete???
Code: Select all
<script type="text/javascript">
var bar1= createBar(300,15,'white',1,'black','blue',85,7,3,"");
</script>
<br>
<div align="center">
 if(isset($_SESSION['logged_in']) && $_SESSION['logged_in']==md5(md5($adminpass))) {
Sorry, but you need to be an admin to upload files on our website.
}
<form>
<input type="button" value="Cancel Upload" onclick="CancelUpload()">
</form>
}
</div>
Noname123
Standard Member
 
Posts: 10
Joined: Fri Dec 30, 2011 9:33 am

Re: [MOD] Admin Uploads Only

Postby SamEA » Wed Jun 06, 2012 7:39 pm

Code: Select all
if(isset($_SESSION['logged_in']) && $_SESSION['logged_in']==md5(md5($adminpass))) {

// CONTENT SHOWN ONLY TO ADMIN

}else{ // if user not logged on

// CONTENT FOR USERS AND GUESTS

}


I hope the above code has now made it clearer for you. Let me know if you have any issues implementing the above code.
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm


Return to Hacks and Modifications

Who is online

Users browsing this forum: No registered users and 7 guests

cron