How to add code to cloak/masked the link

1 replies
Hi guys i m using this code below on my domain to rotate a few affiliate link. i need help from php expert here to add some code so i can cloak the link to show only domain link .
Code:
<?php

	
	function redirect_to($link) {
		header("Location: {$link}");
		exit;
	}
		
	$links = file('links.txt');	
	
	while (!$links) {
		$links = file('links.txt');	
	}
	
	$links_count = count($links);	
	$one_month = 60 * 60 * 24 * 30;
	
	if (!isset($_COOKIE['link_index'])) {
		setcookie('link_index', 0, time() + $one_month);		
		$index = 0;
	} else {
		$index = $_COOKIE['link_index'] + 1;		
		setcookie('link_index', $index, time() + $one_month);		
		
		if ($index == $links_count) {
			setcookie('link_index', 0, time() + $one_month);		
			$index = 0;
		}
	}
	
	redirect_to($links[$index]);
	
?>
#php #url rotators
  • Profile picture of the author Sergiu FUNIERU
    >>> i need help from php expert here to add some code so i can cloak the link to show only domain link .
    There are 3 places where the user can see the destination link:
    1 : in the anchor text (you just use whatever anchor text you like)

    2 : in the link's tooltip, seen when user hovers the mouse over the link (you can set that using the Title attribute. Here's an example: Creating tooltips using the title attribute of HTML)

    3. in the status bar (to change that you need some JavaScript code.
    Here's an example: Hide the Target URL of a Link in Status Bar)

    A neat trick is to use buttons instead of links, as buttons don't display anything in status bar when you hover them with the mouse. If you go here: Creating tooltips using the title attribute of HTML
    and hover over the "Submit" button you'll see there is nothing in the status bar, while when you hover over the link called "Dynamic Drive" on the same page, you'll notice its link in the status bar.

    Please be aware that some destination sites don't hide your affiliate ID when user arrive to them.
    So, instead of redirecting to theirdomain.com after the user arrives there, the URL still stays theirdomain.com/affiliate_id=1234

    While you can manipulate the way the links look on your site, you have no control on the destination sites.

    Sergiu FUNIERU
    {{ DiscussionBoard.errors[8557925].message }}

Trending Topics