PDA

View Full Version : LinkMe Hack


.Tim
03-11-2006, 10:00 PM
This is a port of this hack:

https://vborg.vbsupport.ru/showthread.php?t=64615

Instructions:

1) Unzip and overwrite the 'banner03_468x60.gif' file with your own banner (keeping the same name, obviously). Then upload the files to your site, keeping the same directory structure. (http://www.sitename.com/images/banners/banner03_468x60.gif)


2) Upload product.


3) Then add:

<td class="vbmenu_control"><a href="/misc.php?do=linkme">Link Me</a></td>

In the navbar where ever you want the link to appear.



Right now it only shows one banner but you can manually add more by editing the LinkMe template. Soon I'll try and make it where you can add banners via the admincp. Enjoy. :D

.Tim
03-12-2006, 06:44 PM
If you installed the previous version for vb3.0, you will no longer use the www.sitename.com/linkme.php link anymore. The link will now be http://www.sitename.com/misc.php?do=linkme and also, you will need to revert/delete your linkme template before uploading the product.

And make sure you have the site url in your admincp -> vboptions is set properly or else your images will not appear.

jawinn
03-12-2006, 06:48 PM
I've been looking for something like this.

Downloaded, will install on test forum this evening.

CSS59
03-12-2006, 06:55 PM
You are the man!! THANK YOU!

CSS59
03-12-2006, 07:02 PM
well it does not override the one I had installed in 3.0 :(

.Tim
03-12-2006, 07:14 PM
well it does not override the one I had installed in 3.0 :(
See link (http://www.cobaltss.net/forums/LinkMe.php)

This port doesn't use the php file. The page is now at:

http://www.xxxxxxx.net/forums/misc.php?do=linkme

CSS59
03-12-2006, 07:18 PM
can you help me make it use that file?

.Tim
03-12-2006, 07:20 PM
can you help me make it use that file?

I'll see what I can do.

.Tim
03-12-2006, 07:26 PM
Okay, backup your LinkMe.php file and then replace the contents with this:

<?php

error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT','LinkMe');

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups

// get special data templates from the datastore

// pre-cache templates used by all actions
$globaltemplates = array(
'LinkMe');

// pre-cache templates used by specific actions

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

$advertising = "";

$direktory = "./images/banners";
$handle=opendir($direktory);
while ($file = readdir($handle)) {
$filelist[] = $file;
}
asort($filelist);
while (list ($a, $file) = each ($filelist)) {
if ($file == "." || $file == ".." || $file == "index.htm" || $file == "CVS") {
} else {

$bild = "./images/banners/$file";
$info = getimagesize($bild);
$id = filesize($bild);
$size = round ($id / 1024 ,2);

$advertising .= "<IMG SRC=\"$vboptions[bburl]/images/banners/".$file."\"><BR>Pixel : ". $info[0] ." x " . $info[1] ." ca. ".$size." KB";

$advertising .= "
<BR>
<BR>
<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"650px\">
<tr>
<td class=\"smallfont\" align=\"left\">
Source Code to be linked:</td><td class=\"smallfont\" align=\"right\">
(Box Double-Click copies source code to clipboard)
</td>
</tr>
</table>";


}

}

eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('LinkMe') . '");');

?>

CSS59
03-12-2006, 07:37 PM
Okay, backup your LinkMe.php file and then replace the contents with this:

[/code]

done. My images don't show up. I have them all saved in forums/images/banners ?

.Tim
03-12-2006, 07:46 PM
done. My images don't show up. I have them all saved in forums/images/banners ?

It's looking in root/images/banners. Try changing:

$direktory = "./images/banners";

to:

$direktory = "./forums/images/banners";

And

$bild = "./images/banners/$file";

to:

$bild = "./forums/images/banners/$file";

in your LinkMe.php file.

CSS59
03-12-2006, 07:49 PM
[quote]Warning: opendir(./forums/images/banners): failed to open dir: No such file or directory in /LinkMe.php on line 24

Warning: readdir(): supplied argument is not a valid Directory resource in /LinkMe.php on line 25

Warning: asort() expects parameter 1 to be array, null given in /LinkMe.php on line 28

Warning: Variable passed to each() is not an array or object in /LinkMe.php on line 29

.Tim
03-12-2006, 07:52 PM
In your vboptions what do you have the url set to?

CSS59
03-12-2006, 07:57 PM
In your vboptions what do you have the url set to?

<IMG SRC=\"$vboptions[bburl]/forums/images/banners/".$file."\">

.Tim
03-12-2006, 08:02 PM
<IMG SRC=\"$vboptions[bburl]/forums/images/banners/".$file."\">

No I meant in your admincp in your options. What is your site url set to?

CSS59
03-12-2006, 08:10 PM
No I meant in your admincp in your options. What is your site url set to?

http://domain.com

.Tim
03-12-2006, 08:12 PM
http://domain.com

Change it to http://domain.com/forums

and then redo what I posted here:

https://vborg.vbsupport.ru/showpost.php?p=923277&postcount=9

Barakat
03-13-2006, 01:13 AM
works great thanks

dodgechargerfan
03-14-2006, 05:00 PM
Neat!

How tough would it be to make the link work from a portal page like drupal (with the vBdrupal integration product)?

derfelix
03-15-2006, 09:29 AM
well with me it doesn't work as is..

$vboptions[bburl] is empty in a php file!

i have to use $vbulletin->options['bburl'] instead!!!

actually i have to replace:

<IMG SRC=\"$vboptions[bburl]/forums/images/banners/".$file."\">

with

<IMG SRC=\"".$vbulletin->options['bburl']."/forums/images/banners/".$file."\">

and so on....

arer u sure this is for 3.54???????

Felix

.Tim
03-16-2006, 03:50 AM
Worked fine on my test board that is 3.5.4.

EricaJoy
03-28-2006, 07:17 PM
well with me it doesn't work as is..

$vboptions[bburl] is empty in a php file!

i have to use $vbulletin->options['bburl'] instead!!!

actually i have to replace:

<IMG SRC=\"$vboptions[bburl]/forums/images/banners/".$file."\">

with

<IMG SRC=\"".$vbulletin->options['bburl']."/forums/images/banners/".$file."\">

and so on....

arer u sure this is for 3.54???????

FelixThanks for this...it helped me figure out how to get my old LinkMe hack working on 3.5. It may not be the right way but it friggin works. Woot.
<?php

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
// change the line below to the actual filename without ".php" extention.
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation.

define('THIS_SCRIPT', 'LinkMe');

// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array(
// change the lines below to the list of actual templates used in the script
'LinkMe'
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');

// #################### HARD CODE JAVASCRIPT PATHS ########################
$headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude);

// ################################################## ######################
// ######################### START MAIN SCRIPT ############################
// ################################################## ######################


$advertising = "";

$direktory = "./images/banners";
$handle=opendir($direktory);
$bbuserinfo = $vbulletin->userinfo;
unset($vbulletin->userinfo);
while ($file = readdir($handle)) {
$filelist[] = $file;
}
asort($filelist);
while (list ($a, $file) = each ($filelist)) {
if ($file == "." || $file == ".." || $file == "index.htm" || $file == "CVS") {
} else {

$bild = "./images/banners/$file";
$info = getimagesize($bild);
$id = filesize($bild);
$size = round ($id / 1024 ,2);

$advertising .= "<IMG SRC=\"".$vbulletin->options['bburl']."/images/banners/".$file."\"><BR>Pixel : ". $info[0] ." x " . $info[1] ." ca. ".$size." KB";

$advertising .= "
<BR>
<BR>
<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"650px\">
<tr>
<td class=\"smallfont\" align=\"left\">
Source Code to be linked:</td><td class=\"smallfont\" align=\"right\">
(Box Double-Click copies source code to clipboard)
</td>
</tr>
</table>";

$advertising .= "<a ondblclick='java_script_:window.clipboardData.setD ata(\"Text\",
this.innerText); alert(\"Source Code copied into clipboard.\");'>
<pre>
<div class=\"alt2\" style=\"margin:0px; padding:6px; border:1px inset; width:650px; height:70px; overflow:auto; text-align:left\">
<code style=\"white-space:nowrap\"> &lt;!-- ".$vbulletin->options['bburl']." Advertising Start --&gt;
<BR>&lt;A HREF=\"".$vbulletin->options['bburl']."/".$vbulletin->options['forumhome'].".php?referrerid=$bbuserinfo[userid]\"&gt;<BR>&lt;IMG SRC=\"".$vbulletin->options['bburl']."/images/banners/".$file."\"&gt;&lt;/A&gt;<BR>
&lt;!-- ".$vbulletin->options['bburl']." Advertising End --&gt;
</code></pre>
</A>
<BR>
<BR>";

}

}
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('LinkMe') . '");');

?>

Snake
03-28-2006, 07:20 PM
Just what I've been looking for.

/me clicks on the install button

rrr
07-10-2006, 11:33 PM
Thanks for posting the updated php code for the old version, EricaJoy. Works perfect!

EricaJoy
07-16-2006, 04:01 PM
No problem, glad I could help. :)

Kihon Kata
08-28-2006, 07:12 PM
Possible to adjust this for 3.6?

.Tim
08-29-2006, 02:57 AM
I haven't looked but I'll check it out as soon as I can. I don't see why not though.

PoetJA-1975
11-27-2006, 05:46 AM
Thanks for this...it helped me figure out how to get my old LinkMe hack working on 3.5. It may not be the right way but it friggin works. Woot.
<?php

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
// change the line below to the actual filename without ".php" extention.
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation.

define('THIS_SCRIPT', 'LinkMe');

// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array(
// change the lines below to the list of actual templates used in the script
'LinkMe'
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');

// #################### HARD CODE JAVASCRIPT PATHS ########################
$headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude);

// ################################################## ######################
// ######################### START MAIN SCRIPT ############################
// ################################################## ######################


$advertising = "";

$direktory = "./images/banners";
$handle=opendir($direktory);
$bbuserinfo = $vbulletin->userinfo;
unset($vbulletin->userinfo);
while ($file = readdir($handle)) {
$filelist[] = $file;
}
asort($filelist);
while (list ($a, $file) = each ($filelist)) {
if ($file == "." || $file == ".." || $file == "index.htm" || $file == "CVS") {
} else {

$bild = "./images/banners/$file";
$info = getimagesize($bild);
$id = filesize($bild);
$size = round ($id / 1024 ,2);

$advertising .= "<IMG SRC=\"".$vbulletin->options['bburl']."/images/banners/".$file."\"><BR>Pixel : ". $info[0] ." x " . $info[1] ." ca. ".$size." KB";

$advertising .= "
<BR>
<BR>
<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"650px\">
<tr>
<td class=\"smallfont\" align=\"left\">
Source Code to be linked:</td><td class=\"smallfont\" align=\"right\">
(Box Double-Click copies source code to clipboard)
</td>
</tr>
</table>";

$advertising .= "<a ondblclick='java_script_:window.clipboardData.setD ata(\"Text\",
this.innerText); alert(\"Source Code copied into clipboard.\");'>
<pre>
<div class=\"alt2\" style=\"margin:0px; padding:6px; border:1px inset; width:650px; height:70px; overflow:auto; text-align:left\">
<code style=\"white-space:nowrap\"> &lt;!-- ".$vbulletin->options['bburl']." Advertising Start --&gt;
<BR>&lt;A HREF=\"".$vbulletin->options['bburl']."/".$vbulletin->options['forumhome'].".php?referrerid=$bbuserinfo[userid]\"&gt;<BR>&lt;IMG SRC=\"".$vbulletin->options['bburl']."/images/banners/".$file."\"&gt;&lt;/A&gt;<BR>
&lt;!-- ".$vbulletin->options['bburl']." Advertising End --&gt;
</code></pre>
</A>
<BR>
<BR>";

}

}
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('LinkMe') . '");');

?>

THANX VERY MUCH FOR SUPPLYING THIS CODE!
Got the original mod to work on my forum - much appreciation ;)

Jacquii.

btw - http://jpicforum.info/LinkMe.php