View Full Version : [RELEASE v2] Run a SQL query directly from your admin contorl panel
Admin
08-23-2001, 10:00 PM
Description:
I see a lot of people here who are trying to fix a problem or install a hack, sometimes requires them to run a SQL query on their database, and just don't know quite how.
I know you can use Telnet, but not everyone has access, and I know there's phpMyAdmin, but who needs all that when you just need to update a table or add a field.
Of course running select queries with this is not very useful, but I'm working on changing that.
Main Features:
- Run a single query
- Run multiple queries
- Option to show / not show query after execution
- Confirmation page
Demo:
1.
http://forum.t-cove.com/query1.gif
2.
http://forum.t-cove.com/query2.gif
3.
http://forum.t-cove.com/query3.gif
4.
http://forum.t-cove.com/query4.gif
Installation:
1. Unzip query.php from the attached zip file and upload to your admin folder.
2. In index.php (under your admin folder), replace
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="2" id="navtable">
<?php maketableheader("Options"); ?>
</table>
<a href="options.php?s=<?php echo $session[sessionhash]; ?>&action=options"> Change options </a>
</td></tr>
with
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="2" id="navtable">
<?php maketableheader("Options"); ?>
</table>
<a href="options.php?s=<?php echo $session[sessionhash]; ?>&action=options"> Change options </a>
</td></tr>
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="2" id="navtable">
<?php maketableheader("SQL Queries"); ?>
</table>
<a href="query.php?s=<?php echo $session[sessionhash]; ?>"> Run a SQL query </a>
</td></tr>
That's it - can it get any more simple? :)
Feedback, requests, future ideas and anything else is more than welcome. :D
joecrow
08-24-2001, 08:08 AM
kool thanks for the hack m8 keep up the good work.
Great Idea FireFly! Off to install this one :) Great thinking.
Agree with Bane
/me is off installing...
Worked like a charm. But I have a suggestion:
If I want to run a query which gives a result, e.g. the example query from mySQL
select BENCHMARK(1000000,encode("hello","goodbye"));
it should display the result. Now it only repeats the query again since I set this option to yes.
Admin
08-24-2001, 10:34 AM
Thanks all for the comments.
[QUOTE]Originally posted by FireFly
Of course running select queries with this is not very useful, but I'm working on changing that.
Thomas P
08-24-2001, 02:15 PM
As far as I know he's male (right?)
Great hack btw :D
-Tom
eva2000
08-24-2001, 02:15 PM
interesting hack.. :)
butty
08-24-2001, 02:51 PM
great hack, so easy 2 install even me gran could have installed it!! :)
Admin
08-24-2001, 08:16 PM
I've been working on this alot today.
I wanna go to sleep, and I don't have time to create new screen shots, edit posts and such, so I'm just going to post this new file here and when I wake up I'll sort everything.
This has support for basic queries, such as
SELECT ... FROM ... WHERE
Basically almost everything, except for AS. Don't try using AS, it will not work.
To install this simply upload the new file and overwrite the old one.
A basic screen shot is available in the zip file. *yawn*
Please post any feedback and suggestions about this, so I could fix / add anything to the new re-release! Thanks! :)
Wayne Luke
08-24-2001, 09:19 PM
This isn't as fancy but it can run every query MySQL can process. It gives columnized results and it works on all versions of vBulletin. This is probably my first hack ever for vBulletin and I have been using it successfully for the last year.
Just rename it query.php and put a link for it in index.php.
Admin
08-25-2001, 06:26 AM
So you're saying I wasted a day of my life? :p
Thanks Wayne. :)
Originally posted by FireFly
Orca, I'll see what I can do. :)
(btw, are you a female or a male? I've been wondering for days now :p)
Just checked: Still all male. ;)
Pie'oh'pah
08-25-2001, 10:50 AM
Thumbs up dude
This is some serious hack! Small, easy to do and running fine! :D
Thnx
-Alex
webhost
08-25-2001, 03:51 PM
Thanks For the hack Firefly, This will make things alot easier.
Got a weird error. I did what you said, then when I clicked on the link on the side to add a query. It went to the page, and above it all had this:
Fatal error: Call to undefined function: getrowbg() in /usr/accountname/forum/admin/query.php on line 66
[VbbFr]Elie
09-24-2001, 04:58 AM
It's looking to work but what horible look (wluke file)
One small problem ... If there is HTML in table, there is not keep caracter and translate in HTML in the page ...
Sorry about my bad english :)
GetMeHosted.com
09-24-2001, 05:34 PM
Simple, and a all around Great Feature!
Thanks...
God Bless,
Mike Gaidin
09-24-2001, 10:03 PM
Great hack FireFly!!!! :D
I love this one. Good job!
JJR512
09-24-2001, 10:20 PM
This is a good idea, but it definitely needs some way to view the output. For example, I'd like to be able to run this query and see the list it gives me:
SELECT username FROM user WHERE dct='X' ORDER BY username ASC
(Which involves a custom field in my user table.)
cyrus
09-25-2001, 09:28 AM
Is this similar to TELNET ?? ( which I have but it would be easier to do it through here ! )
Also, how acn I make a DB BACKUP through this ??
thanks
Admin
09-25-2001, 12:19 PM
JJR512, I understand that the code wluke posted does that.
Like he said, it's not fancy or anythin, but works.
Cyrus, no, not really.
This is more like (a very very lite version of) phpMyAdmin, not Telnet.
Although most of the commands you can use in Telnet you can use here (SELECT, UPDATE, INSERT, DELETE, ALTER queries, stuff like that), I'm not sure how you can do a backup from here.
And don't forget there is a backup utility in vBulletin. :)
JJR512
09-26-2001, 04:20 AM
I have had an error with wluke's version. I don't know if there was a thread for that or not, so I don't know where else to put this but here, sorry.
This is the query I attempted to run:
SELECT username FROM user WHERE dct='2' ORDER BY username ASC
This is the error message I received:
Database error in vBulletin Control Panel: Invalid SQL: E
mysql error: You have an error in your SQL syntax near 'E' at line 1
mysql error number: 1064
Date: Wednesday 26th of September 2001 01:16:53 AM
Script: /forums/admin/query.php?action=run
Referer: http://216.118.105.52/forums/admin/w-query.php
JohnBradshaw
09-26-2001, 08:15 AM
This has got to be one of the best hacks I have ever seen! Much better then having sort out MyAdmin!
YourHostSucks
09-27-2001, 07:04 PM
This is very handy and works like a charm (most of the time) :)
Thanks!
TheComputerGuy
11-04-2001, 11:29 AM
This is just the update for 2.20 Enjoy...Follow all other instructions
In the admin/index.php
Find:
// ***
makenavoption("Add","announcement.php?action=add","|");
makenavoption("Modify","announcement.php?action=modify");
makenavselect("Announcements");
// ***
Above that place this:
makenavoption("Run MySQL","query.php?s=<?php echo $session[sessionhash]; ?>");
makenavselect("MySQL Query");
And save and upload
And upload the Query.php to your admin folder....
Enjoy...
Chris
Very Cool Hack
Thank you FireFly.
|DarkManX|
11-04-2001, 06:05 PM
thanks GREAT HACK!!
SirSteve
11-08-2001, 01:46 AM
Works great!
Harvey
03-20-2002, 11:28 AM
just another query.php, if I may post it.
features:
- run nearly every command MySQL understands
- select the database
- HTML-Tags are shown as HTML-Tags
missing features:
- multiple queries
- no confirmation
known bugs:
- select of DB only works if host/user/pass are the same as for VBB
- warning on statements wich return no result (it still works, but I don't know how to fix)
Mathiau
03-27-2002, 06:34 AM
and i am one of those people who has no idea, appreciated m8!
UltimaKing
03-27-2002, 03:24 PM
great hack firefly *installed*
FANTASTIC hack! Just what I need. Thanks :D
Mathiau
04-17-2002, 02:37 AM
Hello m8
Does this work in version 2.2.5
When i did a search for
PHP:
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="2" id="navtable">
<?php maketableheader("Options"); ?>
</table>
<a href="options.php?s=<?php echo $session[sessionhash]; ?>&action=options"> Change options </a>
</td></tr>
i could not locat e it at all in admin/ index.php
i tried various pieces from it , but could not locate any of it...?
Frankly cause i used vbhacker, and got a error that told me to run a qeury, but i can not locate phpMyAdmin or whatever u need to run a mysql query :( (amm reading up now to find the answer)
WHAT AM I MISSING!! :(
VB225 Update
In admin/index.php find:makenavoption("vBulletin Options","options.php?t=0","<br>");BELOW this, add:makenavoption("MySQL Query","query.php?action=enter","<br>");Make sure you download the latest hack, located here (https://vborg.vbsupport.ru/attachment.php?s=&postid=160235).
Mathiau
04-17-2002, 07:44 AM
wicked, thnx m8!!!!!!!!
you are more then welcome. ;)
bandersen
04-21-2002, 02:26 PM
Thank you for this hack!
Installed it with no problem... on 2.2.5
pHAZE_1
04-21-2002, 10:47 PM
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="2" id="navtable">
<?php maketableheader("Options"); ?>
</table>
<a href="options.php?s=<?php echo $session[sessionhash]; ?>&action=options"> Change options </a>
</td></tr>
i dont have anything like that in my index.php in my admin folder.
did you read the update i published 5 posts above? is alot easier to read first the thread to make sure there are no updates published.
https://vborg.vbsupport.ru/showthread.php?postid=241576#post241576
pHAZE_1
04-21-2002, 11:02 PM
sorry i am pretty damn tired. i read the thread but must have missed that one
erdem
04-29-2002, 04:21 AM
tnx for this great hack...
but i cant run this query :
INSERT INTO template (templateid,templatesetid,title,template) VALUES (NULL,-2,'memberoftheday','0||vb||0||vb||0');
is this too complex? this is for stats panel hack..
:classic:
try this:
https://vborg.vbsupport.ru/showthread.php?s=&threadid=37726
let us know if it helped... also try running the query without the ";" at the end, it should work on firefly's hack.
Dean C
05-08-2002, 06:13 PM
Tried running the fifth query in the store hack which is this:
INSERT INTO store VALUES (1, 'username', 'Change Username', '500', '0', 'username.gif', 'With this action you can change your username', 'Y');
INSERT INTO store VALUES (2, 'customtitle', 'Change Custom Title', '300', '0', 'title.gif', 'With this action you can get a custom title and if you dont have one already then get one', 'Y');
INSERT INTO store VALUES (3, 'customavatar', 'Change Custom Avatar', '700', '0', 'avatar.gif', 'With this action you can get a custom avatar or if you already one you can change it...', 'Y');
INSERT INTO store VALUES (4, 'givetitle', 'Give an other user a custom title', '700', '0', 'givetitle.gif', 'With this action you can give an other user a custom title. The title that you give will be showed on every post of that user. <br><b>Tip:</b> Do it when that user dont have enough money to restore his custom title ;)', 'Y');
INSERT INTO store VALUES (5, 'donate', 'Donate money to an other user', '0', '0', 'donate.gif', 'With this "free" action you can donate money to other members.', 'Y');
INSERT INTO store VALUES (6, 'scrap', 'Scrap your yellow/red card', '700', '0', 'card.gif', 'With this action you can scrap your yellow/red card. Want to become a mod but have a yellow/red card? Do this action to begin with a new veb life ;)', 'Y');
INSERT INTO store VALUES (7, 'calendar', 'Add Calendar Event', '500', '0', 'calendar.gif', 'With this action you can add a public calendar event on the calendar', 'Y');
INSERT INTO store VALUES (8, 'glowusername', 'Add Glow To Username', '2000', '0', 'glow.gif', 'With this action you can add an attractive glowing color to your username wich you can define yourself. If you have already a glow then you can change it here aswell.', 'Y');
and now every time i try to run a query i get a database error...
i don't kno what to do ...
pHAZE_1
05-10-2002, 04:55 PM
i have the same problem as Mist, it worked fine until the same point, now no queries work at all.. im stumped
pHAZE_1
05-10-2002, 04:56 PM
i have the same problem as Mist, it worked fine until the same point, now no queries work at all.. i installed the updated version [post # 36] and i use 2.2.5.. *stumped..
springbok
05-11-2002, 10:23 AM
The problem is in the line:
INSERT INTO store VALUES (5, 'donate', 'Donate money to an other user', '0', '0', 'donate.gif', 'With this "free" action you can donate money to other members.', 'Y');
Replace it with:
INSERT INTO store VALUES (5, 'donate', 'Donate money to an other user', '0', '0', 'donate.gif', 'With this free action you can donate money to other members.', 'Y');
I don't know SQL that well, but the excl. marks around "free" are causing it to fail.
Dean C
05-12-2002, 07:34 PM
yes but both myself and phaze1 have done this on our forums and now query.php won't run queries for us...
the whole things is mucked up...
springbok
05-12-2002, 08:12 PM
I'm not sure then. I am also running 2.2.5 and with change was able to install the store without any problems. Wish I could help more.
:disappointed:
Dean C
05-13-2002, 06:17 PM
i ran the 5th query (the long one) as one whole wheras it sed u can run it as seperate ones...
firefly i really need ure help with this...
Dean C
05-21-2002, 06:10 PM
i hate bumping but i really wud like to fix this guyz...
Thanks in Advance
Dean C
05-21-2002, 06:21 PM
i hate bumping but i really wud like to fix this guyz...
Thanks in Advance
Dean C
05-21-2002, 06:23 PM
sorry for postin twice lol... it was goin slow so i did it again...
XFLBret
06-04-2002, 07:31 AM
this doesn't work with 2.2.6???
bandersen
06-22-2002, 10:06 PM
I have upgraded from 2.2.5 to 2.2.6 and lost my navbar in control panel, and have problem adding it again for this hack.
Any fix or update?
<a href="https://vborg.vbsupport.ru/showthread.php?postid=241576#post241576" target="_blank">https://vborg.vbsupport.ru/showt...576#post241576</a>
bandersen
06-23-2002, 01:25 AM
Thanks.... I must be getting old... :)
EchoHype.com
07-25-2002, 02:12 AM
Hmm, i followed your link nakkid...but instructions for 2.2.6?
the instructions are the same.
EchoHype.com
07-25-2002, 02:22 AM
So you're saying that I upload that query.php file you linked me to, the text I need will be found in the index.php file?
Admin
08-01-2002, 06:12 PM
Being a disgrace to coding and human race in general, I am closing this one. Use JamesUS's version of the idea, it's [insert large number here] times better.
shovel
08-01-2002, 06:33 PM
Would you mind if I revamped the coding and released my own version?
Admin
08-01-2002, 07:03 PM
Yes feel free.
shovel
08-01-2002, 07:19 PM
Awesome. Thanks Chen.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.