Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
vB Hacking Article v1.5
Oblivion Knight
Join Date: May 2002
Posts: 1,757

Sheffield, UK
by Oblivion Knight Oblivion Knight is offline 08 Sep 2004

Here's something that I wrote when EvB was around, but Kura has since closed it so I thought I'd post it here.. Feel free to leave any suggestions or feedback.

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

vB Hacking Article v1.5
By: Oblivion Knight


Article History
v1.5 - FTP AUTO mode hint added, program suggestions for Mac users added (thanks to Jolten), query suggestions updated (thanks to Revan), Notepad "goto line" hint added (thanks to rake).
v1.4 - Contributed to vB.org, vB.nl and Synergy, general updates.
v1.3 - Full Path section added.
v1.2 - FTP section added.
v1.1 - Changes made to recommended programs, and removed Wordpad font hint.
v1.0 - Initial document contributed to EvB.



BEFORE HACKING ANY FILES OR RUNNING ANY DATABASE QUERIES, YOU ARE ADVISED TO MAKE BACKUPS OF BOTH THE FILES YOU ARE EDITING AND THE DATABASE YOU ARE RUNNING QUERIES ON. THIS GIVES YOU SOMETHING TO FALL BACK ON IF THINGS GO WRONG AND THE PROBLEM CAN'T BE FIXED!


What program should I use to download/upload my files?

Well since you've already uploaded vBulletin, you should already have a fairly good idea of what to use. However, if someone uploaded them for you and you're wanting to learn then here we are, a section just for you.!

You'll need an FTP Browser. Many internet browsers can browse FTP sites fine, but lack features such as ASCII mode and CHmod. There are many FTP Browsers out there, and which you use depends on which you feel the most comfortable with. Everyone has their own preferences..

Here's a list of FTP Browsers you may want to try..
WS_FTP, LeechFTP, SmartFTP, CuteFTP, FTP Voyager, FlashFXP

Where can I download these FTP Browsers from?
WS_FTP: http://www.ipswitch.com/Products/WS_FTP/
LeechFTP: http://stud.fh-heilbronn.de/~jdebis/leechftp/
SmartFTP: http://www.smartftp.com/
CuteFTP: http://www.cuteftp.com/cuteftp/
FTP Voyager: http://www.ftpvoyager.com/
FlashFXP: http://www.flashfxp.com/

But... I'm a Mac user!
If you're a Mac user, MacOS 10 can directly connect to a server via FTP. However if you want to use an application, try Transmit from Panic or Fetch from Fetch Softworks.

How do I CHmod a file?
This depends on which FTP Browser you use. For the majority, all you need to do is right click a file on your host and click Properties or Change File Attributes. Usually there are either 3 numbers there which you can edit, or there are several checkboxes (User, Group and World), or both. This is what we call CHmod or the file's permissions.

With vBulletin, rarely are you asked to change the file's permissions, but sometimes you are required to change the permissions of a directory you have just created. For example with the Arcade hack, you are asked to create a directory called 'games' which must be CHmodded to 755.

How do I switch between ASCII and Binary mode?
Again, this depends on which FTP Browser you use. Key words to look out for on the toolbars for this would be 'A-1 Mode' and 'Transfer Mode'. If you have problems finding this, ask at the support forums of your chosen FTP Browser, or asking at a vBulletin community might be helpful (as long as you're polite!). It is worth noting that the vast majority of FTP Browsers also come with an 'AUTO mode', which saves a lot of time.

AUTO mode?
AUTO mode automatically checks whether or not to upload files in ASCII or Binary mode by checking an internal list. If you use AUTO mode, please make sure to check the list of extensions that will be uploaded in ASCII mode, and make sure that the .php and .php3 extensions are listed.


What program should I use to edit my files?

The most common question asked where vB hacking is concerned is; "What program should I use to edit my files?" The answer is, there is no definitive program to use.. Some work better much better than others however.

Recommended:
Notepad, Developers Pad, EditPlus, UltraEdit

Not Recommended:
Microsoft Word, Wordpad, Macromedia Dreamweaver

Notepad will get you by just fine, but the major features it lacks (syntax highlighting, line numbers and customizable keyboard shortcuts) can be found in the other recommended programs; Developers Pad, EditPlus and UltraEdit. However, not many people know that with Notepad you CAN go straight to a line number of your file by pressing 'Ctrl+G', and entering the line number that you want to go to.

Where can I get these recommended programs from?
Developers Pad: http://www.developerspad.com/devpad/
EditPlus: http://www.editplus.com/
UltraEdit: http://www.ultraedit.com/

But... I'm a Mac user!
If you're a Mac user, it is advised that you DON'T use the Macintosh TextEdit application. Instead, try BBEdit from Bare Bones.


When I'm asked to enter the "Full Path" to my forums, how do I find this?

Occasionally, you'll come accross a hack that requires you to enter the full path to your forums directory. As it should clearly state, you do NOT enter the URL. The full path can be found by accessing your PHP info, and is listed under 'DOCUMENT_ROOT' of your Environment.

How do I access my PHP Info?
Accessing your PHP Info is easy. In vB2, you are provided with the file phpinfo.php in the extras folder. Upload this to anywhere on your host, and access it with your internet browser. This feature is built in to vB3's Admin Panel, and can be accessed by going to 'Import & Maintenance', and then clicking 'View PHP info'.


I get an Internal Server Error.. Help!

While this rarely occurs when hacking vBulletin, I see it being asked.. The only explanation I have for this is to make sure your includes/config.php file is set up correctly. If you are unsure of this, ask your host. You should also make sure that you have typed the URL correctly to the file that you are trying to launch.


I get this error when uploading my hacked files.. Help!

Any error that you receive is likely to be an error on your side rather than the hack's. The problem can be anything from a range of things, but these are the most common ones..

What program did you use to edit the files?
If you used Macromedia Dreamweaver, it's likely that something else was changed on top of what you asked it to change. The program is funny like that..

Did you follow the instructions correctly?
You'd be amazed how many times people paste code AFTER instead of BEFORE, BEFORE instead of AFTER and REPLACE when they're not even asked to. Other times, the line provided can appear in the file more than once, so make sure you're editing around the correct instance. Ask the hack author if you are unsure of this, and quote the file name or template you are editing.

Did you download/upload the file in ASCII mode?
If you downloaded/uploaded the file in Binary mode, sometimes the file will corrupt itself and give you some kind of error. While this isn't always the case, it's a good habit to get yourself into downloading/uploading PHP files in ASCII mode.

Did you upload the additional files and create the additional templates that came with the hack you're installing?
Often, people make the required changes to the original vBulletin files and templates and forget to upload the additional files and create the additional templates that are required for the hack to work. It's a common mistake to make - even the professionals do it from time to time.!

Are you running a firewall while uploading to your FTP?
Sometimes, firewalls such as ZoneAlarm get in the way of you uploading files to the FTP and these files get "cut". What I mean by this is instead of the whole file being uploaded, some of the file is missing.

Did you run the queries required?
Occasionally, you are asked to run queries on your MySQL database for the hack to work correctly. Not running these can cause errors, and sometimes have very strange effects on your forums.


How do I run queries?

Another question commonly asked; "How do I run queries?" First, access to phpMyAdmin on your host would make your life easier.. To access this, you will need to go into your site's admin panel (NOT your vBulletin admin panel). Find your MySQL management and a link to phpMyAdmin should be found around there.

Not everyone has admin access to their site however, unfortunately for those running vB2, you will have to ask your host to run the database queries for you or alternatively install one of many hacks available that allows you to run database queries through your vB Admin Panel. vB3 however, comes standard with this feature if you list your userid to be able to run database queries in the file includes/config.php .

I get a syntax error when running this query.. Help!
Syntax errors are often enough the result of bad copying and pasting, or depending on what you're using to run database queries the query string may differ.

If you get a syntax error when running code with a ';' at the end of it, remove the ';' and try running it again. This SHOULD solve your problem.

Other things to look out for is poor query structuring by the hack's author. The following is a good example of this:

Correct :laugh:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Incorrect :dead:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Can you see the difference? The correct query uses ` marks around the name area, and the incorrect query uses ' marks around the name area. Sometimes, there will be no marks around the name area at all, but this should also work just fine. It's a subtle difference, but it's one that will make the difference between the query running or not.

Make absolutely sure that you have copied ALL of the query string before running it.. One mistake could mess up your database, and reversing this effect may not be an easy task.!


How do I make a backup of my database?

There are several ways of doing this.. The most effective and quickest way I have found is using Telnet/SSH. However, not everyone has access to this due to security reasons.. Other ways of backing up your database are through phpMyAdmin (this is NOT recommended - many problems have been reported of it timing out on large databases), or making a backup through your vB Admin Panel.

What command do I need to run in Telnet/SSH?
This is the command I run, there are other ways but this seems to be the best for me;
mysqldump -uUSERNAME -pPASSWORD DATABASE_NAME > FILENAME.sql

How do I revert my database to the backup I made?
Again, there are other ways but this is the command I run in Telnet/SSH;
mysql -uUSERNAME -pPASSWORD DATABASE_NAME < FILENAME.sql

Last edited by Oblivion Knight; 09 Sep 2004 at 10:53..
Views: 3305
Reply With Quote
Comments
  #2  
Old 08 Sep 2004, 10:24
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Real name: Dean Clatworthy
Nicely layed out and informative. Hopefully it'll help some of our users Thanks for posting!
__________________
Dean Clatworthy - Web Developer/Designer
Reply With Quote
  #3  
Old 08 Sep 2004, 14:26
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Real name: Stefan Kaeser
definitelly good and usefull text
Reply With Quote
  #4  
Old 08 Sep 2004, 20:04
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Real name: Fillip
I would like to submit the following comments to this guide.

Originally Posted by Oblivion Knight
How do I switch between ASCII and Binary mode?
Again, this depends on which FTP Browser you use. Key words to look out for on the toolbars for this would be 'A-1 Mode' and 'Transfer Mode'. If you have problems finding this, ask at the support forums of your chosen FTP Browser, or asking at a vBulletin community might be helpful (as long as you're polite!).
You should also add that ALL the FTP clients you suggested supports the AUTO transfer mode, which (amongst others) automatically transfers PHP files in ASCII mode (which is the relevant file type and transfer mode for 99 % of all vB related transfer).


Originally Posted by Oblivion Knight
What program should I use to edit my files?

The most common question asked where vB hacking is concerned is; "What program should I use to edit my files?" The answer is, there is no definitive program to use.. Some work better much better than others however.

Recommended:
Notepad, Developers Pad, EditPlus, UltraEdit

Not Recommended:
Microsoft Word, Wordpad, Macromedia Dreamweaver

Notepad will get you by just fine, but the major features it lacks (syntax highlighting, line numbers and customizable keyboard shortcuts) can be found in the other recommended programs; Developers Pad, EditPlus and UltraEdit.

What program did you use to edit the files?
If you used Macromedia Dreamweaver, it's likely that something else was changed on top of what you asked it to change. The program is funny like that..
No it bloody well isnt.
I strongly resent the ENTIRE part of this post.
I used Dreamweaver for 90 % of my coding career, and not ONCE has it (nor FrontPage for that matter) fooked up my files.
The ONLY reason why it would EVER destroy vB code is if you, in your preferences, turned ON code rewriting.
Now I got code rewriting on, and yet DW doesnt mess up my vB files!?
OMFG!
I just put .php and .php3 as an extension in "Never rewrite code files with the following extensions:"

I cannot express thoroughly enough how much it PISSES ME OFF that someone just writes "Dreamweaver is not recommended because it destroyd vB coding", without actually bothering to check what the cause is and try to resolve it internally.




Originally Posted by Oblivion Knight
I get a syntax error when running this query.. Help!
Syntax errors are often enough the result of bad copying and pasting, or depending on what you're using to run database queries the query string may differ.

If you get a syntax error when running code with a ';' at the end of it, remove the ';' and try running it again. This SHOULD solve your problem.

Other things to look out for are too many ' marks used in the query. A good example of this would be the following query that you are asked to run when installing the Journal.. Please note that this is not a definate answer, different versions of phpMyAdmin may act differently.

Correct :laugh:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Incorrect :dead:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
Your "correct" SQL query syntax, while it works just perfect, is not 100 % correct.
The syntax as SQL itself shows it, is:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

The ONLY reason why you have syntax errors in your "incorrect" query is because usage of ' in the name area is not permitted, you must either use ` or none.


Other than these errors in your guide, its very well written.
Reply With Quote
  #5  
Old 08 Sep 2004, 20:27
CarCdr CarCdr is offline
 
Join Date: Apr 2004
LOL. C'mon now Revan, why don't you just tell us how you really feel about that entry on Dreamweaver.

UltraEdit? EditPlus? NotePad? Yeah, I guess if I were stuck in Lower Slomibia with no net connection and only kiddie software. Emacs.
Reply With Quote
  #6  
Old 08 Sep 2004, 22:22
Jolten Jolten is offline
 
Join Date: Mar 2004
Great thread Oblivion. I'd just like to add for the Macintosh, the best text editing application would be BBEdit from www.barebones.com. Users shoudl NOT use the macintosh TextEdit application. As for FTP, my favorite is Transmit from www.panic.com, but there's also Fetch along with other smaller FTP clients. In fact, MacOS 10 can directly connect to a server via FTP.

Dreamweaver is fine if you use version 4 or later. Version 3 had issues with dirtying code.
Reply With Quote
  #7  
Old 08 Sep 2004, 22:52
Oblivion Knight's Avatar
Oblivion Knight Oblivion Knight is offline
 
Join Date: May 2002
Real name: Andy
Originally Posted by Revan
I would like to submit the following comments to this guide.

You should also add that ALL the FTP clients you suggested supports the AUTO transfer mode, which (amongst others) automatically transfers PHP files in ASCII mode (which is the relevant file type and transfer mode for 99 % of all vB related transfer).
I'll add a section about the AUTO mode to the guide shortly..



Originally Posted by Revan
No it bloody well isnt.
I strongly resent the ENTIRE part of this post.
I used Dreamweaver for 90 % of my coding career, and not ONCE has it (nor FrontPage for that matter) fooked up my files.
The ONLY reason why it would EVER destroy vB code is if you, in your preferences, turned ON code rewriting.
Now I got code rewriting on, and yet DW doesnt mess up my vB files!?
OMFG!
I just put .php and .php3 as an extension in "Never rewrite code files with the following extensions:"

I cannot express thoroughly enough how much it PISSES ME OFF that someone just writes "Dreamweaver is not recommended because it destroyd vB coding", without actually bothering to check what the cause is and try to resolve it internally.
With all due respect, 80% of errors that people get when editing the functions.php file is caused by something that Dreamweaver has done (like you say, probably with code rewriting on).

Therefore, it is NOT recommended. Simple as.

Similarly with Wordpad, I use that all the time with no problems at all, but people that are new to coding experience problems and therefore it isn't recommended..

This guide is aimed at beginners, so I recommended the plain-text editors only.



Originally Posted by Revan
Your "correct" SQL query syntax, while it works just perfect, is not 100 % correct.

The ONLY reason why you have syntax errors in your "incorrect" query is because usage of ' in the name area is not permitted, you must either use ` or none.
I'm no query whizz, so thanks for pointing this out. Appropriate changes will be made.



Originally Posted by Jolten
I'd just like to add for the Macintosh, the best text editing application would be BBEdit from www.barebones.com. Users shoudl NOT use the macintosh TextEdit application. As for FTP, my favorite is Transmit from www.panic.com, but there's also Fetch along with other smaller FTP clients. In fact, MacOS 10 can directly connect to a server via FTP.
Thanks for the info, I'll add it with the next update.
Reply With Quote
  #8  
Old 08 Sep 2004, 23:52
rake's Avatar
rake rake is offline
 
Join Date: Nov 2002
Real name: Alex
Originally Posted by Revan
No it bloody well isnt.
I strongly resent the ENTIRE part of this post.
I used Dreamweaver for 90 % of my coding career, and not ONCE has it (nor FrontPage for that matter) fooked up my files.
The ONLY reason why it would EVER destroy vB code is if you, in your preferences, turned ON code rewriting.
Now I got code rewriting on, and yet DW doesnt mess up my vB files!?
OMFG!
I just put .php and .php3 as an extension in "Never rewrite code files with the following extensions:"

I cannot express thoroughly enough how much it PISSES ME OFF that someone just writes "Dreamweaver is not recommended because it destroyd vB coding", without actually bothering to check what the cause is and try to resolve it internally.
I've only used dreamweaver about 4 years ago before i started working with php and SSI includes were the popular way to make semi-dynamic websites. But i have used Frontpage a lot, and it does add a lot of crap of it's own into your files. Especially if you edit parts of html code, like a vb template for example, where the <table> tags are missing, it adds those in. When you put the template back in vBulletin it will be screwed up. I would have never thought of using it for php though, simply because it's a WYSIWYG html editor.

Anyway, my main tool has been notepad and 99% of my work has been done using notepad. Syntax highlighting is not important to me. In fact, i find it annoying. It distracts your attention from the actual code, with that dumb color coding. As for line numbering, CTRL+G in notepad (word wrap off) will take you directly to the line number you enter.
Reply With Quote
  #9  
Old 08 Sep 2004, 23:58
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Real name: Zachery Woods
Originally Posted by Revan
I would like to submit the following comments to this guide.

You should also add that ALL the FTP clients you suggested supports the AUTO transfer mode, which (amongst others) automatically transfers PHP files in ASCII mode (which is the relevant file type and transfer mode for 99 % of all vB related transfer).


No it bloody well isnt.
I strongly resent the ENTIRE part of this post.
I used Dreamweaver for 90 % of my coding career, and not ONCE has it (nor FrontPage for that matter) fooked up my files.
The ONLY reason why it would EVER destroy vB code is if you, in your preferences, turned ON code rewriting.
Now I got code rewriting on, and yet DW doesnt mess up my vB files!?
OMFG!
I just put .php and .php3 as an extension in "Never rewrite code files with the following extensions:"

I cannot express thoroughly enough how much it PISSES ME OFF that someone just writes "Dreamweaver is not recommended because it destroyd vB coding", without actually bothering to check what the cause is and try to resolve it internally.




Your "correct" SQL query syntax, while it works just perfect, is not 100 % correct.
The syntax as SQL itself shows it, is:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

The ONLY reason why you have syntax errors in your "incorrect" query is because usage of ' in the name area is not permitted, you must either use ` or none.


Other than these errors in your guide, its very well written.
I would have to say 90% of our problems with uCS, vBadvanced are user end error when users edit their files with dreamweaver.

I agree with Andy and rake
__________________
Looking for ImpEx?
Reply With Quote
  #10  
Old 09 Sep 2004, 10:21
Oblivion Knight's Avatar
Oblivion Knight Oblivion Knight is offline
 
Join Date: May 2002
Real name: Andy
Updated to v1.5, I think I have just about covered all of your suggestions so far.. Thanks.

Considering I first wrote this out of boredom in a Notepad document, it's growing in to a bit of a monster.
Reply With Quote
  #11  
Old 09 Sep 2004, 16:07
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Real name: Fillip
To everyone that agreed with DW not being recommended:
Im not here to be an ass and start a huge fight about the compatability of DW, but I would just like to say this.
The time it takes for an user to turn off Code Rewriting in Dreamweaver (MX 2004), or at least exclude .php and .php3, is considerably less than the time it takes for a beginner to spot a syntax error without syntax highlighting.
And yes I know, other clients on that list has the highlighting

Is it not the point for a guide to teach a beginner something new?
I would remove Dreamweaver from the Not recommended, and instead put a new section above with something like this:
"But I use Dreamweaver! Is that a bad thing?
No, Dreamweaver works great for PHP code editing and writing. It supports an extension that enables you to add the entire php.net documentation and user notes to it, which really helps if you are wondering what a specific PHP integrated function does.
BUT, you should enter 'Preferences' from the 'Edit' menu, and under the 'Code Rewriting' section, either turn Code Rewriting OFF, or check the 'Never rewrite code: In files with extensions' and put .php and .php3 in the input field."


If you tell your readers this, it will have the same effect as telling them not to use DW.
Because. Let us draw up a hypothesis:
A DW user reads your guide, and is determined to read and follow every comma of your guide, no matter if it reads "Throwing yourself infront of a bus is the only way to resolve that error".
Now this user is having trouble with DW code rewriting, and he wonders wether or not to change php editors.

Outcome #1:
He reads "Dont use DW", and ditches it for another editor with syntax highlighting. 2 years later, this user is a more experienced coder, and often finds himself on php.net to search for a function.
His coding never rewrites itself again.

Outcome #2:
He reads "Turn off code rewriting and/or include .php and .php3 to the exclusions", and continues to use DW. 2 years later, this user is a more experienced coder, and discovers the extension that allows php.net's manual to be downloaded and included into DW. This saves him lots of hassle as he wont have to go online all the time.
His coding never rewrites itself again.


See my point?

Again I say I dont want to sound like an ass, so stop me if Im becoming unserious here
Reply With Quote
  #12  
Old 09 Sep 2004, 18:21
Oblivion Knight's Avatar
Oblivion Knight Oblivion Knight is offline
 
Join Date: May 2002
Real name: Andy
Originally Posted by Revan
Is it not the point for a guide to teach a beginner something new?
I would remove Dreamweaver from the Not recommended, and instead put a new section above with something like this:
"But I use Dreamweaver! Is that a bad thing?
No, Dreamweaver works great for PHP code editing and writing. It supports an extension that enables you to add the entire php.net documentation and user notes to it, which really helps if you are wondering what a specific PHP integrated function does.
BUT, you should enter 'Preferences' from the 'Edit' menu, and under the 'Code Rewriting' section, either turn Code Rewriting OFF, or check the 'Never rewrite code: In files with extensions' and put .php and .php3 in the input field."
I'm going to leave it in the not recommended section, simply because I don't recommend it and as I've mentioned, I'm only recommending plain-text editors as they are 99.99% guranteed to work for anyone when it comes to editing vBulletin files.

I may however, add the section about Dreamweaver that you suggested at a later date..
Reply With Quote
Reply

Similar Article
Article Author Type Replies Last Post
vBa: Show GARS article image on article Cole2026 vBulletin 3.5 Add-ons 13 10 Apr 2006 18:13



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 00:20.

Layout Options | Width: Wide Color: