PDA

View Full Version : Admin Functions


tubedogg
07-25-2001, 10:00 PM
String -> MD5 Encrypted String function added. To upgrade just reupload convert.php to your admin directory.

----------------------------------------------------------------

2 bugs fixed. To upgrade just reupload the files.

----------------------------------------------------------------

This is a series of four adminstration scripts covering two functions. They are:
Attachment Management
--Find and view attachments with ease, remove with two clicks
--Remove multiple attachments by forum, extension, and other options
Conversion/Encryption Functions
--Converts to and from Unix Timestamp format, which is used by vBulletin in the database
--Encrypt a text string with md5 - useful for comparing a string to an encrypted password in the database

Screenshots (http://www.bigdoggslair.com/vbhacks/admin/index.php)

For version: 2.0.3 and above

Files needed: rematt.php, browseatt.php, convert.php, viewatt.php

Files to edit: admin/index.php

Instructions are in the zip file - look for att.txt

DO NOT PM or email me about this hack - it will be ignored!

I will not support you if you edit these files.

You may not redistribute these scripts, edited or unedited, without my prior permission.

Disclaimer: I disclaim all responsibility for your use of this hack. It has been extensively tested but still may screw something up. It is recommended that if you are going to be deleting a lot of attachments you have a recent database backup on hand.

moonfish
07-26-2001, 02:40 AM
Then find<a href="misc.php?s=<?php echo $session[sessionhash]; ?>"> Update counters... </a>And right below it, add<a href="misc.php?s=<?php echo $session[sessionhash]; ?>"> Update counters... </a><br>


may i ask the point of this is... surely you made a mistake... isn't it just the same thing...??

tubedogg
07-26-2001, 02:43 AM
*Doh* Sorry yeah. I'll update the instructions above.

VirtueTech
07-26-2001, 03:53 AM
Great job Tubedogg!!!

This will be very helpful :)

Martz
07-26-2001, 10:22 AM
Nice work :)

janw
07-26-2001, 11:17 AM
Great Hack, as usual :rolleyes:

floleb7
08-05-2001, 08:28 AM
delete attachement doesn't work

tubedogg
08-05-2001, 08:08 PM
Um...yeah it does...? :confused:

floleb7
08-07-2001, 11:48 AM
not for me everything work but when i click on delete the attachment is still there

Fryzid
08-07-2001, 05:43 PM
In rematt.php$DB_site->query("UPDATE post SET attachment=0 WHERE postid='$postid'");should be$DB_site->query("UPDATE post SET attachmentid=0 WHERE postid='$postid'");Don't know why noone else discovored this.

JJR512
08-07-2001, 10:11 PM
Is this fully compatible with 2.0.3, or does it need new instructions, or what?

dwh
08-08-2001, 03:08 AM
Cool hack, now if you could add an optimizer that optimizes all pics with 100% no lossy compressions that would be the end of the world. Are there any functions for this?

eva2000
08-16-2001, 08:53 AM
can this hack be modified to display a gallery like page (similar to the admin view of smilies/avatars) for attachments specific to a forum?

i.e.

gallery.php?s=&forumid=1

?

Nicholas Brown
08-16-2001, 10:38 PM
Originally posted by Fryzid
In rematt.php
$DB_site->query("UPDATE post SET attachment=0 WHERE postid='$postid'");

should be
$DB_site->query("UPDATE post SET attachmentid=0 WHERE postid='$postid'");

Don't know why noone else discovored this.

Actually, correct me if Im wrong but setting the attachementid=0 wouldnt remove the attached file, it would just set its id to 0.

Fryzid
08-17-2001, 07:04 AM
Originally posted by Nicholas Brown


Actually, correct me if Im wrong but setting the attachementid=0 wouldnt remove the attached file, it would just set its id to 0. Try to find a field called attachment in the post table. It does not exist.
Threads with no attachment have set the attachmentid to 0.
The actual delete is done in the line above$DB_site->query("DELETE FROM attachment WHERE attachmentid='$attachmentid'");Another thing I found is that the attachment count is not reduced when you delete an attachment.

ethank
08-18-2001, 03:06 AM
Tubedog

How difficult would it be to add an option to save attachments to the file system on the server?

Ethan

ethank
08-18-2001, 08:18 PM
To answer my own question:

Not too difficult at all!

I hacked in code that allows me to search for threads with attachments in a certain folder, then save all attachments with extension X to the file system, in a directory like this THREADID_threadttitle

Works like a charm. I extracted 2 gigs of MP3s out of the database. The next step is to redo it so it also creates an index file with the contents of the posts.

EThan

tubedogg
08-18-2001, 09:18 PM
Another thing I found is that the attachment count is not reduced when you delete an attachment.Fixed.

$DB_site->query("UPDATE post SET attachment=0 WHERE postid='$postid'");should be$DB_site->query("UPDATE post SET attachmentid=0 WHERE postid='$postid'");Fixed.

does it need new instructions [for 2.0.3]No.

Sarge
08-23-2001, 01:25 PM
Fatal error: Call to undefined function: getrowbg() in /home/dlrarmy/public_html/forums/admin/browseatt.php on line 25

This script does not work for me

When I search for attachments by user or by forums it just gives me the above error message.

Whats up with that?
I did it exactly like in the instructions!

tubedogg
08-23-2001, 05:42 PM
You'll need to upgrade to 2.0.3 to run it...plus 2.0.3 has an important security fix.

Sarge
08-23-2001, 06:39 PM
I would prefer not to upgrade.
Any chances on this working on 2.0?
Thanks in advance

tubedogg
08-23-2001, 06:52 PM
Chris trust me you want to upgrade. You don't want to be running 2.0 when the details of the security hole are released.

Mike Gaidin
08-23-2001, 11:37 PM
I'm getting the same error as Sarge. I'm not comfortable upgrading though. I don't feel comfortable enough to back up my data and upgrade. I'm afraid something will go wrong and I won't be able to get it working. I know nothing of php or mysql. I tried adding the session.php file and it wouldn't let anyone but me log on. I would really like this admin mod of yours to work though. Can it be modified for 2.0.1?

SirSteve
08-25-2001, 05:59 PM
I am using 2.0.3 and the Delete function is not working. ?? No errors are shown, it just goes to a blank screen. No message at all.

tubedogg
08-25-2001, 07:27 PM
Are you using mass-delete or the "remove" link next to each attachment?

SirSteve
08-25-2001, 07:30 PM
Originally posted by tubedogg
Are you using mass-delete or the "remove" link next to each attachment?

The Remove link next to each attachment.

tubedogg
08-25-2001, 08:24 PM
-- fixed --

SirSteve
08-25-2001, 08:31 PM
Originally posted by tubedogg
SirSteve try download the zip file attached to this message and upload the files to your site and try again. This time (if it's what I think it is) you'll get a message telling you what's wrong.

Ok, done. I got this error message:
Your session hash doesn't match the one in the database. Try logging in again.

I logged out and back in again and it worked! Thanks!
I just hope I don't have to do that often. ;)

tubedogg
08-25-2001, 08:57 PM
I don't know what caused that. It shouldn't have happened...but I've added error-checking to make sure that if it does happen again you won't just get a blank screen.

SirSteve
08-26-2001, 01:30 AM
Great hack!

Mike Gaidin
09-08-2001, 08:48 PM
Finally upgraded to 2.0.3. :D

Great hack tubedogg!!

squawell
09-11-2001, 01:57 PM
what is this hack to do??somebody tell me~~

have any picture??

SirSteve
11-10-2001, 09:11 PM
Can you upgrade this to work on vb 2.2.0 ?

Thanks.

FWC
11-10-2001, 09:39 PM
Originally posted by SirSteve
Can you upgrade this to work on vb 2.2.0 ?

Thanks. It works with 2.2.0. Just add:

makenavoption("Browse","browseatt.php?action=intro","<br>");
makenavoption("Delete","rematt.php?action=intro");
makenavselect("Attachments");

wherever you want it to appear in admin/index.php.

SirSteve
11-10-2001, 10:13 PM
Gracias!

FWC
11-11-2001, 12:21 AM
Originally posted by SirSteve
Gracias! Glad to help. It's a great hack. :)

MApI
11-25-2001, 05:24 PM
:D
Work great with 2.21 too. Thx !!!

cya

|DarkManX|
11-25-2001, 07:24 PM
awesome

here are updated install instructions for 2.2

i'm not taking credit, just putting it all in one place for everyone :)

tubedogg
12-03-2001, 03:09 AM
I've updated the hack with instructions for v2.2 and above and with a new function for encrypting strings with md5.

See the first post for instructions.

eva2000
12-03-2001, 03:11 AM
Originally posted by tubedogg
I've updated the hack with instructions for v2.2 and above and with a new function for encrypting strings with md5.

See the first post for instructions. :cool: x 2 :D

eva2000
12-03-2001, 03:24 AM
Kevin convert.php has a parse error on line 26 ?

FWC
12-03-2001, 03:31 AM
Originally posted by eva2000
Kevin convert.php has a parse error on line 26 ? I think it's missing an { at the end of line 22. I put it in and it works as advertised. :D

Symbian.info
12-09-2001, 08:12 PM
When I use: Convert Date/Time or Encrypt String
I get this: Parse error: parse error in /home/symbian/www/forum/admin/convert.php on line 26

I follow the att.txt witch has a fault:
makenavoption("Update Counters","misc.php?action=chooser");
must be:
makenavoption("Update Counters","misc.php?action=chooser");,"<br>");

Thanks!

eva2000
12-10-2001, 06:27 AM
Originally posted by FWC
I think it's missing an { at the end of line 22. I put it in and it works as advertised. :D thanks that fixed it :)

FWC
12-10-2001, 06:48 AM
Originally posted by eva2000
thanks that fixed it :) Glad it worked for you, too. :)

KuraFire
12-10-2001, 09:15 AM
Are the install instructions in the very first post completely working and functional for version 2.2.1 now, too? I'd very much like this hack, but if there are still issues to be worked out for version 2.2.1 (or lower, but I'm already up-to-date..) I think I'll wait until they're all ironed out :)

Great hack regardless, an attachment viewer and remove function was what I have been missing in that Admin panel all along... :)

Axel Foley
12-10-2001, 01:32 PM
Hi Kevin...

There's a bug in convert.php (at line 22):

if ($action == "md5");
$md5string = md5($string);
echo "<b>$string</b> encrypts as <b>$md5string</b>";
$action = "intro";
}


Should be:

if ($action == "md5") {
$md5string = md5($string);
echo "<b>$string</b> encrypts as <b>$md5string</b>";
$action = "intro";
}



For the rest it works great on vB 2.2.1 Kevin.

I loved the attachments management functions, but I have a request Kevin, isn't it possible to show the attachment size? Can't see it anywhere...it is helpful to see it in order to decide if it should be removed or not.

Anyway: GREAT JOB! (as usual) ;)

KuraFire
12-10-2001, 01:46 PM
Ooh, yeah that'd be very useful, being able to see the size of all attachments. :up:

Thx Axel, I now know that this works for 221 as well and everything. And thanks to you I can also fix that bug. :)

LuBi
12-12-2001, 03:54 AM
So is this now working on 2.2.1? And the first post by tubedog is updated with all the fixes, or will I have to go through the whole thread looking for updates? Thanks!

FWC
12-12-2001, 04:14 AM
Originally posted by LuBi
So is this now working on 2.2.1? And the first post by tubedog is updated with all the fixes, or will I have to go through the whole thread looking for updates? Thanks! Lubi, Kevin updated the first post. If you get a parse error on convert.php just add a { at the end of line 22.

LuBi
12-12-2001, 04:59 AM
Thanks, worked great and got the error fixed in a jiffy. Thanks for the great hack and thanks FWC as usual, your great.

FWC
12-12-2001, 05:10 AM
Originally posted by LuBi
Thanks, worked great and got the error fixed in a jiffy. Thanks for the great hack and thanks FWC as usual, your great. Glad it's working. It's a great hack. :)

The Realist
12-12-2001, 07:40 AM
Thanks for the Info below, worked like a charm.

Nice one M8.
:)


Originally posted by Axel Foley
Hi Kevin...

There's a bug in convert.php (at line 22):

if ($action == "md5");
$md5string = md5($string);
echo "<b>$string</b> encrypts as <b>$md5string</b>";
$action = "intro";
}


Should be:

if ($action == "md5") {
$md5string = md5($string);
echo "<b>$string</b> encrypts as <b>$md5string</b>";
$action = "intro";
}



For the rest it works great on vB 2.2.1 Kevin.

I loved the attachments management functions, but I have a request Kevin, isn't it possible to show the attachment size? Can't see it anywhere...it is helpful to see it in order to decide if it should be removed or not.

Anyway: GREAT JOB! (as usual) ;)

Crinos
12-12-2001, 08:56 AM
Originally posted by Axel Foley
I have a request Kevin, isn't it possible to show the attachment size? Can't see it anywhere...it is helpful to see it in order to decide if it should be removed or not.I agree, this would make the hack truly perfect :D

The Realist
12-15-2001, 11:07 AM
Can anyone tell me how to get the convert date/time line in Import & maintenance to drop down a line.

See pic attached for a better idea.

Lesane
12-15-2001, 11:26 AM
Just edit admin/index.php and search for Update Counters and add after that but before convert date/time a "brb"

RS25com
01-04-2002, 02:53 AM
GREAT HACK!

I've never messed with my board and this thing worked flawlessly the first time! I installed it and it worked like a breeze.

Only one thing (which has probably already been posted, I didn't look) which is a minor cosmetic item:

In the index page mod for 2.20 the existing line above it does not have a <br>, so using similar code as the new lines added, add a <br> in the existing last line like this:

makenavoption("Update Counters","misc.php?action=chooser","<br>");

The Realist
01-04-2002, 10:41 AM
Found the problem:
makenavoption("Update Counters","misc.php?action=chooser","<br>");

"<br>") << This was missing!

Thanks,

Brian


Originally posted by The Realist
Can anyone tell me how to get the convert date/time line in Import & maintenance to drop down a line.

See pic attached for a better idea.

NitroSimSev
02-18-2002, 02:57 PM
Works like a champ......took my attachment DB from 28.5 megs to 19.2 megs still need to come down a lot more. I tried the convert to file but its got a parse error in it.

FWC
02-18-2002, 04:11 PM
Originally posted by NitroSimSev
I tried the convert to file but its got a parse error in it. Look a post #50. You should always read the thread when installing hacks. :)

Silver_2000_)!
09-07-2002, 06:43 AM
The hack works great trimmed about 1/3 of the attachments BUT the Attachement Table in mysql hasnt shrunk..

I have updated the counters and have tried the repair.php script just for good measure... What am I missing ???

Is there a query required to compact the table or database ?

Thanks in advance...

Doug

johnr
09-07-2002, 11:41 AM
Err...Because this hack is like 8 months old and since then 5+ new Vbulletin versions have been released?

Go figure :)

Silver_2000_)!
09-07-2002, 03:45 PM
[QUOTE]Originally posted by johnr
Err...Because this hack is like 8 months old and since then 5+ new Vbulletin versions have been released?

Go figure :)

Symbian.info
03-28-2003, 07:05 PM
Grreat tool !!

Silver_2000_)!
03-29-2003, 10:42 PM
The table shrunk ... Great Mod

Doug

Bison
03-30-2003, 03:36 AM
Anyone with a ton of attachments really need this gem ofva hack!

(Ten Stars!) :speechless:

iggy123
05-17-2003, 02:49 PM
when i try this on 2.3.0 I get the following error


Database error in vBulletin Control Panel 2.3.0:

Invalid SQL: SELECT postid,post.attachmentid AS aid,FROM_UNIXTIME(attachment.dateline)
AS date,filename,attachment.userid AS id,attachment.counter AS countera FROM post,attachment
WHERE post.attachmentid=attachment.attachmentid AND
attachment.userid='1' LIMIT 0,20 mysql error: Column: 'postid' in field list is ambiguous

mysql error number: 1052

Date: Saturday 17th of May 2003 10:44:56 AM

Milez
05-24-2003, 08:08 AM
Anyone know a better way to remove all attachments from specified forums, as this hack seems to no longer function on 2.3.0.

camikazi2k
06-02-2003, 10:22 PM
everytime i hit remove
i get
Your session hash doesn't match the one in the database. Try logging in again.