Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: Database: MS SQL Server
 replace topic headings because of DB damage
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

alltp
Starting Member

36 Posts

Posted - 13 September 2007 :  20:33:17  Show Profile  Visit alltp's Homepage
You all kindly helped me when I had a SQL injection issue due to not having the latest version of the forum.

The result is that a number of the forum topics have this title:

<script src="http://1390578.cn/images/163.js"></script>

At the point I upgraded I didn't want to restore the database - we would have lost a lot of new posts.

What I would like to do is run a script that replaces the forum topic above with the first series of characters in the body of the topic. This will give a title that is likely to make sense and at least it won't have something that says "script" in it.

Your continued help is appreciated in advance.

John Hill
www.tabletpcbuzz.com

John Hill
www.alltp.com
www.tabletpcbuzz.com
www.tabletpcbuzz.com/3dbuzz

Edited by - alltp on 13 September 2007 20:36:30

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 14 September 2007 :  04:41:03  Show Profile
To convert all topics, the SQL would be:

UPDATE FORUM_TOPICS SET T_SUBJECT = LEFT (CAST (T_MESSAGE As nvarchar (50)),50)

You can change the 50 value to a bigger or smaller number, depending on how many characters you want.

To add a condition to change only the titles that begin with '<script', then the code would be this one:


UPDATE FORUM_TOPICS SET T_SUBJECT = LEFT (CAST (T_MESSAGE As nvarchar (50)),50)
 WHERE LEFT(T_SUBJECT,7) = '<script'


I'm admitting that there are no spaces in the title, before '<script>'. If you have normal topics, without such title, use the latter statement, not the first, cause the first will change all your topics.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

alltp
Starting Member

36 Posts

Posted - 14 September 2007 :  21:23:37  Show Profile  Visit alltp's Homepage
ruirib,

It's official - YOU ARE THE MAN!

All my topics are fixed and I really can't thank you enough. When I took over the website I had nothing but problems and believed they were caused by the Snitz Forums software. Obviously, that is not the case because every problem I've had, you and the other folks on this site have helped me solve.

THANK YOU!

John Hill
TabletPCBuzz.com

John Hill
www.alltp.com
www.tabletpcbuzz.com
www.tabletpcbuzz.com/3dbuzz
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 14 September 2007 :  23:10:01  Show Profile
Glad to be of help. I'm specially satisfied that Huw showed that your problem was not our code and that even the other code is now fixed.

I need to visit TabletPCBuzz.com. After all, all I do here is done from a Toshiba Tecra M4 and I do think I had previously registered and even posted, but I can't find my posts and login info anywhere .


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.84 seconds. Powered By: Snitz Forums 2000 Version 3.4.07