vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Adding TNX?? (https://vborg.vbsupport.ru/showthread.php?t=169298)

laserterd 01-31-2008 10:34 PM

Adding TNX??
 
Can anyone tell me how to get tnx.net ads on my vbulletin? The signup is real quick, no need a email confirmation.

I went into my vbulletin admin panel, went to styles and templates, and went "all style options", and then copied and pasted the ad code at the bottom of the "footer" template. But when i press submit, i get an error message, something about line 113, and a conditional statement or something.

Please help me figure this out, i want to be able to get this ad service on the bottom of every page on my vbulletin. thanks!

btw the site is www.tnx.net .

Marco van Herwaarden 02-01-2008 05:41 AM

Posting the exact full error and your footer template will give you a much better chance for receiving an answer.

laserterd 02-01-2008 06:08 AM

Code:

The following error occurred when attempting to evaluate the template 'footer':

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/s/p/e/*******/html/includes/adminfunctions_template.php(3596) : eval()'d code on line 133

This is likely caused by a malformed conditional statement.


This happens when I press save on "admin panel-->styles and templates-->my theme-->edit all style options-->add code in the footer-->press save"

The only option below all this code is "go back".

Thanks for the help.

Marco van Herwaarden 02-01-2008 06:28 AM

And the footer code you are trying to save as also requested in post #2?

laserterd 02-01-2008 05:43 PM

Code:

<br />
<div class="smallfont" align="center">$vbphrase[all_times_are_gmt_x_time_now_is_y]</div>
<br />

$spacer_close
<!-- /content area table -->

<form action="$vboptions[forumhome].php" method="get">
       
<table cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="$stylevar[outertablewidth]" class="page" align="center">
<tr>
        <if condition="$show['quickchooser']">
                <td class="tfoot">
                        <select name="styleid" onchange="switch_id(this, 'style')">
                                <optgroup label="$vbphrase[quick_style_chooser]">
                                        $quickchooserbits
                                </optgroup>
                        </select>
                </td>
        </if>
        <if condition="$show['languagechooser']">
                <td class="tfoot">
                        <select name="langid" onchange="switch_id(this, 'lang')">
                                <optgroup label="$vbphrase[quick_language_chooser]">
                                        $languagechooserbits
                                </optgroup>
                        </select>
                </td>
        </if>
        <td class="tfoot" align="$stylevar[right]" width="100%">
                <div class="smallfont">
                        <strong>
                                <if condition="$show['contactus']"><a href="$vboptions[contactuslink]" rel="nofollow" accesskey="9">$vbphrase[contact_us]</a> -</if>
                                <if condition="$vboptions['hometitle']"><a href="$vboptions[homeurl]">$vboptions[hometitle]</a> -</if>
                                <if condition="$show['admincplink']"><a href="$admincpdir/index.php$session[sessionurl_q]">$vbphrase[admin]</a> -</if>
                                <if condition="$show['modcplink']"><a href="$modcpdir/index.php$session[sessionurl_q]">$vbphrase[mod]</a> -</if>
                                <if condition="$vboptions['archiveenabled']"><a href="archive/index.php">$vbphrase[archive]</a> -</if>
                                <if condition="$vboptions[privacyurl]"><a href="$vboptions[privacyurl]">$vbphrase[privacy_statement]</a> -</if>
                                <a href="#top" onclick="self.scrollTo(0, 0); return false;">$vbphrase[top]</a>
                        </strong>
                </div>
        </td>
</tr>
</table>

<br />

<div align="center">
        <div class="smallfont" align="center">
        <!-- Do not remove this copyright notice -->
        $vbphrase[powered_by_vbulletin]
        <!-- Do not remove this copyright notice -->
        </div>
       
        <div class="smallfont" align="center">
        <!-- Do not remove $cronimage or your scheduled tasks will cease to function -->
        $cronimage
        <!-- Do not remove $cronimage or your scheduled tasks will cease to function -->
       
        $vboptions[copyrighttext]
        </div>
</div>

</form>

<if condition="$show['dst_correction']">
<!-- auto DST correction code -->
<form action="profile.php?do=dst" method="post" name="dstform">
        <input type="hidden" name="s" value="$session[sessionhash]" />
        <input type="hidden" name="do" value="dst" />
</form>
<script type="text/javascript">
<!--
        var tzOffset = $bbuserinfo[timezoneoffset] + $bbuserinfo[dstonoff];
        var utcOffset = new Date().getTimezoneOffset() / 60;
        if (Math.abs(tzOffset + utcOffset) == 1)
        {        // Dst offset is 1 so its changed
                document.forms.dstform.submit();
        }
//-->
</script>
<!-- / auto DST correction code -->

</if>
<script type="text/javascript">
<!--
        // Main vBulletin Javascript Initialization
        vBulletin_init();
//-->
</script>


<?php
//<div style="font-size: 16px;">If you see this, your server does not support PHP. Ask your web-hosting provider where you can add the PHP code on your website.</div>
/*ERROR<!--*/
class TNX_l
{
        var $_login = 'laserterd'; // your TNX login
        var $_timeout_connect = 5; // timeout - maximum time for the links to load (in seconds)
        var $_connect_using = 'fsock'; // curl or fsock - you may choose the way to connect
        var $_html_delimiter = '<br>'; // link devider - symbol between links (you may choose any symbol)
        var $_encoding = ''; // your website encoding. You may also use: KOI8-U, UTF-8, iso-8859-1 (iconv module must be installed on your server)
        var $_exceptions = 'PHPSESSID'; // here you can list URL's that you don't want to be indexed by TNX. Basically, those are URLs that are not indexed by search engines, or links to pages that don't exist. Don't change this value after it has been indexed by TNX system.
        /*******************************/
        var $_return_point = 0;
        var $_content = '';

        function TNX_l()
        {
                if($this->_connect_using == 'fsock' AND !function_exists('fsockopen')){echo 'fsock function is disabled on your server, contact your provider or try to use the CURL version of the TNX code.'; return false;}
                if($this->_connect_using == 'curl' AND !function_exists('curl_init')){echo 'Error, CURL is not supported, try using fsock.'; return false;}
                if(!empty($this->_encoding) AND !function_exists("iconv")){echo 'CURL function is disabled on your server, contact your provider or try to use the fsock version of the TNX code.'; return false;}

                if ($_SERVER['REQUEST_URI'] == '') $_SERVER['REQUEST_URI'] = '/';
                if (strlen($_SERVER['REQUEST_URI']) > 180) return false;

                if(!empty($this->_exceptions))
                {
                        $exceptions = explode(' ', $this->_exceptions);
                        for ($i=0; $i<sizeof($exceptions); $i++)
                        {
                                if($_SERVER['REQUEST_URI'] == $exceptions[$i]) return false;
                                if($exceptions[$i] == '/' AND preg_match("#^\/index\.\w{1,5}$#", $_SERVER['REQUEST_URI'])) return false;
                                if(strpos($_SERVER['REQUEST_URI'], $exceptions[$i]) !== false) return false;
                        }
                }

                $this->_login = strtolower($this->_login); $this->_host = $this->_login . '.tnx.net'; $file = base64_encode($_SERVER['REQUEST_URI']);
                $user_pref = substr($this->_login, 0, 2); $md5 = md5($file); $index = substr($md5, 0, 2);
                $site = str_replace('www.', '', $_SERVER['HTTP_HOST']);
                $this->_path = '/users/' . $user_pref . '/' . $this->_login . '/' . $site. '/' . substr($md5, 0, 1) . '/' . substr($md5, 1, 2) . '/' . $file . '.txt';
                $this->_url = 'http://' . $this->_host . $this->_path;
                $this->_content = $this->get_content();
                if($this->_content !== false)
                {
                        $this->_content_array = explode('<br>', $this->_content);
                        for ($i=0; $i<sizeof($this->_content_array); $i++)
                        {
                                $this->_content_array[$i] = trim($this->_content_array[$i]);
                        }
                }
        }
        /*!!!*/
        function show_link($num = false)
        {
                if(!isset($this->_content_array)) return false;
                $links = '';
                if(!isset($this->_content_array_count)){$this->_content_array_count = sizeof($this->_content_array);}
                if($this->_return_point >= $this->_content_array_count) return false;

                if($num === false OR $num >= $this->_content_array_count)
                {
                        for ($i = $this->_return_point; $i < $this->_content_array_count; $i++)
                        {
                                $links .= $this->_content_array[$i] . $this->_html_delimiter;
                        }
                        $this->_return_point += $this->_content_array_count;
                }
                else
                {
                        if($this->_return_point + $num > $this->_content_array_count) return false;
                        for ($i = $this->_return_point; $i < $num + $this->_return_point; $i++)
                        {
                                $links .= $this->_content_array[$i] . $this->_html_delimiter;
                        }
                        $this->_return_point += $num;
                }
                return (!empty($this->_encoding)) ? iconv("windows-1251", $this->_encoding, $links) : $links;
        }
        function get_content()
        {
                $user_agent = 'TNX_l ip: ' . $_SERVER['REMOTE_ADDR'];
                $page = '';
                if ($this->_connect_using == 'curl' OR ($this->_connect_using == '' AND function_exists('curl_init')))
                {
                        $c = curl_init($this->_url);
                        curl_setopt($c, CURLOPT_CONNECTTIMEOUT, $this->_timeout_connect);
                        curl_setopt($c, CURLOPT_HEADER, false);
                        curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
                        curl_setopt($c, CURLOPT_TIMEOUT, $this->_timeout_connect);
                        curl_setopt($c, CURLOPT_USERAGENT, $user_agent);
                        $page = curl_exec($c);
                        if(curl_error($c) OR (curl_getinfo($c, CURLINFO_HTTP_CODE) != '200' AND curl_getinfo($c, CURLINFO_HTTP_CODE) != '404') OR strpos($page, 'fsockopen') !== false)
                        {
                                curl_close($c);
                                return false;
                        }
                        curl_close($c);
                }
                elseif($this->_connect_using == 'fsock')
                {
                        $buff = '';
                        $fp = @fsockopen($this->_host, 80, $errno, $errstr, $this->_timeout_connect);
                        if ($fp)
                        {
                                fputs($fp, "GET " . $this->_path . " HTTP/1.0\r\n");
                                fputs($fp, "Host: " . $this->_host . "\r\n");
                                fputs($fp, "User-Agent: " . $user_agent . "\r\n");
                                fputs($fp, "Connection: Close\r\n\r\n");

                                stream_set_blocking($fp, true);
                                stream_set_timeout($fp, $this->_timeout_connect);
                                $info = stream_get_meta_data($fp);

                                while ((!feof($fp)) AND (!$info['timed_out']))
                                {
                                        $buff .= fgets($fp, 4096);
                                        $info = stream_get_meta_data($fp);
                                }
                                fclose($fp);

                                if ($info['timed_out']) return false;

                                $page = explode("\r\n\r\n", $buff);
                                $page = $page[1];
                                if((!preg_match("#^HTTP/1\.\d 200$#", substr($buff, 0, 12)) AND !preg_match("#^HTTP/1\.\d 404$#", substr($buff, 0, 12))) OR $errno!=0 OR strpos($page, 'fsockopen') !== false) return false;
                        }
                }
                if(strpos($page, '404 Not Found')) return '';
                return $page;
        }
}
$tnx = new TNX_l();
echo $tnx->show_link(1); // first link
echo $tnx->show_link(1); // second link
echo $tnx->show_link(1); // third link
echo $tnx->show_link(); // remaining links
/*-->*/
?>


Marco van Herwaarden 02-02-2008 11:12 AM

You have added PHP code to your template. Templates are HTML and can not contain PHP code.

Some more info on including PHP code: Including External Files


All times are GMT. The time now is 02:29 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03174 seconds
  • Memory Usage 1,791KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete