Page 1 of 1

[MOD] Admin Uploads Only

PostPosted: Sun Mar 13, 2011 6:30 pm
by PeterS
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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
}
?>

Re: [MOD] Admin Uploads Only

PostPosted: Sun Jan 29, 2012 8:19 am
by Noname
is this mod for v.1.2.3 ok?

Re: [MOD] Admin Uploads Only

PostPosted: Tue May 29, 2012 6:12 am
by Noname123
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

Re: [MOD] Admin Uploads Only

PostPosted: Tue May 29, 2012 6:25 am
by SamEA
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>).

Re: [MOD] Admin Uploads Only

PostPosted: Mon Jun 04, 2012 2:33 pm
by Noname123
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>

Re: [MOD] Admin Uploads Only

PostPosted: Wed Jun 06, 2012 7:39 pm
by SamEA
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.