\">\n\t\t\tLinking settings\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
Website URL:url}\" />
Website title:
(one pr. line)
Description:
Alternative backlinks:
(one pr. line)
Rules:
\n\t\t\t
\n\t\t\n\t\n\n\t
\n\t\t\n\t
\n\n\t
\n\t\t
\n\t\t\tCommand line settings\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
Enable:commandlineenable} />
Send summary:commandlinesummary} />
\n\t\t\t
\n\t\t
\n\t
\n\n\t
\n\t\t
\n\t\t\tRemote access settings\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
Enable:remoteenable} />
Send email summary:remotesummary} />
Remote passphrase:remotepass}\" />
Limit IPs:remotelimitips} />
Accepted IPs
(one pr. line)
\n\t\t\t
\n\t\t
\n\t
\n\n\n\t
\n\n\n\n"; echo template::footer(); break; case 'tools': switch( linkex::get( 'action', $_REQUEST, 'overview' ) ) { case 'autoadd': // {{{ ob_implicit_flush(true); session_write_close(); echo template::header( array( 'title' => 'Tools' ) ); $_POST['url'] = linkex::get( 'url', $_POST, $config->url ); $_POST['data'] = linkex::get( 'data', $_POST, '' ); if ( strlen( trim( $_POST['data'] ) ) > 0 ) { $legend = 'Adding links'; echo "\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t{$legend}\n\t\t\t\t\t\t
    ID  Domain                         Status                                              PageRank BackL.Status
===============================================================================================================
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\n\n"; echo template::footer(); linkex::flush(); $links = array_map( 'trim', explode( "\n", trim( $_POST['data'] ) ) ); foreach ( $links AS $link ) { $dom = linkex::getDomain( str_replace( 'www.', '', strtolower( $link ) ) ); template::progress( sprintf( "%-15s", substr( $dom, 0, 14 ) ) ); $con = linkex::fetch( $link ); if ( preg_match( '#^HTTP/\d+\.\d+\s+200#', linkex::get( 'headers', $con, '' ) ) ) { $f=0; foreach( autoadd::knownscripts() AS $script=>$regex ) { if ( preg_match( $regex, $con{'contents'} ) ) { template::progress( sprintf( '[ %-13s ]', $script ) ); $f=1; $res = autoadd::$script( $con, $_POST['url'] ); if ( $res === true ) { template::progress( ' [ OK ]' ); } else { template::progress( ' [ '.$res.' ]' ); } break; } } if ( $f==0 ) { template::progress( '[ Link Script not recognized ]' ); } } else { template::progress( sprintf( ' [ ERROR: Invalid response %-20s ]', linkex::get( 'headers', $con ) ) ); } template::progress( '
' ); } exit; } else { $cat = $config->defaultcategories; $categories = linkex::categories( LOGGEDIN ); $cats = array(); foreach( $categories AS $cid=>$name ) { $cats[] = new Category( $cid ); } $categories = $cats; unset( $cats ); linkex::sort( $categories, 'name', 'asc' ); $cats = array(); foreach( $categories AS $c ) { $cats{ $c->id } = $c->name; } $categories = $cats; unset( $cats ); $categories = linkex::selector( 'categories', $categories, linkex::get( 'categories', $_POST, $cat ), LOGGEDIN, null, array( 'style' => '' ) ); $formaction = htmlentities( $_SERVER['REQUEST_URI'] ); echo "
\n\t
\n\t\tLinking Details\n\t\t
\n\n\t\t\t\n\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
URL:
Categories:{$categories}
Link Sites:
\n\t\t\t\t\t\t(One URL pr. line)
\n\t\t\t\t\t(URL to trade form)

\n\t\t
\n\t
\n
\n"; } echo template::footer(); break; // }}} case 'email': // {{{ $linkids = linkex::listfiles( BASEDIR . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'links' . DIRECTORY_SEPARATOR ); $list = array(); $email2id = array(); foreach( $linkids AS $lid ) { $l = new link( $lid ); if ( strlen( $l->email ) > 0 ) { if ( linkex::get( $l->email, $list, false ) === false ) { $list[ $l->email ] = array( $l->ldom ); $email2id[ $l->email ] = array( $l->id ); } else { $list[ $l->email ][] = $l->ldom; $email2id[ $l->email ][] = $l->id; } } } if ( linkex::get( 'subject', $_POST, false ) !== false && linkex::get( 'sendto', $_POST, false ) !== false ) { echo template::header( array( 'title' => 'Tools » Send email' ) ); $subject = linkex::get( 'subject', $_POST, '' ); $body = linkex::get( 'body', $_POST, '' ); $sendto = linkex::get( 'sendto', $_POST, array() ); $ids = array(); foreach( $sendto AS $to ) { $ids = $ids + linkex::get( $to, $email2id, array() ); } foreach( $ids AS $id ) { $l = new link( $id ); linkex::mail( $l->email, $subject, $body ); } echo "Done sending mails.."; echo template::footer(); } else { $emails = array(); foreach( $list AS $e=>$l ) { $emails[ $e ] = sprintf( '%s (%s)', $e, join(', ',$l ) ); } $selected = linkex::get( 'sendto', $_REQUEST, array() ); if ( is_string( $selected ) ) { $selected = explode( ',', $selected ); } $emails = linkex::selector( 'sendto', $emails, $selected, true, 'select', array( 'style'=>'width:400px;' ) ); $_SERVER['REQUEST_URI'] = htmlentities( $_SERVER['REQUEST_URI'] ); echo template::header( array( 'title' => 'Tools » Send email' ) ); echo "
\n\t
\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
To:{$emails}
Subject:
Message:
\n\t\t\t\t\t\n\t\t\t\t
\n\t
\n
\n\n"; echo template::footer(); } break; // }}} case 'import': // {{{ echo template::header( array( 'title' => 'Tools » Import' ) ); if ( linkex::get( 'seperator', $_POST, false ) && linkex::get( 'input', $_POST, false ) ) { if ( linkex::get( 'unique', $_POST, false ) !== false ) { $doms = array(); // We need to make sure the domains are unique, so we make a list of all out domains $linkids = linkex::listfiles( BASEDIR . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'links' . DIRECTORY_SEPARATOR ); foreach ( $linkids AS $lid ) { $l = new link( $lid ); $doms[] = $l->ldom; unset( $l ); } } $seperator = preg_quote( linkex::get( 'seperator', $_POST, '' ), '#' ); $fields = explode( ',', linkex::get( 'fields', $_POST, '' ) ); $field_count = sizeof( $fields ); $categories = linkex::get( 'categories', $_POST, $config->defaultcategories ); $verify = linkex::get( 'verify', $_POST, 0 ); $lines = explode( "\n", str_replace( "\r", '', linkex::get( 'input', $_POST, '' ) ) ); $legend = 'Adding new links...'; echo "\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t{$legend}\n\t\t\t\t\t\t
    ID  Domain                         Status                                              PageRank BackL.Status
===============================================================================================================
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\n\n"; echo template::footer(); flush(); $progress = ''; $title = ''; foreach( $lines AS $line ) { $list = preg_split( "#".$seperator."#", trim( $line ) ); if ( sizeof( $list ) == sizeof( $fields ) ) { $l = new link; for( $i=0; $iemail = $list[$i]; break; case 'rurl': $l->rurl = $list[$i]; break; case 'lurl': $l->lurl = $list[$i]; break; case 'anchor': $l->anchor = $list[$i]; break; case 'description': $l->description = $list[$i]; break; case 'randlurl': $l->lurl = $list[$i]; $l->rurl = $list[$i]; break; } } $l->update(); if ( ( $verify==1 && ( $res = $l->hasBacklink() ) && linkex::get( 'res', $res, 0 ) != 0 ) ) { $p = sprintf( 'Skipping line due to missing backlink
  (%s)', trim( $line ) ); } elseif ( linkex::get( 'unique', $_POST, false ) !== false && sizeof( $doms ) > 0 && in_array( $l->ldom, $doms ) ) { $p = sprintf( 'Skipping line since there allready exists a link to %s', $l->ldom ); } else { $l->categories = $categories; $l->save(); $p = sprintf( 'Added link' ); } } else { $p = sprintf( 'Skipping line due to mismatch in field count
  (%s)', trim( $line ) ); } printf( '', $p ); flush(); } } else { $_SERVER['REQUEST_URI'] = htmlentities( $_SERVER['REQUEST_URI'] ); $categories = linkex::categories( true ); $categories = linkex::selector( 'categories', $categories ); echo "
\n\t
\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
Input seperator:\n\t\t\t\t\t\n\t\t\t\t\t(tip: use \t for tab, or \s+ for one or more space characters)\n\t\t\t\t
Input fields:\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t« \n\t\t\t\t\t\t\t\t»\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t
Input example:
Categories:{$categories}
Verify linkback: (only links with a valid backlink will be imported)
Unique domains: (Do not import links when there allready exists links to same domain)
Input:
\n\t
\n
\n\n\n\n"; echo template::footer(); } break; // }}} case 'overview': // {{{ echo template::header( array( 'title' => 'Tools' ) ); echo "
\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
Mass addBatch import links into LinkEX
Send emailSend an email to one or more webmasters
AutoaddAutomatically add your site to other link exchange scripts.
(BETA. Let me know how it works for you)
Pagerank TestHaving problems with PageRank? Use this tool to debug the communication with Google.
\n
\n"; echo template::footer(); break; // }}} case 'pageranktest': // {{{ echo << LinkEX » Test Pagerank algorithm
END;

	$pr = new PageRank;
	$url = 'http://linkex.dk';
	echo "Testing pagerank for: $url\n";
	echo "Calculation Google Cookie (expecting 773196802182)\n";
	$cookie = $pr->getCH( $url );
	echo "  $cookie - ";
	if ( $cookie == "773196802182" ) {
		echo "passed\n";

		$host = $pr->hosts[ mt_rand( 0, sizeof( $pr->hosts ) - 1 ) ];
		$ip = linkex::gethostbyname( $host, true );
		echo "Requesting info from Google (using $host - $ip)\n";
		$fp = fsockopen( $ip, 80, $errno, $error, 2 );
		if ( $fp ) {
			$header = '';
			$header .= "GET /search?client=navclient-auto&ch=" . $cookie .  "&features=Rank&q=info:" . $url . " HTTP/1.1\r\n" ;
			$header .= "Host: ".$host."\r\n" ;
			$header .= "Connection: Close\r\n\r\n" ;
			fwrite( $fp, $header );
			$data = '';
			while ( !feof( $fp ) ) {
				$data .= fgets( $fp, 128 );
			}
			fclose( $fp );
			if ( preg_match( '#(HTTP/\d+\.\d+\s+(\d{3}))#Umis', $data, $res ) ) {
				if ( $res[2] == '200' ) {
					echo "  ".$res[1]."\n";
					if ( ( $pos = strpos( $data, 'Rank_' ) ) !== false ) {
						$pagerank = intval( trim( substr( $data, $pos + 9 ) ) );
						echo "  PageRank for $url - $pagerank\n";
						echo "  Test ended successfully\n";
					} else {
						echo "  Did not find Rank_ in body of document\n";
						echo "\n".htmlentities( $data );
					}
				} else {
					echo "\n".htmlentities( $data );
				}
			} else {
				$data = explode( "\n", str_replace( "\r", '', $data ) );
				echo "  Get invalid response from $host - ".$data[0]."\n";
			}
		} else {
			echo "  unable to create socket to $host - $error\n";
		}
	} else {
		echo "failed\n";
	}
	echo <<
	

END;
	break; // }}}
}

					break;
				case 'upgrade':

function debug( $str ) { // {{{
	echo "";
	linkex::flush();
} // }}}

echo template::header( array( 'title' => 'Upgrading  LinkEX' ) );
$legend = 'Upgrading LinkEX';
echo "\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t{$legend}\n\t\t\t\t\t\t
    ID  Domain                         Status                                              PageRank BackL.Status
===============================================================================================================
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\n\n"; echo template::footer(); linkex::flush(); if ( ( $fp = @fopen( 'index.php', 'a' ) ) === false ) { // Unable to write to index.php debug( 'Cannot open index.php for writing. Please check the permissions.' ); exit; } fclose ( $fp ); debug( 'Cheking file permissions.. done' ); if ( @copy( __FILE__, BASEDIR . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'backup' . DIRECTORY_SEPARATOR . 'index.'.date( 'Ymd' ).'.php' ) === false ) { debug( 'Unable to backup LinkEX script' ); exit; } debug( 'Backing up current version.. done' ); $md5 = linkex::fetch( 'http://linkex.dk/releases/current.md5' ); if ( ( $error = linkex::get( 'error', $md5, false ) ) !== false ) { debug( 'Error while fetching version checkum ('.$md5['error'].')' ); exit; } else if ( strlen( trim( linkex::get( 'contents', $md5, '' ) ) ) != 32 ) { debug( 'Invalid response while fetching version checksum.' ); exit; } $checksum = trim( linkex::get( 'contents', $md5, '' ) ); debug( 'Fetching new version checksum.. ['.$checksum.']' ); $script = linkex::fetch( 'http://linkex.dk/releases/current.tar' ); if ( ( $error = linkex::get( 'error', $md5, false ) ) !== false ) { debug( 'Error while fetching new script ('.$md5['error'].')' ); exit; } debug( 'Fetching new version data file.. done' ); $script = linkex::get( 'contents', $script, '' ); if ( strcmp( strtolower( md5( $script ) ), strtolower( $checksum ) ) != 0 ) { debug( 'Verifying script checksum.. Error! Checksum mismatch' ); exit; } debug( 'Verifying script checksum.. done' ); linkex::fileput( __FILE__, $script ); debug( 'Installing new version.. done' ); debug( '
Upgrade complete.' ); break; default: linkex::redirect( BASEURI, 404 ); } } else { echo template::header( array( 'title' => 'Please login', 'metarobots' => 'noindex,follow' ) ); echo "
\n\t
\n\t\tPlease login\n\t\t
\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
Username:
Password:
I have forgotten my username/password
\n\t\t
\n\t
\n
\n"; echo template::footer(); } break; case 'check': @set_time_limit( 0 ); // Remote check function checkoutput( $code, $str ) { // {{{ die( "{$code}:{$str}\n" ); } // }}} // {{{ Is this thing enabled? if ( intval( $config->remoteenable ) == 0 ) { checkoutput( 1, 'Remote access is not enabled' ); } // }}} // {{{ IP check if ( intval( $config->remotelimitips ) == 1 ) { $ips = $config->remoteips; $found = false; $remote = linkex::get( 'REMOTE_ADDR', $_SERVER, '' ); foreach( $ips AS $ip ) { if ( linkex::compareIPs( $ip, $remote ) == 0 ) { $found = true; break; } } if ( $found !== true ) { checkoutput( 2, 'Your IP ('.$remote.') is not in the accepted IP list' ); } } // }}} // {{{ Passphrase check if ( ( $pass = $config->remotepass ) && strlen( $pass ) > 0 ) { if ( linkex::get( 'passphrase', $_GET, false ) != $pass ) { checkoutput( 3, 'Invalid or missing passphrase' ); } } // }}} $report = linkex::verifybacklinks( linkex::listfiles( BASEDIR . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'links' . DIRECTORY_SEPARATOR ) ); if ( $config->remotesummary == 1 ) { $report = template::report( $report ); linkex::mail( $config->email, 'Link verification report', $report ); } checkoutput( 0, 'OK' ); break; case 'about': echo template::header( array( 'title' => 'About', 'metarobots' => 'noindex,follow' ) ); echo template::about(); echo template::footer(); break; case 'logout': $path = dirname( linkex::get( 'SCRIPT_NAME', $_SERVER, '/' ) ); setcookie( '_authcookie', '', time() - 3600, $path ); unset( $_SESSION['_authcookie'] ); linkex::redirect( BASEURI, 301 ); case '': // Add link if ( !LOGGEDIN && intval( $config->disablepublicform ) == 1 ) { echo template::header( array( 'title' => 'Add link', 'metadescription' => 'Exchange hardlinks with '.$config->domain ) ); echo "
\n\t
\n\t\tForm disabled\n\t\t
\n\t\t\tPlease contact the webmaster to setup a link trade.\n\t\t
\n\t
\n
\n"; echo template::footer(); } else { if ( sizeof( $_POST ) > 0 ) { if ( ( intval( $config->usecaptcha ) == 0 ) || ( intval( $config->usecaptcha ) == 1 && linkex::get( 'captcha', $_POST, false ) && linkex::get( 'captcha', $_SESSION, false ) && linkex::get( 'result', $_SESSION['captcha'], false ) && $_POST['captcha'] == $_SESSION['captcha']['result'] ) ) { $link = new link; $link->wmip = $_SERVER['REMOTE_ADDR']; $link->lurl = htmlentities( linkex::get( 'lurl', $_POST, '' ) ); if ( $config->disablerecipfield == 1 && !LOGGEDIN && $config->samedomain != 2 ) { $link->rurl = $link->lurl; } else { $link->rurl = htmlentities( linkex::get( 'rurl', $_POST, '' ) ); } // Damn stupid noobish exploit $link->anchor = trim( linkex::get( 'anchor', $_POST, '' ) ); $link->description = trim( linkex::get( 'description', $_POST, '' ) ); $link->categories = linkex::get( 'categories', $_POST, $config->defaultcategories ); if ( !is_array( $link->categories ) ) { $link->categories = array( $link->categories ); } $link->categories = linkex::map( 'intval', $link->categories ); $link->email = htmlentities( trim( linkex::get( 'email', $_POST, '' ) ) ); // Start link validation // {{{ Check the anchor if ( strlen( $link->anchor ) == 0 ) { $errors[] = 'Please fill out the title'; } // }}} // {{{ Check the lurl if ( strlen( $link->lurl ) == 0 ) { $errors[] = 'Please fill out the URL'; } else if ( !preg_match( '/^https?:\/\/(.*\.)*[a-z0-9]([a-z0-9-]*[a-z0-9])?\.[a-z]+(.*)?/i', $link->lurl ) ) { $errors[] = 'The URL "'.$link->lurl.'" in invalid'; } // }}} // {{{ Check the email if ( strlen( $link->email ) == 0 ) { $errors[] = 'Please enter an email address'; } else if ( !preg_match( '/\S+@[a-z0-9]([a-z0-9-]*[a-z0-9])?\.[a-z]+(.*)?/i', $link->email ) ) { $errors[] = 'The email "'.$link->email.'" is invalid'; } // }}} // {{{ Check the rurl if ( intval( $config->disablerecipfield ) == 0 ) { if ( strlen( $link->rurl ) == 0 ) { $errors[] = 'Please fill out the reprocial URL'; } else if ( !preg_match( '/^https?:\/\/(.*\.)*[a-z0-9]([a-z0-9-]*[a-z0-9])?\.[a-z]+(.*)?/i', $link->rurl ) ) { $errors[] = 'The reprocial URL "'.$link->rurl.'" in invalid'; } } // }}} // {{{ Check the categories if ( $config->publiccategories == 1 ) { if ( sizeof( $link->categories ) == 0 ) { $errors[] = 'Please select a category'; } } // }}} $link->update(); $link->updateIPs(); // {{{ indexexchange if ( $config->indexexchange == 1 ) { $elems = @parse_url( $link->lurl ); if ( linkex::get( 'path', $elems, '/' ) != '/' ) { $errors[] = 'Only index exchanges allowed'; } if ( $link->lurl != $link->rurl ) { $elems = @parse_url( $link->rurl ); if ( linkex::get( 'path', $elems, '/' ) != '/' ) { $errors[] = 'Only index exchanges allowed'; } } } // }}} // {{{ noquerystring if ( $config->noquerystring == 1 ) { if ( strpos( $link->lurl, '?' ) !== false ) { $errors[] = 'No querystrings allowed'; } if ( $link->rurl != $link->lurl && strpos( $link->rurl, '?' ) !== false ) { $errors[] = 'No querystrings allowed'; } } // }}} // {{{ Same domain? switch( intval( $config->samedomain ) ) { case 1: if ( linkex::compareURLs( $link->ldom, $link->rdom ) != 0 ) { $errors[] = 'The submitted URLs must be on the same domain'; } break; case 2: if ( intval( $config->disablerecipfield ) == 0 && linkex::compareURLs( $link->ldom, $link->rdom ) == 0 ) { $errors[] = 'The submitted URLs must be on different domains'; } break; } // }}} // {{{ Check the length's if ( sizeof( $errors ) == 0 && (( LOGGEDIN && linkex::get( 'skiplengths', $_POST, 0 ) == 0 ) || !LOGGEDIN ) ) { // First the title if ( $config->titlelength > 0 ) { if ( $config->titlelengthtype == 'w' ) { // Max words if ( sizeof( preg_split( '#\s+#', $link->anchor ) ) > $config->titlelength ) { $errors[] = sprintf( 'Your site title is too long' ); } } else { // Max len if ( strlen( $link->anchor ) > $config->titlelength ) { $errors[] = sprintf( 'Your site title is too long' ); } } } // Then the description if ( $config->descriptionlength > 0 ) { if ( $config->descriptionlengthtype == 'w' ) { // Max words if ( sizeof( preg_split( '#\s+#', $link->description ) ) > $config->descriptionlength ) { $errors[] = sprintf( 'Your site description is too long' ); } } else { // Max len if ( strlen( $link->description ) > $config->descriptionlength ) { $errors[] = sprintf( 'Your site description is too long' ); } } } } // }}} // {{{ Check for dublicate domains/ips if ( ( LOGGEDIN && linkex::get( 'skipdupes', $_POST, 0 ) == 0 ) || !LOGGEDIN ) { $linkids = linkex::listfiles( BASEDIR . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'links' . DIRECTORY_SEPARATOR ); $ipcount = 0; foreach ( $linkids AS $lid ) { $l = new link( $lid ); $ipcount += ( linkex::compareIPs( $l->rdomip, $link->rdomip ) == 0 ) ? 1:0; if ( $config->linkbotuniquedomains == 1 ) { if ( linkex::compareURLs( $link->ldom, $l->ldom ) == 0 ) { $errors[] = 'We allready have a link to "'.$l->ldom.'"'; break; } else if ( linkex::compareURLs( $link->rdom, $l->rdom ) == 0 ) { $errors[] = 'We allready have a link from "'.$l->rdom.'"'; break; } } else { if ( linkex::compareURLs( $link->lurl, $l->lurl ) == 0 ) { $errors[] = 'We allready have a link to "'.$l->lurl.'"'; break; } else if ( linkex::compareURLs( $link->rurl, $l->rurl ) == 0 ) { $errors[] = 'We allready have a link from "'.$l->rdom.'"'; break; } } unset( $l ); } if ( intval( $config->linkbotuniqueips )>0 && $ipcount >= intval( $config->linkbotuniqueips ) ) { $errors[] = 'We allready have '.intval($ipcount).' links from "'.$link->rdomip.'"'; } } // }}} // {{{ Check the blacklist if ( ( LOGGEDIN && linkex::get( 'skipblacklist', $_POST, 0 ) == 0 ) || !LOGGEDIN ) { if ( sizeof( $errors ) == 0 && linkex::get( 'skipblacklist', $_POST, 0 ) == 0 && ( $reason = $link->blacklisted() ) !== false ) { $errors[] = $reason; } } // }}} // {{{ Make sure a backlink is present $link->lastchecked = time(); if ( sizeof( $errors ) == 0 && ( ( LOGGEDIN && linkex::get( 'skipbacklinkcheck', $_POST, 0 ) == 0 ) || !LOGGEDIN ) && ( ( $config->linkbackrequired == 1 ) || ( intval( $config->maxoutboundlinks ) > 0 ) ) && ( $e=$link->hasBacklink() ) && linkex::get( 'res', $e, 0 ) != 0 ) { switch( linkex::get( 'res', $e, 0 ) ) { case '1': $errors[] = 'Unable to verify backlink. '.linkex::get( 'reason', $e, '' ); break; case '2': $errors[] = 'None of the links found on "'.$link->rurl.'" could be accepted. ' . linkex::get( 'reason', $e, '' ); break; case '4': $errors[] = 'The anchor text of the backlink did not match the req'.'uired anchor text.'; break; case '8': $errors[] = 'None of the links found on "'.$link->rurl.'" could be accepted. ' . linkex::get( 'reason', $e, '' ); break; case '16': $errors[] = linkex::get( 'reason', $e, '' ); break; default: $errors[] = 'Iternal error'; break; } } $link->skipcheck = ( LOGGEDIN && linkex::get( 'skipbacklinkcheck', $_POST, 0 ) == 1 ) ? 1:0; // }}} // {{{ Check the min PageRank // The pagerank must be checked if: // ( config->minpagerank > 0 && !LOGGEDIN ) || ( LOGGEDIN && linkex::get( 'skippagerank', $_POST, 0 ) == 0 ) if ( sizeof( $errors ) == 0 && $config->minpagerank > 0 && !( LOGGEDIN && linkex::get( 'skippagerank', $_POST, 0 ) != 0 ) ) { if ( $link->getPageRank( false ) < $config->minpagerank ) { $errors[] = 'We require a min. PR'.$pr.', your site has a PR'.$link->getPageRank( false ).''; } } // }}} if ( sizeof( $errors ) == 0 ) { $link->save(); if ( !LOGGEDIN && strlen( $config->email ) > 4 ) { $_SERVER['HTTP_HOST'] = str_replace( 'www.', '', strtolower( linkex::get( 'HTTP_HOST', $_SERVER, 'unknown' ) ) ); $host = $_SERVER['HTTP_HOST']; $pagerank = $link->getPageRank(); linkex::mail( $config->email, 'LinkEX: new link @ '.linkex::get( 'HTTP_HOST', $_SERVER, 'unknown' ), "This is a message from {$host}.\n\nA new link was just added:\nEmail: {$link->email}\nLink URL: {$link->lurl} (IP:{$link->ldomip})\nRecip URL: {$link->rurl} (IP:{$link->rdomip})\nAnchor text: {$link->anchor}\nPageRank: {$pagerank}\n\n\n" ); } echo template::header( array( 'title' => 'Link added' ) ); echo "
\n\t
\n\t\tRules\n\t\t
\n\t\t\t

Thank you for adding your link to our database.
\n\t\t\tPlease make sure you allways keep a link to our site, otherwise your link will be disabled from our site.

\n\t\t\t

Like the looks of this script? Get yours for free, head over to LinkEX and check out this free script.

\n\t\t
\n\t
\n
\n"; echo template::footer(); exit; } } else { // Captcha failed $errors[] = 'Spam check failed. Please retry'; } } echo template::header( array( 'title' => 'Add link', 'metadescription' => 'Exchange hardlinks with '.$config->domain.'. Instant linkexchange' ) ); echo template::rules(); echo template::linkdetails(); echo template::linkform(); echo template::footer(); } break; default: linkex::redirect( BASEURI, 404 ); } } } else { $_username = linkex::get( '_username', $_POST, '' ); $_password1 = linkex::get( '_password1', $_POST, '' ); $_password2 = linkex::get( '_password2', $_POST, '' ); $_email = linkex::get( '_email', $_POST, '' ); $_url = linkex::get( '_url', $_POST, 'http://'.linkex::get( 'HTTP_HOST', $_SERVER, '' ) ); $_anchor = linkex::get( '_anchor', $_POST, '' ); if ( linkex::get( 'ok', $_POST, false ) !== false ) { // Form is posted // {{{ Check if we have a username if ( strlen( trim( $_username ) ) == 0 ) { $errors[] = 'Please enter a username'; } // }}} // {{{ Check the password(s) if ( strlen( trim( $_password1 ) ) == 0 ) { $errors[] = 'Please enter a password'; } else if ( trim( $_password1 ) != trim( $_password2 ) ) { $errors[] = 'The two passwords did not match, please try again.'; } // }}} // {{{ Check the email if ( strlen( trim( $_email ) ) == 0 ) { $errors[] = 'Please enter an email address'; } else if ( !preg_match( '/\S+@[a-z0-9]([a-z0-9-]*[a-z0-9])?\.[a-z]+(.*)?/i', $_email ) ) { $errors[] = 'The email "'.$_email.'" is invalid'; } // }}} // {{{ Check the URL if ( strlen( trim( $_url ) ) == 0 ) { $errors[] = 'Please fill out the URL of your website'; } else if ( !preg_match( '/^https?:\/\/(.*\.)*[a-z0-9]([a-z0-9-]*[a-z0-9])?\.[a-z]+(.*)?/i', $_url ) ) { $errors[] = 'The URL "'.$_url.'" in invalid'; } // }}} // {{{ Check the anchor if ( strlen( trim( $_anchor ) ) == 0 ) { $errors[] = 'Please fill out the title of your website'; } // }}} if ( sizeof( $errors ) == 0 ) { $dirs = array( BASEDIR . DIRECTORY_SEPARATOR .'data', BASEDIR . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'backup' . DIRECTORY_SEPARATOR, BASEDIR . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR, BASEDIR . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'categories' . DIRECTORY_SEPARATOR, BASEDIR . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'blacklist' . DIRECTORY_SEPARATOR, BASEDIR . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'links' . DIRECTORY_SEPARATOR, BASEDIR . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'output' . DIRECTORY_SEPARATOR, BASEDIR . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'logs' . DIRECTORY_SEPARATOR, BASEDIR . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR ); foreach( $dirs AS $d ) { if ( !is_dir( $d ) && @mkdir( $d, 0777 ) === false ) { $errors[] = 'Unable to create directory "'.$d.'"'; break; } @chmod( $d, 0777 ); } $config = new config; $config->password = md5( $_username .'---'. $_password1 ); $config->email = $_email; $config->url = $_url; $config->anchor = array( $_anchor ); $config->defaultcategories = array( '1001' ); if ( sizeof( $errors ) == 0 ) { $config->save(); linkex::fileput( BASEDIR . DIRECTORY_SEPARATOR .'data'. DIRECTORY_SEPARATOR .'config'. DIRECTORY_SEPARATOR .'uid', '1000' ); $cat = new category; $cat->name = 'Default'; $cat->save(); unset( $cat ); echo template::header( array( 'title' => 'Installation complete' ) ); echo "
\n\t
\n\t\tAll done\n\t\t
\n\t\t\tYou LinkEX is now ready to use, log in here, and check out the opportunities with this script.\n\t\t
\n\t
\n
\n"; echo template::footer(); exit; } } } echo template::header( array( 'title' => 'Installation' ) ); echo "
\n\t
\n\t\tWelcome to LinkEX\n\t\t
\n\t\t\tThank you for choosing LinkEX. Hopefully LinkEX will help you build a strong network of links, \n\t\t\tand lessen the workload for you at the same time.
\n\t\t\t
\n\t\t\tIn order to start using LinkEX, you need to fill out the form below.\n\t\t
\n\t
\n
\n"; echo "
\n\t
\n\t\tSettings\n\t\t
\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
Username:
Password:
Password (again):
Email:
 
Website URL:
Website Title:
\n\t\t
\n\t
\n
\n"; echo template::footer(); } ?>
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /data/www/virtuals/formanek/html/links/index.php:799) in /data/www/virtuals/formanek/html/links/index.php on line 815

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /data/www/virtuals/formanek/html/links/index.php:799) in /data/www/virtuals/formanek/html/links/index.php on line 815
LinkEX » Add link
 
Rules
No warez/adult sites.
Linkback: Required
Min. PageRank™:
Our linking details
Email: dominik.formanek@gmail.com
URL: http://www.formanek.cz
Site title: Dominik Formánek
Site description:
HTML code:
<a href="http://www.formanek.cz" title="Dominik Formánek">Dominik Formánek</a>
Your linking details
Site title:
Your URL:
Reciprocal link URL:
Your email:
Site description:
Spam check:
LinkEX CAPTCHA