Welcome to Dream.In.Code
Getting Help is Easy!

Join 118,477 Programmers for FREE! Ask your question and get quick answers from experts. There are 931 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Landing Pages for Your Forum

 
Reply to this topicStart new topic

> Landing Pages for Your Forum, For vBulletin and improved welcome headers

WoodiE55
Group Icon



post 5 Dec, 2006 - 07:38 PM
Post #1


Login into vBulletin's admin panel and navigate to:

Plugin System -> Add New Plugin

PRODUCT: vBulletin
HOOK LOCATION: global_start
TITLE: Landing Page
PLUGIN PHP CODE: paste the following code...

CODE

$referer = $_SERVER['HTTP_REFERER'];

//Did they get here from a search?
if((preg_match('/www\.google.*/i',$referer))
   || preg_match('/search\.atomz.*/i',$referer)
    || preg_match('/search\.live.*/i',$referer)
   || preg_match('/search\.msn.*/i',$referer)
   || preg_match('/search\.yahoo.*/i',$referer)
   || preg_match('/msxml\.excite\.com/i', $referer)
   || preg_match('/search\.lycos\.com/i', $referer)
   || preg_match('/www\.alltheweb\.com/i', $referer)
   || preg_match('/search\.aol\.com/i', $referer)
   || preg_match('/search\.iwon\.com/i', $referer)
   || preg_match('/ask\.com/i', $referer)
   || preg_match('/search\.cometsystems\.com/i', $referer)
   || preg_match('/www\.hotbot\.com/i', $referer)
   || preg_match('/www\.overture\.com/i', $referer)
   || preg_match('/www\.metacrawler\.com/i', $referer)
   || preg_match('/search\.netscape\.com/i', $referer)
   || preg_match('/www\.looksmart\.com/i', $referer)
   || preg_match('/go\.google\.com/i', $referer)
   || preg_match('/dpxml\.webcrawler\.com/i', $referer)
   || preg_match('/search\.earthlink\.net/i', $referer)
   || preg_match('/search\.viewpoint\.com/i', $referer)
   || preg_match('/www\.mamma\.com/i', $referer)
   || preg_match('/home\.bellsouth\.net\/s\/s\.dll/i', $referer)
   || preg_match('/www\.ask\.co\.uk/i', $referer)) {

  //Figure out which search and get the part of its URL which contains the search terms.
  if(preg_match('/(www\.google.*)|(search\.msn.*)|(search\.live.*)|(www\.alltheweb\.com)|(ask\.com)|(go\.google\.com)|(search\.earthlink\.net)/i',$referer))
    $delimiter = "q";
  elseif(preg_match('/www\.ask\.co\.uk/i', $referer))
    $delimiter = "ask";
  elseif(preg_match('/search\.atomz.*/i',$referer))
    $delimiter = "sp-q";
  elseif(preg_match('/search\.yahoo.*/i',$referer))
    $delimiter = "p";
  elseif(preg_match('/(msxml\.excite\.com)|(www\.metacrawler\.com)|(dpxml\.webcrawler\.com)/i', $referer))
    $delimiter = "qkw";
  elseif(preg_match('/(search\.lycos\.com)|(search\.aol\.com)|(www\.hotbot\.com)|(search\.netscape\.com)|(search\.mamma\.com)/i', $referer))
    $delimiter = "query";
  elseif(preg_match('/search\.iwon\.com/i', $referer))
    $delimiter = "searchfor";
  elseif(preg_match('/search\.cometsystems\.com/i', $referer))
    $delimiter = "qry";
  elseif(preg_match('/www\.overture\.com/i', $referer))
    $delimiter = "Keywords";
  elseif(preg_match('/www\.looksmart\.com/i', $referer))
    $delimiter = "key";
  elseif(preg_match('/search\.viewpoint\.com/i', $referer))
    $delimiter = "k";
  elseif(preg_match('/home\.bellsouth\.net\/s\/s\.dll/i', $referer))
    $delimiter = "string";

  $pattern = "/^.*" . $delimiter . "=([^&]+)&?.*\$/i";
  $query = preg_replace($pattern, '$1', $referer);

  //Remove quotation marks.
  $query = preg_replace('/\'|"/','',$query);

    $query_array = preg_split ("/[\s,\+\.]+/",$query);
    $query_terms = implode(" ", $query_array);
    $terms = htmlspecialchars(urldecode($query_terms));

}


PLUGIN IS ACTIVE: Yes

PRESS SAVE.

Now just add $terms in any template you want.



+++ IF YOU'RE USING Ted S - Improved Welcome headers from vbulletin.org +++

Styles & Templates -> Style Manager -> welcome_headers

FIND THIS:

CODE
<phrase 1="faq.php?$session[sessionurl]" 2="register.php?$session[sessionurl]" 3="$vboptions[bbtitle]" 4="sendmessage.php$session[sessionurl]">$vbphrase[welcome_guest]</phrase>


REPLACE WITH:

CODE
<phrase 1="faq.php?$session[sessionurl]" 2="register.php?$session[sessionurl]" 3="$vboptions[bbtitle]" 4="sendmessage.php$session[sessionurl]" 5="$terms">$vbphrase[welcome_guest]</phrase>


SAVE!


NOTE: The difference in the code is adding: 5="$terms" to the phrases. This will allow the $terms variable to work with the welcome headers for guest.

This post has been edited by skyhawk133: 5 Dec, 2006 - 08:10 PM
Go to the top of the page
+Quote Post


Register to Make This Ad Go Away!

BamaStangGuy
*



post 5 Dec, 2006 - 08:02 PM
Post #2
Not working for me. Did exactly as instructions said. Copied and pasted then used the $terms to call it

This post has been edited by BamaStangGuy: 5 Dec, 2006 - 08:03 PM
Go to the top of the page
+Quote Post

WoodiE55
Group Icon



post 5 Dec, 2006 - 08:05 PM
Post #3
QUOTE(BamaStangGuy @ 5 Dec, 2006 - 08:02 PM) *

Not working for me. Did exactly as instructions said. Copied and pasted then used the $terms to call it


I don't think this would cause an issue, but what version of vBulletin are you using?

The above instructions worked for 3.5.4


-Michael
Go to the top of the page
+Quote Post

BamaStangGuy
*



post 5 Dec, 2006 - 08:07 PM
Post #4
QUOTE(WoodiE55 @ 5 Dec, 2006 - 08:05 PM) *

QUOTE(BamaStangGuy @ 5 Dec, 2006 - 08:02 PM) *

Not working for me. Did exactly as instructions said. Copied and pasted then used the $terms to call it


I don't think this would cause an issue, but what version of vBulletin are you using?

The above instructions worked for 3.5.4


-Michael


3.6.0 patched
Go to the top of the page
+Quote Post

skyhawk133
Group Icon



post 5 Dec, 2006 - 08:13 PM
Post #5
I just updated the PHP portion of the code to include live.com. Yahoo is having a weird issue with the cop variable... should be pulling the p variable instead. Live.com should work now though.
Go to the top of the page
+Quote Post

BamaStangGuy
*



post 5 Dec, 2006 - 08:17 PM
Post #6
QUOTE(skyhawk133 @ 5 Dec, 2006 - 08:13 PM) *

I just updated the PHP portion of the code to include live.com. Yahoo is having a weird issue with the cop variable... should be pulling the p variable instead. Live.com should work now though.


lol go figure cause Yahoo is where I get my most referrers
Go to the top of the page
+Quote Post

skyhawk133
Group Icon



post 5 Dec, 2006 - 08:21 PM
Post #7
I'll get it fixed up for ya wink2.gif It's just an issue with the regular expression the guy who wrote it originally is using.

Also, if you want to output each word uppercase, add $terms = ucwords($terms); before the closing bracket in the first section of code.
Go to the top of the page
+Quote Post

WoodiE55
Group Icon



post 6 Dec, 2006 - 07:22 AM
Post #8
QUOTE(skyhawk133 @ 5 Dec, 2006 - 08:21 PM) *

I'll get it fixed up for ya wink2.gif It's just an issue with the regular expression the guy who wrote it originally is using.

Also, if you want to output each word uppercase, add $terms = ucwords($terms); before the closing bracket in the first section of code.


skyhawk,

Thanks so much for your help on this! I owe you.


-Michael
Go to the top of the page
+Quote Post

skyhawk133
Group Icon



post 6 Dec, 2006 - 07:24 AM
Post #9
Have you noticed any increase/change in your registration rate?
Go to the top of the page
+Quote Post

WoodiE55
Group Icon



post 6 Dec, 2006 - 09:56 AM
Post #10
QUOTE(skyhawk133 @ 6 Dec, 2006 - 07:24 AM) *

Have you noticed any increase/change in your registration rate?


Average RCNitroTalk.com for the last month or two receives about 5 new members each day. Yesterday it jumped to 8 new members. It'll be interesting to watch over the next week or two to really be able to get a sense of how well this works or not.


-Michael
Go to the top of the page
+Quote Post


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 10/11/08 05:51AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month