PDA

View Full Version : New Mod - idea mostly there - jsut need it coded ... you can take the credit


doa24uk
05-03-2009, 03:49 PM
Hi guys,

This will require a mod of the database.

The standard thread table will get a 2 new fields 'fullURL' & 'urlID'.
Create a new table called URL w/ 2 fields - urlID and URL1

urlID will be the unique ID for the URL.

eg.


urlID URL1
1 http://yahoo.com
2 http://google.com
3 http://msn.com
4 http://myblog.blogspot.com
5 http://facebook.com


etc. etc.


I want a new text box on my newthread.php page. The user will input an URL to a page.

eg. http://none.com/mytestpage.html

Two things now need to happen.

1. The system checks whether this full URL exists in the thread table in DB - fullURL
2. The system cuts just the domain from this & inserts it into a new table - URL


I already have the code that is required to do no. 2


Now here's the logic for creating the topic based on the above information.....


From thread table check whether the full URL exists

if it does then send back to newthread.php page with an error (sorry this page has already been shared, please try a different one)

If not, then do the following -->



Select * from URL where URL1 is equal to $shortenedURL (created by the PHP script from point no. 2)

If it exists then URL1 has been shared before & doesn't need re-inputted. Create topic, remembering to insert urlID into the thread table.

Otherwise it doesn't exist so insert URL1 into URL. Create topic, remembering to insert urlID into the thread table.



My question is, does anyone wanna fully code this & take credit for it.

I know the custom thread fields mod exists but that requires an admin inputting all the available options into the DB - which is impossible for what I want to use it for ... so are topic prefixes.

If you code this you are more than welcome to take full credit for it.


DoA

ps. The end result of this mod is so that people can filter by original site ... so they can see all topics posted that originated from Facebook for example ... this would of course require a drop down list that could be coded into this system.....

troybtj
05-15-2009, 07:33 PM
Wouldn't a regular expression to get only the root URL of the sites from a list work better?

Fractalizer has a filter mod that will do this, with the correct regular expression:


\b((?#protocol)https?|ftp)://((?#domain)[-A-Z0-9.]+)((?#file)/[-A-Z0-9+&@#/%=~_|!:,.;]*)?((?#parameters)\?[A-Z0-9+&@#/%=~_|!:,.;]*)?


Replace with only protocol://domain e.g. \1, \2