จัดการบล็อกของคุณ

สร้างบล็อกของคุณดี๋ยวนี้! ง่ายดายและฟรี

งานออนไลน์
hot web for free

25/04/2008 GMT 1

code 1

741147 @ 02:55

function tla_ads() {

// Number of seconds before connection to XML times out
// (This can be left the way it is)
$CONNECTION_TIMEOUT = 10;

// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
$LOCAL_XML_FILENAME = "local_222440.xml";

if( !file_exists($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME does not exist. Please create a blank file named $LOCAL_XML_FILENAME.");
if( !is_writable($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME is not writable. Please set write permissions on $LOCAL_XML_FILENAME.");

if( filemtime($LOCAL_XML_FILENAME) < (time() - 3600) || filesize($LOCAL_XML_FILENAME) < 20) {
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : "";
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
tla_updateLocalXML("http://www.text-link-ads.com/xml.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&referer=" . urlencode($request_uri) . "&user_agent=" . urlencode($user_agent), $LOCAL_XML_FILENAME, $CONNECTION_TIMEOUT);
}

$xml = tla_getLocalXML($LOCAL_XML_FILENAME);

$arr_xml = tla_decodeXML($xml);

if ( is_array($arr_xml) ) {
echo "\n

    \n";
    for ($i = 0; $i < count($arr_xml['URL']); $i++) {
    if( isset($arr_xml['PostID'][$i]) && $arr_xml['PostID'][$i] > 0 ) continue;
    echo "

  • ".$arr_xml['BeforeText'][$i]." ".$arr_xml['Text'][$i]." ".$arr_xml['AfterText'][$i]."
  • \n";
    }
    echo "

";
}

}

function tla_updateLocalXML($url, $file, $time_out)
{
if($handle = fopen($file, "a")){
fwrite($handle, "\n");
fclose($handle);
}
if($xml = file_get_contents_tla($url, $time_out)) {
$xml = substr($xml, strpos($xml,'

if ($handle = fopen($file, "w")) {
fwrite($handle, $xml);
fclose($handle);
}
}
}

function tla_getLocalXML($file)
{
$contents = "";
if($handle = fopen($file, "r")){
$contents = fread($handle, filesize($file)+1);
fclose($handle);
}
return $contents;
}

function file_get_contents_tla($url, $time_out)
{
$result = "";
$url = parse_url($url);

if ($handle = @fsockopen ($url["host"], 80)) {
if(function_exists("socket_set_timeout")) {
socket_set_timeout($handle,$time_out,0);
} else if(function_exists("stream_set_timeout")) {
stream_set_timeout($handle,$time_out,0);
}

fwrite ($handle, "GET $url[path]?$url[query] HTTP/1.0\r\nHost: $url[host]\r\nConnection: Close\r\n\r\n");
while (!feof($handle)) {
$result .= @fread($handle, 40960);
}
fclose($handle);
}

return $result;
}

function tla_decodeXML($xmlstg)
{

if( !function_exists('html_entity_decode') ){
function html_entity_decode($string)
{
// replace numeric entities
$string = preg_replace('~

code

741147 @ 02:54

<%@ Language=VBScript %>
<%
' Local file to store XML
' You must create a blank file named "local_222440.xml" in the same
' directory as this script. It MUST be writable by the web
' server. On unix you would CHMOD 666 the file. On Windows
' you will need to access your custom control panel to set
' the permissions or contact your hosting company.

Const ForReading = 1, ForWriting = 2

Dim LOCAL_XML_FILENAME, sourceFile, FSO

LOCAL_XML_FILENAME = server.MapPath("local_222440.xml")
sourceFile = "http://www.text-link-ads.com/xml.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&referer=" & Server.UrlEncode(Request.ServerVariables("HTTP_REFERER")) & "&user_agent=" & Server.UrlEncode(Request.ServerVariables("HTTP_USER_AGENT"))
Set FSO = server.createObject("Scripting.FileSystemObject")

' update local XML
Dim DateMod, MonthString, DayString, DateModFile, DateModLimit

DateMod = FSO.getFile(LOCAL_XML_FILENAME).DateLastModified

MonthString = Month(DateMod)
If (MonthString < 10) Then
MonthString = "0" & MonthString
End If

DayString = Day(DateMod)
If (DayString < 10) Then
DayString = "0" & DayString
End If

DateModFile = Year(DateMod) & "-" & MonthString & "-" & DayString & " " & Hour(DateMod) & ":" & Minute(DateMod) & ":" & Second(DateMod)

MonthString = Month(Date)
If (MonthString < 10) Then
MonthString = "0" & MonthString
End If

DayString = Day(Date)
If (DayString < 10) Then
DayString = "0" & DayString
End If

DateModLimit = Year(Date) & "-" & MonthString & "-" & DayString & " " & (Hour(Now)-1) & ":" & Minute(Now) & ":" & Second(Now)

Dim Contents, Result, xmlhttp, TextStream

' read local XML
Contents = ""
Set TextStream = FSO.OpenTextFile(LOCAL_XML_FILENAME, ForReading, False, -2)
Do While Not TextStream.AtEndOfStream
Contents = Contents & TextStream.ReadLine
Loop
TextStream.Close
Set TextStream = nothing

If (DateModFile < DateModLimit Or FSO.getFile(LOCAL_XML_FILENAME).size < 20) Then
' fetch remote XML
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "GET", sourceFile, False
xmlhttp.send ""
Result = xmlhttp.responseText
If (Result <> "") Then
Contents = Result
End If

' write new XML to local file
Set TextStream = FSO.OpenTextFile(LOCAL_XML_FILENAME, ForWriting, True)
TextStream.Write Contents
TextStream.Close
Set TextStream = nothing
End If

' parse local XML
Dim source
Set source = Server.CreateObject("Microsoft.XMLDOM")
source.async = false
source.loadXML(Contents)

' Output links
Dim objLst, i, numLinks, objLink, objLinkChildren, linkNode, URL, Text, BeforeText, AfterText

Set objLst = source.getElementsByTagName("Link")
numLinks = objLst.length - 1

Response.Write("

    ")
    For i = 0 To numLinks
    Set objLink = objLst.item(i)
    Set objLinkChildren = objLink.childNodes
    URL = ""
    Text = ""
    BeforeText = ""
    AfterText = ""

    For Each linkNode In objLinkChildren
    If linkNode.nodeName = "URL" Then
    URL = linkNode.text
    End If
    If linkNode.nodeName = "Text" Then
    Text = linkNode.text
    End If
    If linkNode.nodeName = "BeforeText" Then
    BeforeText = linkNode.text
    End If
    If linkNode.nodeName = "AfterText" Then
    AfterText = linkNode.text
    End If
    Next

    Response.Write("

  • " & BeforeText & " " & Text & " " & AfterText & "
  • ")
    Next
    Response.Write("

")

%>
http://www.text-link-ads.com/xml_blogger.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&feed=1
http://www.text-link-ads.com/xml_blogger.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&feed=2

function tla_ads() {

// Number of seconds before connection to XML times out
// (This can be left the way it is)
$CONNECTION_TIMEOUT = 10;

// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
$LOCAL_XML_FILENAME = "local_222440.xml";

if( !file_exists($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME does not exist. Please create a blank file named $LOCAL_XML_FILENAME.");
if( !is_writable($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME is not writable. Please set write permissions on $LOCAL_XML_FILENAME.");

if( filemtime($LOCAL_XML_FILENAME) < (time() - 3600) || filesize($LOCAL_XML_FILENAME) < 20) {
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : "";
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
tla_updateLocalXML("http://www.text-link-ads.com/xml.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&referer=" . urlencode($request_uri) . "&user_agent=" . urlencode($user_agent), $LOCAL_XML_FILENAME, $CONNECTION_TIMEOUT);
}

$xml = tla_getLocalXML($LOCAL_XML_FILENAME);

$arr_xml = tla_decodeXML($xml);

if ( is_array($arr_xml) ) {
echo "\n

    \n";
    for ($i = 0; $i < count($arr_xml['URL']); $i++) {
    if( isset($arr_xml['PostID'][$i]) && $arr_xml['PostID'][$i] > 0 ) continue;
    echo "
  • ".$arr_xml['BeforeText'][$i]." ".$arr_xml['Text'][$i]." ".$arr_xml['AfterText'][$i]."
  • \n";
    }
    echo "

";
}

}

function tla_updateLocalXML($url, $file, $time_out)
{
if($handle = fopen($file, "a")){
fwrite($handle, "\n");
fclose($handle);
}
if($xml = file_get_contents_tla($url, $time_out)) {
$xml = substr($xml, strpos($xml,'

if ($handle = fopen($file, "w")) {
fwrite($handle, $xml);
fclose($handle);
}
}
}

function tla_getLocalXML($file)
{
$contents = "";
if($handle = fopen($file, "r")){
$contents = fread($handle, filesize($file)+1);
fclose($handle);
}
return $contents;
}

function file_get_contents_tla($url, $time_out)
{
$result = "";
$url = parse_url($url);

if ($handle = @fsockopen ($url["host"], 80)) {
if(function_exists("socket_set_timeout")) {
socket_set_timeout($handle,$time_out,0);
} else if(function_exists("stream_set_timeout")) {
stream_set_timeout($handle,$time_out,0);
}

fwrite ($handle, "GET $url[path]?$url[query] HTTP/1.0\r\nHost: $url[host]\r\nConnection: Close\r\n\r\n");
while (!feof($handle)) {
$result .= @fread($handle, 40960);
}
fclose($handle);
}

return $result;
}

function tla_decodeXML($xmlstg)
{

if( !function_exists('html_entity_decode') ){
function html_entity_decode($string)
{
// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr(\1)', $string);
// replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
}

$out = "";
$retarr = "";

preg_match_all ("/<(.*?)>(.*?) $search_ar = array('<', '>', '"');
$replace_ar = array('<', '>', '"');
$n = 0;
while (isset($out[$n]))
{
$retarr[$out[$n][1]][] = str_replace($search_ar, $replace_ar,html_entity_decode(strip_tags($out[$n][0])));
$n++;
}
return $retarr;
}

tla_ads();

?><%@ page import="java.net.*"%>
<%@ page import="java.io.*"%>
<%@ page import="javax.xml.parsers.DocumentBuilderFactory"%>
<%@ page import="javax.xml.parsers.ParserConfigurationException"%>
<%@ page import="org.xml.sax.SAXException"%>
<%@ page import="org.w3c.dom.*"%>
<%@ page import="java.util.*"%>
<%!
// The following code was graciously provided by Armond Avanes (http://www.armondavanes.com)

private String tla_ads( HttpServletRequest request, HttpServletResponse response ) throws IOException, ParserConfigurationException, SAXException
{
// Number of seconds before connection to XML times out
// (This can be left the way it is)
int CONNECTION_TIMEOUT = 10;

// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
String LOCAL_XML_FILENAME = "local_222440.xml";
String INVENTORY_KEY = "DOCTPCM94J4OHJ8XBHZG";

File localXmlFile = new File( getServletConfig().getServletContext().getRealPath(LOCAL_XML_FILENAME ) );

if( !localXmlFile.exists() ) {
return( "Script error: " + localXmlFile.getName() + " does not exist. Please create a blank file named " + localXmlFile.getName() + "." );
}
if( !localXmlFile.canWrite() ) {
return( "Script error: " + localXmlFile.getName() + " is not writable. Please set write permissions on " + localXmlFile.getName() + "." );
}

if( localXmlFile.lastModified()<(new Date().getTime() - 3600*1000) || localXmlFile.length()<20 ) {
String request_uri = (request.getRequestURI()!=null) ? request.getRequestURI() : "";
String user_agent = (request.getHeader("User-Agent")!=null) ? request.getHeader("User-Agent") : "";
URL url = new URL("http://www.text-link-ads.com/xml.php?inventory_key=" + INVENTORY_KEY + "&referer=" + response.encodeURL( request_uri ) + "&user_agent=" + response.encodeURL( user_agent ));

tla_updateLocalXML(url, localXmlFile, CONNECTION_TIMEOUT);
}

Map[] arr_xml = tla_decodeXML(localXmlFile );
StringBuffer sb = new StringBuffer();

if( arr_xml!=null && arr_xml.length>0 ) {
sb.append( "\n

    \n" );
    for( int i=0; i Map map = arr_xml[i];

    sb.append( "

  • " );
    sb.append( map.get("BeforeText") );
    sb.append( " " + map.get("Text") + " " );
    sb.append( map.get("AfterText") + "
  • \n" );
    }
    sb.append("

");
}

return sb.toString();
}

private void tla_updateLocalXML(URL url, File file, int time_out) throws IOException
{
file.setLastModified( new Date().getTime() );

String xml = file_get_contents_tla(url, time_out);

if( xml!=null && !xml.trim().equals("") ) {
FileWriter fw = new FileWriter(file);

fw.write( xml );
fw.close();
}
}

private String file_get_contents_tla(URL url, int time_out) throws IOException
{
URLConnection urlConnection = url.openConnection();

//urlConnection.setConnectTimeout( time_out * 1000 );
//urlConnection.setReadTimeout( time_out * 1000 );

InputStream is = urlConnection.getInputStream();
StringBuffer content = new StringBuffer();
int ch;

while( (ch=is.read())!=-1 )
content.append( (char)ch );

is.close();
return content.toString();
}

private Map[] tla_decodeXML(File file) throws ParserConfigurationException, IOException, SAXException
{
Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse( file );
Node linksRoot = dom.getFirstChild();
NodeList links = linksRoot.getChildNodes();
List result = new ArrayList();

for( int i=0; i
{
Node link = links.item(i);

if( link.getNodeType()==Node.TEXT_NODE )
continue;

NodeList linkAttributes = link.getChildNodes();
Map map = new HashMap();

for( int j=0; j {
Node linkAttr = linkAttributes.item(j);
Text textNode = (Text)linkAttr.getFirstChild();
String value = ( textNode!=null ) ? textNode.getNodeValue().trim() : "";

map.put( linkAttr.getNodeName(), value );
}
result.add(map);
}

return (Map[])result.toArray( new Map[0] );
}
%>
<%= tla_ads(request, response) %>

function tla_ads() {

// Number of seconds before connection to XML times out
// (This can be left the way it is)
$CONNECTION_TIMEOUT = 10;

// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
$LOCAL_XML_FILENAME = "local_222440.xml";

if( !file_exists($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME does not exist. Please create a blank file named $LOCAL_XML_FILENAME.");
if( !is_writable($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME is not writable. Please set write permissions on $LOCAL_XML_FILENAME.");

if( filemtime($LOCAL_XML_FILENAME) < (time() - 3600) || filesize($LOCAL_XML_FILENAME) < 20) {
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : "";
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
tla_updateLocalXML("http://www.text-link-ads.com/xml.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&referer=" . urlencode($request_uri) . "&user_agent=" . urlencode($user_agent), $LOCAL_XML_FILENAME, $CONNECTION_TIMEOUT);
}

$xml = tla_getLocalXML($LOCAL_XML_FILENAME);

$arr_xml = tla_decodeXML($xml);

if ( is_array($arr_xml) ) {
echo "\n

    \n";
    for ($i = 0; $i < count($arr_xml['URL']); $i++) {
    if( isset($arr_xml['PostID'][$i]) && $arr_xml['PostID'][$i] > 0 ) continue;
    echo "
  • ".$arr_xml['BeforeText'][$i]." ".$arr_xml['Text'][$i]." ".$arr_xml['AfterText'][$i]."
  • \n";
    }
    echo "

";
}

}

function tla_updateLocalXML($url, $file, $time_out)
{
if($handle = fopen($file, "a")){
fwrite($handle, "\n");
fclose($handle);
}
if($xml = file_get_contents_tla($url, $time_out)) {
$xml = substr($xml, strpos($xml,'

if ($handle = fopen($file, "w")) {
fwrite($handle, $xml);
fclose($handle);
}
}
}

function tla_getLocalXML($file)
{
$contents = "";
if($handle = fopen($file, "r")){
$contents = fread($handle, filesize($file)+1);
fclose($handle);
}
return $contents;
}

function file_get_contents_tla($url, $time_out)
{
$result = "";
$url = parse_url($url);

if ($handle = @fsockopen ($url["host"], 80)) {
if(function_exists("socket_set_timeout")) {
socket_set_timeout($handle,$time_out,0);
} else if(function_exists("stream_set_timeout")) {
stream_set_timeout($handle,$time_out,0);
}

fwrite ($handle, "GET $url[path]?$url[query] HTTP/1.0\r\nHost: $url[host]\r\nConnection: Close\r\n\r\n");
while (!feof($handle)) {
$result .= @fread($handle, 40960);
}
fclose($handle);
}

return $result;
}

function tla_decodeXML($xmlstg)
{

if( !function_exists('html_entity_decode') ){
function html_entity_decode($string)
{
// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr(\1)', $string);
// replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
}

$out = "";
$retarr = "";

preg_match_all ("/<(.*?)>(.*?) $search_ar = array('<', '>', '"');
$replace_ar = array('<', '>', '"');
$n = 0;
while (isset($out[$n]))
{
$retarr[$out[$n][1]][] = str_replace($search_ar, $replace_ar,html_entity_decode(strip_tags($out[$n][0])));
$n++;
}
return $retarr;
}

tla_ads();

?>use CGI;
use XML::Simple;
use LWP::Simple;
use Data::Dumper;
use URI::Escape;

my $page = new CGI;
print $page->header( "text/html" );

# Local file to store XML
# You must create a blank file with this name in the same
# directory as this script. It MUST be writable by the web
# server. On unix you would CHMOD 666 the file. On Windows
# you will need to access your custom control panel to set
# the permissions or contact your hosting company.
my $LOCAL_XML_FILENAME = "local_222440.xml";

# update XML file
my ($file_size,$file_mod) = (stat ($LOCAL_XML_FILENAME) )[7,9];

if(($file_mod < time - 3600) || $file_size < 20){
$now = time;
utime $now, $now, ($LOCAL_XML_FILENAME);
my $xml = get("http://www.text-link-ads.com/xml.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&referer=" . uri_escape($ENV{HTTP_REFERER}) . "&user_agent=" . uri_escape($ENV{HTTP_USER_AGENT}));
if($xml){
open (CACHE, "> $LOCAL_XML_FILENAME");
print CACHE $xml;
close(CACHE);
}
}

# create object
my $xml = new XML::Simple;

# read local XML file
my $data = $xml->XMLin($LOCAL_XML_FILENAME);

if ($data->{'Link'}) {

if(ref $data->{'Link'} eq "HASH"){
@$temp = ($data->{'Link'});
$data->{'Link'} = $temp;
}

if ($data->{'Link'}->[0]) {
print "\n

    \n";
    my $count = 0;
    while ($data->{'Link'}->[$count]) {
    print "
  • " . (( ref $data->{'Link'}->[$count]->{'BeforeText'} eq "HASH") ? "" : $data->{'Link'}->[$count]->{'BeforeText'} ) . " {'Link'}->[$count]->{'URL'}\">$data->{'Link'}->[$count]->{'Text'} " . (( ref $data->{'Link'}->[$count]->{'AfterText'} eq "HASH") ? "" : $data->{'Link'}->[$count]->{'AfterText'} ) . "
  • ";
    $count++;
    }
    print "

";
}
}

function tla_ads() {

// Number of seconds before connection to XML times out
// (This can be left the way it is)
$CONNECTION_TIMEOUT = 10;

// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
$LOCAL_XML_FILENAME = "local_222440.xml";

if( !file_exists($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME does not exist. Please create a blank file named $LOCAL_XML_FILENAME.");
if( !is_writable($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME is not writable. Please set write permissions on $LOCAL_XML_FILENAME.");

if( filemtime($LOCAL_XML_FILENAME) < (time() - 3600) || filesize($LOCAL_XML_FILENAME) < 20) {
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : "";
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
tla_updateLocalXML("http://www.text-link-ads.com/xml.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&referer=" . urlencode($request_uri) . "&user_agent=" . urlencode($user_agent), $LOCAL_XML_FILENAME, $CONNECTION_TIMEOUT);
}

$xml = tla_getLocalXML($LOCAL_XML_FILENAME);

$arr_xml = tla_decodeXML($xml);

if ( is_array($arr_xml) ) {
echo "\n

    \n";
    for ($i = 0; $i < count($arr_xml['URL']); $i++) {
    if( isset($arr_xml['PostID'][$i]) && $arr_xml['PostID'][$i] > 0 ) continue;
    echo "
  • ".$arr_xml['BeforeText'][$i]." ".$arr_xml['Text'][$i]." ".$arr_xml['AfterText'][$i]."
  • \n";
    }
    echo "

";
}

}

function tla_updateLocalXML($url, $file, $time_out)
{
if($handle = fopen($file, "a")){
fwrite($handle, "\n");
fclose($handle);
}
if($xml = file_get_contents_tla($url, $time_out)) {
$xml = substr($xml, strpos($xml,'

if ($handle = fopen($file, "w")) {
fwrite($handle, $xml);
fclose($handle);
}
}
}

function tla_getLocalXML($file)
{
$contents = "";
if($handle = fopen($file, "r")){
$contents = fread($handle, filesize($file)+1);
fclose($handle);
}
return $contents;
}

function file_get_contents_tla($url, $time_out)
{
$result = "";
$url = parse_url($url);

if ($handle = @fsockopen ($url["host"], 80)) {
if(function_exists("socket_set_timeout")) {
socket_set_timeout($handle,$time_out,0);
} else if(function_exists("stream_set_timeout")) {
stream_set_timeout($handle,$time_out,0);
}

fwrite ($handle, "GET $url[path]?$url[query] HTTP/1.0\r\nHost: $url[host]\r\nConnection: Close\r\n\r\n");
while (!feof($handle)) {
$result .= @fread($handle, 40960);
}
fclose($handle);
}

return $result;
}

function tla_decodeXML($xmlstg)
{

if( !function_exists('html_entity_decode') ){
function html_entity_decode($string)
{
// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr(\1)', $string);
// replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
}

$out = "";
$retarr = "";

preg_match_all ("/<(.*?)>(.*?) $search_ar = array('<', '>', '"');
$replace_ar = array('<', '>', '"');
$n = 0;
while (isset($out[$n]))
{
$retarr[$out[$n][1]][] = str_replace($search_ar, $replace_ar,html_entity_decode(strip_tags($out[$n][0])));
$n++;
}
return $retarr;
}

tla_ads();

?>function tla_ads() {

// Number of seconds before connection to XML times out
// (This can be left the way it is)
$CONNECTION_TIMEOUT = 10;

// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
$LOCAL_XML_FILENAME = "local_222440.xml";

if( !file_exists($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME does not exist. Please create a blank file named $LOCAL_XML_FILENAME.");
if( !is_writable($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME is not writable. Please set write permissions on $LOCAL_XML_FILENAME.");

if( filemtime($LOCAL_XML_FILENAME) < (time() - 3600) || filesize($LOCAL_XML_FILENAME) < 20) {
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : "";
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
tla_updateLocalXML("http://www.text-link-ads.com/xml.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&referer=" . urlencode($request_uri) . "&user_agent=" . urlencode($user_agent), $LOCAL_XML_FILENAME, $CONNECTION_TIMEOUT);
}

$xml = tla_getLocalXML($LOCAL_XML_FILENAME);

$arr_xml = tla_decodeXML($xml);

if ( is_array($arr_xml) ) {
echo "\n

    \n";
    for ($i = 0; $i < count($arr_xml['URL']); $i++) {
    if( isset($arr_xml['PostID'][$i]) && $arr_xml['PostID'][$i] > 0 ) continue;
    echo "
  • ".$arr_xml['BeforeText'][$i]." ".$arr_xml['Text'][$i]." ".$arr_xml['AfterText'][$i]."
  • \n";
    }
    echo "

";
}

}

function tla_updateLocalXML($url, $file, $time_out)
{
if($handle = fopen($file, "a")){
fwrite($handle, "\n");
fclose($handle);
}
if($xml = file_get_contents_tla($url, $time_out)) {
$xml = substr($xml, strpos($xml,'

if ($handle = fopen($file, "w")) {
fwrite($handle, $xml);
fclose($handle);
}
}
}

function tla_getLocalXML($file)
{
$contents = "";
if($handle = fopen($file, "r")){
$contents = fread($handle, filesize($file)+1);
fclose($handle);
}
return $contents;
}

function file_get_contents_tla($url, $time_out)
{
$result = "";
$url = parse_url($url);

if ($handle = @fsockopen ($url["host"], 80)) {
if(function_exists("socket_set_timeout")) {
socket_set_timeout($handle,$time_out,0);
} else if(function_exists("stream_set_timeout")) {
stream_set_timeout($handle,$time_out,0);
}

fwrite ($handle, "GET $url[path]?$url[query] HTTP/1.0\r\nHost: $url[host]\r\nConnection: Close\r\n\r\n");
while (!feof($handle)) {
$result .= @fread($handle, 40960);
}
fclose($handle);
}

return $result;
}

function tla_decodeXML($xmlstg)
{

if( !function_exists('html_entity_decode') ){
function html_entity_decode($string)
{
// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr(\1)', $string);
// replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
}

$out = "";
$retarr = "";

preg_match_all ("/<(.*?)>(.*?) $search_ar = array('<', '>', '"');
$replace_ar = array('<', '>', '"');
$n = 0;
while (isset($out[$n]))
{
$retarr[$out[$n][1]][] = str_replace($search_ar, $replace_ar,html_entity_decode(strip_tags($out[$n][0])));
$n++;
}
return $retarr;
}

tla_ads();require 'net/http'
require 'cgi'

def content
response.lifetime = 6.hour
url = "http://www.text-link-ads.com/xml.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&referer="+CGI::escape(@requester.env['REQUEST_URI'])
agent = "&user_agent="+CGI::escape(@requester.env['HTTP_USER_AGENT'])
url_time, url_data = fragment_key(url)

#is it time to update the cache?
time = read_fragment(url_time)
if (time == nil) || (time.to_time < Time.now)
@links = requester(url+agent) rescue nil
#if we can get the latest, then update the cache
if @links != nil
expire_fragment(url_time)
expire_fragment(url_data)
write_fragment(url_time, Time.now+6.hour)
write_fragment(url_data, @links)
else
#otherwise try again in 1 hour
write_fragment(url_time, Time.now+1.hour)
@links = read_fragment(url_data)
end
else
#use the cache
@links = read_fragment(url_data)
end
end

def requester(url)
XmlSimple.xml_in (http_get(url))
end

def http_get(url)
Net::HTTP.get_response(URI.parse(url)).body.to_s
end

def fragment_key(name)
return "TLA/TIME/#{name}", "TLA/DATA/#{name}"
end

// Probe for a language include with constants. Still include defines later on, if some constants were missing
$probelang = dirname(__FILE__) . '/' . $serendipity['charset'] . 'lang_' . $serendipity['lang'] . '.inc.php';
if (file_exists($probelang)) {
include $probelang;
}

include_once dirname(__FILE__) . '/lang_en.inc.php';

@define('PLUGIN_EVENT_TEXTLINKADS_TITLE', 'TextLinkAds.com Ads');
@define('PLUGIN_EVENT_TEXTLINKADS_DESC', 'Embeds TextLinkAds.com advertisements into your page. You need to edit the Smarty .tpl file of your template to indicate where the ad should be placed, otherwise it will not appear on your site. Use this Smarty code to place the Ad: {serendipity_hookPlugin hook="external_service_tla" hookAll="true"}');
@define('PLUGIN_EVENT_TEXTLINKADS_HTMLID', '222440');
@define('PLUGIN_EVENT_TEXTLINKADS_XMLFILENAME', 'local_222440.xml');

class serendipity_event_textlinkads extends serendipity_event
{
var $title = PLUGIN_EVENT_TEXTLINKADS_TITLE;

function introspect(&$propbag) {
global $serendipity;

$propbag->add('name', PLUGIN_EVENT_TEXTLINKADS_TITLE);
$propbag->add('description', PLUGIN_EVENT_TEXTLINKADS_DESC);
$propbag->add('stackable', true);
$propbag->add('author', 'Garvin Hicking');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
'php' => '4.1.0'
));
$propbag->add('groups', array('EXTERNAL_SERVICES'));
$propbag->add('version', '0.9');
$propbag->add('configuration', array('htmlid', 'xmlfilename'));
$propbag->add('event_hooks', array(
'css' => true,
'external_service_tla' => true
));
}

function introspect_config_item($name, &$propbag) {
switch($name) {
case 'htmlid':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_TEXTLINKADS_HTMLID);
$propbag->add('description', '');
$propbag->add('default', '222440');
break;

case 'xmlfilename':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_TEXTLINKADS_XMLFILENAME);
$propbag->add('description', '');
$propbag->add('default', 'local_222440.xml');
break;

default:
return false;
}
return true;
}

/* BEGIN FOREIGN CODE */
function tla_ads() {
global $serendipity;

// Number of seconds before connection to XML times out
// (This can be left the way it is)
$CONNECTION_TIMEOUT = 10;

// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
$LOCAL_XML_FILENAME = $serendipity['serendipityPath'] . $this->get_config('xmlfilename');

if (!file_exists($LOCAL_XML_FILENAME)) {
echo "Script error: $LOCAL_XML_FILENAME does not exist. Please create a blank file named $LOCAL_XML_FILENAME.";
return false;
}

if (!is_writable($LOCAL_XML_FILENAME)) {
echo "Script error: $LOCAL_XML_FILENAME is not writable. Please set write permissions on $LOCAL_XML_FILENAME.";
return false;
}

if (filemtime($LOCAL_XML_FILENAME) < (time() - 3600) || filesize($LOCAL_XML_FILENAME) < 20) {
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : "";
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
$this->tla_updateLocalXML("http://www.text-link-ads.com/xml.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&referer=" . urlencode($request_uri) . "&user_agent=" . urlencode($user_agent), $LOCAL_XML_FILENAME, $CONNECTION_TIMEOUT);
}

$xml = $this->tla_getLocalXML($LOCAL_XML_FILENAME);
$arr_xml = $this->tla_decodeXML($xml);

if (!is_array($arr_xml)) {
return false;
}
echo "\n

    \n";

    for ($i = 0, $maxi = count($arr_xml['URL']); $i < $maxi; $i++) {
    echo "

  • " . $arr_xml['BeforeText'][$i] . " " . $arr_xml['Text'][$i] . " "
    . $arr_xml['AfterText'][$i] . "
  • \n";
    }

    echo "

";
}

function tla_updateLocalXML($url, $file, $time_out) {
if ($handle = fopen($file, "a")) {
fwrite($handle, "\n");
fclose($handle);
}

if ($xml = $this->file_get_contents_tla($url, $time_out)) {
$xml = substr($xml, strpos($xml, '

if ($handle = fopen($file, "w")) {
fwrite($handle, $xml);
fclose($handle);
}
}
}

function tla_getLocalXML($file) {
$contents = "";
if ($handle = fopen($file, "r")){
$contents = fread($handle, filesize($file)+1);
fclose($handle);
}

return $contents;
}

function file_get_contents_tla($url, $time_out) {
$result = "";
$url = parse_url($url);

if ($handle = @fsockopen ($url["host"], 80)) {
if (function_exists("socket_set_timeout")) {
socket_set_timeout($handle,$time_out,0);
} else if(function_exists("stream_set_timeout")) {
stream_set_timeout($handle,$time_out,0);
}

fwrite ($handle, "GET $url[path]?$url[query] HTTP/1.0\r\nHost: $url[host]\r\nConnection: Close\r\n\r\n");
while (!feof($handle)) {
$result .= @fread($handle, 40960);
}
fclose($handle);
}

return $result;
}

function html_entity_decode($string) {
if (function_exists('html_entity_decode')) {
return html_entity_decode($string);
}

// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr(\1)', $string);
// replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}

function tla_decodeXML($xmlstg) {
$out = "";
$retarr = "";

preg_match_all ("/<(.*?)>(.*?) $search_ar = array('<', '>', '"');
$replace_ar = array('<', '>', '"');
$n = 0;

while (isset($out[$n])) {
$retarr[$out[$n][1]][] = str_replace($search_ar, $replace_ar, $this->html_entity_decode(strip_tags($out[$n][0])));
$n++;
}

return $retarr;
}
/* END FOREIGN CODE */

function generate_content(&$title) {
$title = $this->title;
}

function event_hook($event, &$bag, &$eventData, $addData = null) {
global $serendipity;

$hooks = &$bag->get('event_hooks');

if (isset($hooks[$event])) {
switch($event) {
case 'css':
$id = $this->get_config('htmlid');
return true;
break;

case 'external_service_tla':
$this->tla_ads();
return true;
break;

default:
return false;
break;
}
} else {
return false;
}
}
}
{serendipity_hookPlugin hook="external_service_tla" hookAll="true"}
function tla_ads() {

// Number of seconds before connection to XML times out
// (This can be left the way it is)
$CONNECTION_TIMEOUT = 10;

// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
$LOCAL_XML_FILENAME = "local_222440.xml";

if( !file_exists($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME does not exist. Please create a blank file named $LOCAL_XML_FILENAME.");
if( !is_writable($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME is not writable. Please set write permissions on $LOCAL_XML_FILENAME.");

if( filemtime($LOCAL_XML_FILENAME) < (time() - 3600) || filesize($LOCAL_XML_FILENAME) < 20) {
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : "";
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
tla_updateLocalXML("http://www.text-link-ads.com/xml.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&referer=" . urlencode($request_uri) . "&user_agent=" . urlencode($user_agent), $LOCAL_XML_FILENAME, $CONNECTION_TIMEOUT);
}

$xml = tla_getLocalXML($LOCAL_XML_FILENAME);

$arr_xml = tla_decodeXML($xml);

if ( is_array($arr_xml) ) {
echo "\n

    \n";
    for ($i = 0; $i < count($arr_xml['URL']); $i++) {
    if( isset($arr_xml['PostID'][$i]) && $arr_xml['PostID'][$i] > 0 ) continue;
    echo "
  • ".$arr_xml['BeforeText'][$i]." ".$arr_xml['Text'][$i]." ".$arr_xml['AfterText'][$i]."
  • \n";
    }
    echo "

";
}

}

function tla_updateLocalXML($url, $file, $time_out)
{
if($handle = fopen($file, "a")){
fwrite($handle, "\n");
fclose($handle);
}
if($xml = file_get_contents_tla($url, $time_out)) {
$xml = substr($xml, strpos($xml,'

if ($handle = fopen($file, "w")) {
fwrite($handle, $xml);
fclose($handle);
}
}
}

function tla_getLocalXML($file)
{
$contents = "";
if($handle = fopen($file, "r")){
$contents = fread($handle, filesize($file)+1);
fclose($handle);
}
return $contents;
}

function file_get_contents_tla($url, $time_out)
{
$result = "";
$url = parse_url($url);

if ($handle = @fsockopen ($url["host"], 80)) {
if(function_exists("socket_set_timeout")) {
socket_set_timeout($handle,$time_out,0);
} else if(function_exists("stream_set_timeout")) {
stream_set_timeout($handle,$time_out,0);
}

fwrite ($handle, "GET $url[path]?$url[query] HTTP/1.0\r\nHost: $url[host]\r\nConnection: Close\r\n\r\n");
while (!feof($handle)) {
$result .= @fread($handle, 40960);
}
fclose($handle);
}

return $result;
}

function tla_decodeXML($xmlstg)
{

if( !function_exists('html_entity_decode') ){
function html_entity_decode($string)
{
// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr(\1)', $string);
// replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
}

$out = "";
$retarr = "";

preg_match_all ("/<(.*?)>(.*?) $search_ar = array('<', '>', '"');
$replace_ar = array('<', '>', '"');
$n = 0;
while (isset($out[$n]))
{
$retarr[$out[$n][1]][] = str_replace($search_ar, $replace_ar,html_entity_decode(strip_tags($out[$n][0])));
$n++;
}
return $retarr;
}

ob_start();
tla_ads();
$tla_ads = ob_get_contents();
ob_end_clean();

function tla_ads() {

// Number of seconds before connection to XML times out
// (This can be left the way it is)
$CONNECTION_TIMEOUT = 10;

// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
$LOCAL_XML_FILENAME = "local_222440.xml";

if( !file_exists($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME does not exist. Please create a blank file named $LOCAL_XML_FILENAME.");
if( !is_writable($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME is not writable. Please set write permissions on $LOCAL_XML_FILENAME.");

if( filemtime($LOCAL_XML_FILENAME) < (time() - 3600) || filesize($LOCAL_XML_FILENAME) < 20) {
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : "";
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
tla_updateLocalXML("http://www.text-link-ads.com/xml.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&referer=" . urlencode($request_uri) . "&user_agent=" . urlencode($user_agent), $LOCAL_XML_FILENAME, $CONNECTION_TIMEOUT);
}

$xml = tla_getLocalXML($LOCAL_XML_FILENAME);

$arr_xml = tla_decodeXML($xml);

if ( is_array($arr_xml) ) {
echo "\n

    \n";
    for ($i = 0; $i < count($arr_xml['URL']); $i++) {
    if( isset($arr_xml['PostID'][$i]) && $arr_xml['PostID'][$i] > 0 ) continue;
    echo "
  • ".$arr_xml['BeforeText'][$i]." ".$arr_xml['Text'][$i]." ".$arr_xml['AfterText'][$i]."
  • \n";
    }
    echo "

";
}

}

function tla_updateLocalXML($url, $file, $time_out)
{
if($handle = fopen($file, "a")){
fwrite($handle, "\n");
fclose($handle);
}
if($xml = file_get_contents_tla($url, $time_out)) {
$xml = substr($xml, strpos($xml,'

if ($handle = fopen($file, "w")) {
fwrite($handle, $xml);
fclose($handle);
}
}
}

function tla_getLocalXML($file)
{
$contents = "";
if($handle = fopen($file, "r")){
$contents = fread($handle, filesize($file)+1);
fclose($handle);
}
return $contents;
}

function file_get_contents_tla($url, $time_out)
{
$result = "";
$url = parse_url($url);

if ($handle = @fsockopen ($url["host"], 80)) {
if(function_exists("socket_set_timeout")) {
socket_set_timeout($handle,$time_out,0);
} else if(function_exists("stream_set_timeout")) {
stream_set_timeout($handle,$time_out,0);
}

fwrite ($handle, "GET $url[path]?$url[query] HTTP/1.0\r\nHost: $url[host]\r\nConnection: Close\r\n\r\n");
while (!feof($handle)) {
$result .= @fread($handle, 40960);
}
fclose($handle);
}

return $result;
}

function tla_decodeXML($xmlstg)
{

if( !function_exists('html_entity_decode') ){
function html_entity_decode($string)
{
// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr(\1)', $string);
// replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
}

$out = "";
$retarr = "";

preg_match_all ("/<(.*?)>(.*?) $search_ar = array('<', '>', '"');
$replace_ar = array('<', '>', '"');
$n = 0;
while (isset($out[$n]))
{
$retarr[$out[$n][1]][] = str_replace($search_ar, $replace_ar,html_entity_decode(strip_tags($out[$n][0])));
$n++;
}
return $retarr;
}

ob_start();
tla_ads();
$tla_ads = ob_get_contents();
ob_end_clean();

function tla_ads() {

// Number of seconds before connection to XML times out
// (This can be left the way it is)
$CONNECTION_TIMEOUT = 10;

// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
$LOCAL_XML_FILENAME = "local_222440.xml";

if( !file_exists($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME does not exist. Please create a blank file named $LOCAL_XML_FILENAME.");
if( !is_writable($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME is not writable. Please set write permissions on $LOCAL_XML_FILENAME.");

if( filemtime($LOCAL_XML_FILENAME) < (time() - 3600) || filesize($LOCAL_XML_FILENAME) < 20) {
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : "";
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
tla_updateLocalXML("http://www.text-link-ads.com/xml.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&referer=" . urlencode($request_uri) . "&user_agent=" . urlencode($user_agent), $LOCAL_XML_FILENAME, $CONNECTION_TIMEOUT);
}

$xml = tla_getLocalXML($LOCAL_XML_FILENAME);

$arr_xml = tla_decodeXML($xml);

if ( is_array($arr_xml) ) {
echo "\n

    \n";
    for ($i = 0; $i < count($arr_xml['URL']); $i++) {
    if( isset($arr_xml['PostID'][$i]) && $arr_xml['PostID'][$i] > 0 ) continue;
    echo "
  • ".$arr_xml['BeforeText'][$i]." ".$arr_xml['Text'][$i]." ".$arr_xml['AfterText'][$i]."
  • \n";
    }
    echo "

";
}

}

function tla_updateLocalXML($url, $file, $time_out)
{
if($handle = fopen($file, "a")){
fwrite($handle, "\n");
fclose($handle);
}
if($xml = file_get_contents_tla($url, $time_out)) {
$xml = substr($xml, strpos($xml,'

if ($handle = fopen($file, "w")) {
fwrite($handle, $xml);
fclose($handle);
}
}
}

function tla_getLocalXML($file)
{
$contents = "";
if($handle = fopen($file, "r")){
$contents = fread($handle, filesize($file)+1);
fclose($handle);
}
return $contents;
}

function file_get_contents_tla($url, $time_out)
{
$result = "";
$url = parse_url($url);

if ($handle = @fsockopen ($url["host"], 80)) {
if(function_exists("socket_set_timeout")) {
socket_set_timeout($handle,$time_out,0);
} else if(function_exists("stream_set_timeout")) {
stream_set_timeout($handle,$time_out,0);
}

fwrite ($handle, "GET $url[path]?$url[query] HTTP/1.0\r\nHost: $url[host]\r\nConnection: Close\r\n\r\n");
while (!feof($handle)) {
$result .= @fread($handle, 40960);
}
fclose($handle);
}

return $result;
}

function tla_decodeXML($xmlstg)
{

if( !function_exists('html_entity_decode') ){
function html_entity_decode($string)
{
// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr(\1)', $string);
// replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
}

$out = "";
$retarr = "";

preg_match_all ("/<(.*?)>(.*?) $search_ar = array('<', '>', '"');
$replace_ar = array('<', '>', '"');
$n = 0;
while (isset($out[$n]))
{
$retarr[$out[$n][1]][] = str_replace($search_ar, $replace_ar,html_entity_decode(strip_tags($out[$n][0])));
$n++;
}
return $retarr;
}

ob_start();
tla_ads();
$tla_ads = ob_get_contents();
ob_end_clean();

function tla_ads() {

// Number of seconds before connection to XML times out
// (This can be left the way it is)
$CONNECTION_TIMEOUT = 10;

// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
$LOCAL_XML_FILENAME = "local_222440.xml";

if( !file_exists($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME does not exist. Please create a blank file named $LOCAL_XML_FILENAME.");
if( !is_writable($LOCAL_XML_FILENAME) ) die("Script error: $LOCAL_XML_FILENAME is not writable. Please set write permissions on $LOCAL_XML_FILENAME.");

if( filemtime($LOCAL_XML_FILENAME) < (time() - 3600) || filesize($LOCAL_XML_FILENAME) < 20) {
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : "";
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
tla_updateLocalXML("http://www.text-link-ads.com/xml.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&referer=" . urlencode($request_uri) . "&user_agent=" . urlencode($user_agent), $LOCAL_XML_FILENAME, $CONNECTION_TIMEOUT);
}

$xml = tla_getLocalXML($LOCAL_XML_FILENAME);

$arr_xml = tla_decodeXML($xml);

if ( is_array($arr_xml) ) {
echo "\n

    \n";
    for ($i = 0; $i < count($arr_xml['URL']); $i++) {
    if( isset($arr_xml['PostID'][$i]) && $arr_xml['PostID'][$i] > 0 ) continue;
    echo "
  • ".$arr_xml['BeforeText'][$i]." ".$arr_xml['Text'][$i]." ".$arr_xml['AfterText'][$i]."
  • \n";
    }
    echo "

";
}

}

function tla_updateLocalXML($url, $file, $time_out)
{
if($handle = fopen($file, "a")){
fwrite($handle, "\n");
fclose($handle);
}
if($xml = file_get_contents_tla($url, $time_out)) {
$xml = substr($xml, strpos($xml,'

if ($handle = fopen($file, "w")) {
fwrite($handle, $xml);
fclose($handle);
}
}
}

function tla_getLocalXML($file)
{
$contents = "";
if($handle = fopen($file, "r")){
$contents = fread($handle, filesize($file)+1);
fclose($handle);
}
return $contents;
}

function file_get_contents_tla($url, $time_out)
{
$result = "";
$url = parse_url($url);

if ($handle = @fsockopen ($url["host"], 80)) {
if(function_exists("socket_set_timeout")) {
socket_set_timeout($handle,$time_out,0);
} else if(function_exists("stream_set_timeout")) {
stream_set_timeout($handle,$time_out,0);
}

fwrite ($handle, "GET $url[path]?$url[query] HTTP/1.0\r\nHost: $url[host]\r\nConnection: Close\r\n\r\n");
while (!feof($handle)) {
$result .= @fread($handle, 40960);
}
fclose($handle);
}

return $result;
}

function tla_decodeXML($xmlstg)
{

if( !function_exists('html_entity_decode') ){
function html_entity_decode($string)
{
// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr(\1)', $string);
// replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
}

$out = "";
$retarr = "";

preg_match_all ("/<(.*?)>(.*?) $search_ar = array('<', '>', '"');
$replace_ar = array('<', '>', '"');
$n = 0;
while (isset($out[$n]))
{
$retarr[$out[$n][1]][] = str_replace($search_ar, $replace_ar,html_entity_decode(strip_tags($out[$n][0])));
$n++;
}
return $retarr;
}

ob_start();
tla_ads();
$tla_ads = ob_get_contents();
ob_end_clean();

24/04/2008 GMT 1

text-lik-ads

741147 @ 02:57

http://www.text-link-ads.com/xml_blogger.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&amp;feed=1http://www.text-link-ads.com/xml_blogger.php?inventory_key=DOCTPCM94J4OHJ8XBHZG&feed=2

text-link-ads ให้เงินจริงล้านเปอร์

741147 @ 02:34

ใครเป็นสอนทำ text-link-ads ที

741147 @ 02:23

20/04/2008 GMT 1

โปรโมตเว็บฟรี

741147 @ 07:26

คลิกเลยครับพี่น้องรวมสุดยอดการโปรโมตเว็บ ที่ใครก็ทำได้แบบง่ายๆ

และฟรีๆ

http://tteen.igetweb.com/index.php?mo=3&amp;art=127632

โฆษณา,โฆษณาออนไลน์,การโฆษณา,สื่อโฆษณา,การตลาด,บริษัทโฆษณา,ประชาสัมพันธ์,ลงโฆษณา,ประกาศ,ออนไลน์,online,online advertising,advertising,โปรโมทสินค้า,โปรโมทเว็บไซต์,promote website,seo,pay per click,ad per click,media,ค้นหาเว็บ,media,สื่อ

โฆษณา,โฆษณาออนไลน์,การโฆษณา,สื่อโฆษณา,การตลาด,บริษัทโฆษณา,ประชาสัมพันธ์,ลงโฆษณา,ประกาศ,ออนไลน์,online,online advertising,advertising,โปรโมทสินค้า,โปรโมทเว็บไซต์,promote website,seo,pay per click,ad per click,media,ค้นหาเว็บ,media,สื่อ

โฆษณา,โฆษณาออนไลน์,การโฆษณา,สื่อโฆษณา,การตลาด,บริษัทโฆษณา,ประชาสัมพันธ์,ลงโฆษณา,ประกาศ,ออนไลน์,online,online advertising,advertising,โปรโมทสินค้า,โปรโมทเว็บไซต์,promote website,seo,pay per click,ad per click,media,ค้นหาเว็บ,media,สื่อ

18/04/2008 GMT 1

งาน

741147 @ 09:54
ตำแหน่งงานประจำสัปดาห์
เลขที่ ตำแหน่ง ทำงานที่ วันที่
P061030 ผู้ควบคุม-ดูแล ฝ่ายยานพาหนะ (Siam Safari Nature Tours Co.,Ltd) ภูเก็ต 2008-04-18
P061018 พนักงานลูกค้าสัมพันธ์ / พนักงานจัดเรียงสินค้า(ประจำโลตัส พัทยา) ด่วนมาก!!! (บริษัท ดาต้าโปร บิวสิเนส จำกัด) ชลบุรี 2008-04-17
P061017 พนักงานลูกค้าสัมพันธ์ / พนักงานจัดเรียงสินค้า(ประจำโลตัส เกาะสมุย) ด่วนมาก!!! (บริษัท ดาต้าโปร บิวสิเนส จำกัด) สุราษฏร์ธานี 2008-04-17
P060943 ตัวแทนเยาวชนเพื่อแลกเปลี่ยนวัฒนธรรมในอเมริกาและยุโรป กับออแพร์ (ไทยและอเมริกัน คัลเชอรัลเอ็กซเชนจ์ จำกัด) กรุงเทพมหานคร 2008-04-08
P060176 พนักงานฝ่ายผลิตชาย (บริษัท สยาม รีไซคลิ่ง ซิสเทม จำกัด) ลำพูน 2008-04-18
P060175 ช่างเชื่อมMIG (บริษัท สยาม รีไซคลิ่ง ซิสเทม จำกัด) ลำพูน 2008-04-18
P060174 ช่างซ่อมบำรุง (บริษัท สยาม รีไซคลิ่ง ซิสเทม จำกัด) ลำพูน 2008-04-18
P060173 เจ้าหน้าที่บัญชี (บริษัท สยาม รีไซคลิ่ง ซิสเทม จำกัด) ลำพูน 2008-04-18
P060172 เจ้าหน้าที่ประจำสำนักงาน (บริษัท สยาม รีไซคลิ่ง ซิสเทม จำกัด) ลำพูน 2008-04-18
P060161 พนักงานขับรถผู้บริหาร (เพอร์เฟค รีซอร์สเซส (ประเทศไทย) จำกัด) กรุงเทพมหานคร 2008-04-18
P060139 เจ้าหน้าที่คลังสินค้า, บัญชี และcustomer service ประจำที่สาขาขอนแก่น (เพอร์เฟค รีซอร์สเซส (ประเทศไทย) จำกัด) ขอนแก่น 2008-04-17
P060138 แม่บ้าน (เพอร์เฟค รีซอร์สเซส (ประเทศไทย) จำกัด) กรุงเทพมหานคร 2008-04-17
P060111 พี่เลี้ยงเด็ก (โรงเรียนอนุบาลนานาชาติเซนต์ไมเคิล) กรุงเทพมหานคร 2008-04-17
P060097 เจ้าหน้าที่ Moniter Cell Site DTAC (บ. เจนเนอรัล ทรานสมิสชั่น เน็ทเวิร์ค จำกัด) กรุงเทพมหานคร 2008-04-10
P060085 Micro-lending Coordinator (Goodwill Group Foundation) กรุงเทพมหานคร 2008-04-09
P060055 เจ้าหน้าที่ควบคุมเครื่องเล่น (บริษัท ซีคอน ดีเวลลอปเมนท์ จำกัด (มหาชน)) กรุงเทพมหานคร 2008-04-09
P058805 พนักงานเติมน้ำมัน,แก๊ส NGV (บจก.วังศกาญจน์กิจ) กรุงเทพมหานคร 2008-04-18
P057459 ช่างทาสี (ก๊กมิ้งเฟอร์นิเจอร์) กรุงเทพมหานคร 2008-04-17
P055345 เจ้าหน้าที่สถิติประยุกต์ (โรงพยาบาลศรีวิชัย 2) กรุงเทพมหานคร 2008-04-04
P054793 Floor Supervisor (The Davis Bangkok Hotel) กรุงเทพมหานคร 2008-04-17

งานออนไลน์

741147 @ 04:26

วัดีก(ออนไลน์์)ั้ง

วันนี้กะเจ๋าจะมาสอนวิธีการหาเงินจากเว็บไซต์และบล็อกของพี่น้อง

ทั้งหลาย เพราะบางคนเพิ่งเข้าวงการนี้รวมทั้งกะเจ๋าอาจถูกหลอกได้

เพราะงานของบางเว็บโกหกทั้งเพทำเป็นปีก็ยังไม่ได้เงินซักแดง

วันนี้กพเจ๋าถึงหันมาหางานโฆษณาบนเว็บแทน มันก็คือเราขายพื้นที่บนเว็บ

ให้นายหน้าโฆษณา แล้วก็จะมีคนมาโฆษณากับเว็บเราเองโดยทเราไม่ต้อง

ไปหาเองให้เมื่อย งานพวกน้กะเจ๋าจะขอแนะนำพี่น้องอยู่ 2 เว็บ

คือ

1.text-link-ads

2.nipa

ซึ้งอันแรกดีกว่า แต่กะเจ๋าเฮ้ด บ่ เป็นงานนี้ต้องหาตามเว็บอื่นงานน้เค้าบอกว่าจะมีคน

ซื้อพื้นที่โฆษณาบนเว็บเราที่ครั้งละ 10 $+ ข้าเจ๋าอยากลองม๋ากมากแต่เอาโค๊ดลงเว็บ

ไม่เป็น

แต่ของนิภา อันที่ 2 นี่ลงง่ายโฆษณาหลายแบบ

แค่มีเว็บหรือบล็อก สมัครแล้วถ้าได้รับการอนุมัติ ก็ล็อกอินเอาโค๊ดลงเว็บได้เลย

งานนี้แจ่ม AdPerClick ของนิภา ถ้ามีคนคลิกโฆษณาเราก็จะได้ 0.40 ฿ ถือว่าแจ่ม

และ Reseller ของนิภาคือกัน คือเราเป็นตัวแทนขายโฆษณามีแบนเนอร์ให้ลงเว็บ

3 ชนิด อันนี้เงินดีกว่าถ้าจะสมัคร Reseller ก็เลือกอันที่ 3 นะครับอ่านลายละเอียดเพิ่มเติม

ที่เว็บ



โฆษณา,โฆษณาออนไลน์,การโฆษณา,สื่อโฆษณา,การตลาด,บริษัทโฆษณา,ประชาสัมพันธ์,ลงโฆษณา,ประกาศ,ออนไลน์,online,online advertising,advertising,โปรโมทสินค้า,โปรโมทเว็บไซต์,promote website,seo,pay per click,ad per click,media,ค้นหาเว็บ,media,สื่อ

โฆษณา,โฆษณาออนไลน์,การโฆษณา,สื่อโฆษณา,การตลาด,บริษัทโฆษณา,ประชาสัมพันธ์,ลงโฆษณา,ประกาศ,ออนไลน์,online,online advertising,advertising,โปรโมทสินค้า,โปรโมทเว็บไซต์,promote website,seo,pay per click,ad per click,media,ค้นหาเว็บ,media,สื่อ

โฆษณา,โฆษณาออนไลน์,การโฆษณา,สื่อโฆษณา,การตลาด,บริษัทโฆษณา,ประชาสัมพันธ์,ลงโฆษณา,ประกาศ,ออนไลน์,online,online advertising,advertising,โปรโมทสินค้า,โปรโมทเว็บไซต์,promote website,seo,pay per click,ad per click,media,ค้นหาเว็บ,media,สื่อ

ตัวอย่างโฆษณา คลิกดูลายละเอียดได้



โฆษณาออนไลน์,ออนไลน์,โฆษณา,ลงโฆษณา,ประกาศ, online advertising,online,advertising,โปรโมทสินค้า, โปรโมทเว็บไซต์,promote website,seo,pay per click, ad per click,media,ค้นหาเว็บ,media,สื่อ  

โฆษณา,โฆษณาออนไลน์,การโฆษณา,สื่อโฆษณา,การตลาด,บริษัทโฆษณา,ประชาสัมพันธ์,ลงโฆษณา,ประกาศ,ออนไลน์,online,online advertising,advertising,โปรโมทสินค้า,โปรโมทเว็บไซต์,promote website,seo,pay per click,ad per click,media,ค้นหาเว็บ,media,สื่อ

ติดต่อผู้สร้าง | กรุ | สร้างบล็อกของคุณดี๋ยวนี้! ง่ายดายและฟรี