Jump to content

problem with php short links script


ForexSon

Recommended Posts

index.php
 

<?php
require_once 'global.php';

if (isset($_REQUEST['r']) && intval($_REQUEST['r']) && $_REQUEST['r'] > 0) {
	setcookie('REFERRER', intval($_REQUEST['r']), time() + 12400);
}

if (isset($_REQUEST['logout'])) {
	setcookie('UID', $uid, time() - 5400);
	System::redirect('index.php?' . ($_REQUEST['banned']?'banned='.$_REQUEST['banned']:''));
}

if (isset($_REQUEST['banned'])) {
	$H_TEMPLATE['ERRORS'][] = 'Your account has been banned! You may contact the support '
							  . 'to dispute this ban. <a href="contact.php?e=' . $_REQUEST['banned']
							  . '&s=other&m=Account+Banned+Dispute" class="uc">Click Here</a>';
}

if (System::getUser()->loggedIn()) {
	System::verifyAccess();
}

if (isset($_POST['usr_sub'])) {
	$err = '';
	$db = System::getDB();
	$email = trim($_POST['usr_email']);
	$pass = md5(trim($_POST['usr_pass']));
	$rmbr = $_POST['usr_rmbr'];
	$uField = $db->rowCount($_GLOBAL['TABLES']['USERS'], "username='{$email}' AND pass='{$pass}'")
			  ? 'username' : 'email';
	
	if (!$email || !$pass || $email == 'your@mail.com' || $pass == 'password') {
		$err = 'Please complete both fields in order to login';
	} else if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)
				&& $uField == 'email') {
		$err = 'Please enter a valid username';
	} else if (!$db->rowCount($_GLOBAL['TABLES']['USERS'], "{$uField}='{$email}' AND pass='{$pass}'")) {
		$err = 'The login information is incorrect.';
	}
	
	if (!$err) {
		$uid = $db->getField($_GLOBAL['TABLES']['USERS'], 'id', "{$uField}='{$email}' AND pass='{$pass}'");
		$db->update($_GLOBAL['TABLES']['USERS'],
			array('activity' => 'CURRENT_TIMESTAMP()', 'ipaddr' => "'{$_SERVER['REMOTE_ADDR']}'"),
			"{$uField}='{$email}' AND pass='{$pass}'",false);
		setcookie('UID', $uid, time() + 5400);
		setcookie('USERNAME', $email, time() + ($rmbr ? 777600 : -777600));
		setcookie('PASSWORD', trim($_POST['usr_pass']), time() + ($rmbr ? 777600 : -777600));
		System::redirect('index.php?');
	} else {
		$F_TEMPLATE['ERRORS'][] = $err;
	}
}

$H_TEMPLATE['TITLE'] = '';
if (System::getUser()->loggedIn() == 2) {
	$H_TEMPLATE['TITLE'] = 'Your Campaigns';
} else if (System::getUser()->loggedIn()) {
	$H_TEMPLATE['TITLE'] = 'Welcome ' . System::getUser()->get('name') . '!';
}
site_header(System::getUser()->loggedIn() != 2);

if (System::getUser()->loggedIn() == 2) { /* Advertiser {{{ */

$_edit = $_GET['edit'];										  
$_rem  = $_GET['rem'];										  
if (isset($_POST['edit_sub'])) {
	$_edit = $_POST['ecid'];
	$website_name = $_POST['website_name'];
	$website_url = $_POST['website_url'];
	$website_banner = $_POST['website_banner'] | '';
	$daily_budget = $_POST['daily_budget'];
	if (!$website_name) {
		$F_TEMPLATE['ERRORS'][] = 'There was an error with the form, please make sure you fill everything out';
	} else if (!Utilities::validateURL($website_url) || ($website_banner && !Utilities::validateURL($website_banner))) {
		$F_TEMPLATE['ERRORS'][] = 'Please enter a valid URL';
	} else if (!$daily_budget && $_POST['daily_budget'] != '0') {
		$F_TEMPLATE['ERRORS'][] = 'Please enter a numeric value for your daily budget';
	} else {
		System::getDB()->update($_GLOBAL['TABLES']['CAMPAIGNS'],
								array('website_name' => $website_name,
									  'website_url' => $website_url,
									  'website_banner' => $website_banner,
									  'daily_budget' => $daily_budget),
								"`id`='{$_edit}'"
								);
		$_edit = 0;
	}
} else if (isset($_GET['rem']) && $_rem > 0) {
	if (!$_rem || !($_rem > 0)) {
		$F_TEMPLATE['ERRORS'][] = 'There was an error retrieving the campaign ID. '
								  . 'Please refresh the page to correct and try again.';
	} else {
		$db    = System::getDB();
		if ($db->rowCount($_GLOBAL['TABLES']['CAMPAIGNS'], "`id`='{$_rem}' AND `uid`='{$_UID}'")) {
			$db->query("DELETE FROM `{$_GLOBAL['TABLES']['CAMPAIGNS']}` WHERE `id`='{$_rem}' AND `uid`='{$_UID}';");
			System::redirect('index.php?removed');
		} else {
			$F_TEMPLATE['ERRORS'][] = 'The link your trying to edit does not exist!';
		}
	}
}

$_CF = $_GET['cf'] >= 1 && $_GET['cf'] <= 4 ? $_GET['cf'] : 1;
$_CT = $_GET['ct'] == 2 ? 2 : 1;
$advert_type = $_CT == 2 ? 'Banner' : 'Interstitial';

$status = "`status`='" . ($_CF - 1) . "'";
if ($_CF == 1) $status = '`status`>0';
$campaign_list = System::getDB()->getRows($_GLOBAL['TABLES']['CAMPAIGNS'],
										  "`uid`='{$_UID}' AND {$status} AND `advert_type`='{$advert_type}'");
?>
<div class="user_content">
	<div>
		<div style="float:left;display:inline-block;">
			<p>Welcome to <?php echo SITE_NAME; ?>!</p>
			<p>You can create a new campaign by clicking 'Create Campaign' above.</p>
		</div>
		<div class="campaign_box campaign_filter">
			<p>Campaign Filter:</p>
			<p>
				<a href="?cf=1&ct=<?php echo $_CT; ?>"<?php if($_CF==1) echo ' class="selected"';?>>All</a>
				 | 
				<a href="?cf=3&ct=<?php echo $_CT; ?>"<?php if($_CF==3) echo ' class="selected"';?>>Active</a>
				 | 
				<a href="?cf=4&ct=<?php echo $_CT; ?>"<?php if($_CF==4) echo ' class="selected"';?>>Finished</a>
				 | 
				<a href="?cf=2&ct=<?php echo $_CT; ?>"<?php if($_CF==2) echo ' class="selected"';?>>Pending</a>
			</p>
		</div>
	</div>
	<div style="clear:both;"></div>
	<div class="campaign_box campaign_type">
		<a href="?ct=1&cf=<?php echo $_CF; ?>"<?php if($_CT==1) echo ' class="selected"';?>>Interstitial Adverts</a>
		 | 
		<a href="?ct=2&cf=<?php echo $_CF; ?>"<?php if($_CT==2) echo ' class="selected"';?>>Banner Adverts</a>
	</div>
	<table cellspacing="1" class="tablesorter campaign_list">
		<thead>
			<tr>
				<th width="40%">Website Name</th>
				<th>Package/Country</th>
				<th align="right">Views Left</th>
				<th align="right">Max Daily Budget</th>
				<th align="right">Spent Today</th>
				<th align="center">Status</th>
				<th align="center">Action</th>
			</tr>
		</thead>
		<tbody>
			<?php
				if ($campaign_list) {
					function get_package_name($id) {
						global $_GLOBAL;
						return System::getDB()->getField($_GLOBAL['TABLES']['PACKAGES'], 'name', "`id`='{$id}'");
					}
					function get_package_names($pkg) {
						$pkgs  = explode(';', $pkg);
						$names = '';
						foreach ($pkgs as $v) {
							$p = explode(',', $v);
							$names .= get_package_name($p[0]) . '<br />';
						}
						return rtrim($names, '<br />');
					}
					foreach ($campaign_list as $cl) {
						if ($_edit == $cl['id']) {
							echo "<form action='?ct={$_CT}&cf={$_CF}#cid_{$cl['id']}' method='POST'>";
							echo "<input type='hidden' name='ecid' value='{$cl['id']}' />";
						}
						echo "<tr id='cid_{$cl['id']}'>";
						if ($_edit == $cl['id']) {
							echo "<td>Website: <input type='text' name='website_name' style='width:80%;' value='";
							echo "{$cl['website_name']}' /><br />";
							echo "URL: ";
							if ($cl['status'] == 1) echo "<input type='text' name='website_url' style='width:80%;' value='";
							echo "{$cl['website_url']}";
							if ($cl['status'] == 1) echo "' />";
							if ($_CT == 2) {
								echo "Banner: <input type='text' name='website_banner' style='width:80%;' value='";
								echo "{$cl['website_banner']}' />";
							}
							echo "</td>";
						} else {
							echo "<td>{$cl['website_name']}<br />";
							echo "<em>{$cl['website_url']}</em>";
							if ($_CT == 2) { echo "<br /><em>{$cl['website_banner']}</em>"; }
							echo "</td>";
						}
						echo "<td>" . get_package_names($cl['packages']) . "</td>";
						echo '<td align="right">' . number_format($cl['views_left']) . '</td>';
						if ($_edit == $cl['id']) {
							echo "<td align='right'>\$<input type='text' name='daily_budget' value='";
							echo "{$cl['daily_budget']}' size='5' /></td>";
							echo "<td align='right'>\${$cl['spent_today']}</td>";
							/*if ($cl['status'] != 1) {
								echo "<td align='center'><select name='ad_status'>"
									 . "<option value='2'"
										. ($cl['status']==2?' selected':'') . ">Active</option>"
									 . "<option value='3'"
										. ($cl['status']==3?' selected':'') . ">Finished</option>"
									// . "<option value='1'"
									//	. ($cl['status']==1?' selected':'') . ">Pending</option>"
									 . "</select></td>";
							} else echo "<td align='center'>Pending</td>";*/
							echo "<td align='center'>";
							echo $cl['status']==1?'Pending':($cl['status']==2?'Active':'Finished');
							echo "</td>";
							echo "<td align='center'><input type='submit' name='edit_sub' value='Edit' /></td>";
						} else {
							echo "<td align='right'>\${$cl['daily_budget']}</td>";
							echo "<td align='right'>\${$cl['spent_today']}</td>";
							echo "<td align='center'>" 
								 . ($cl['status'] == 2 ? 'Active'
									: ($cl['status'] == 3 ? 'Finished' : 'Pending'))
								 . "</td>";
							echo "<td align='center'><a href='?ct={$_CT}&cf={$_CF}&edit={$cl['id']}#cid_{$cl['id']}'>";
							echo "<img src='images/tsp_edit.png' border='0' /></a>";
							echo "  <a id='cid_rem' href='?ct={$_CT}&cf={$_CF}&rem={$cl['id']}#cid_{$cl['id']}'>";
							echo "<img src='images/tsp_del.png' border='0' /></a></td>";
						}
						echo '</tr>';
						if ($_edit == $cl['id']) echo '</form>';
					}
				} else {
					echo '<tr>';
					echo '<td colspan="7"><em>You do not currently have any adverts to display</em></td>';
					echo '</tr>';
				}
			?>
		</tbody>
	</table>
	<div style="clear:both;"></div>
</div>
<?php announcements(); ?>
<script type="text/javascript">
	$('a#cid_rem').click(function() {
		var c = confirm('Are sure you want to delete this campaign?');
		if (!c) return false;
	});
</script>
<?php
} /* }}} Advertiser */

else if (System::getUser()->loggedIn()) { /* Shrinker {{{ */
$rg_j['day'] = date('d');
$rg_j['month'] = date('m');
$rg_j['year'] = date('Y');

$query = "SELECT COUNT(*) AS tc, SUM(earned) AS te FROM `{$_GLOBAL['TABLES']['ANALYZER']}` WHERE `oid`='{$_UID}' AND "
		 . "`date`='{$rg_j['year']}-{$rg_j['month']}-{$rg_j['day']}' LIMIT 1";
$today_info = System::getDB()->fetch($query); $today_info = $today_info[0];
$query = "SELECT COUNT(*) AS tc, SUM(earned) AS te FROM `{$_GLOBAL['TABLES']['ANALYZER']}` WHERE `oid`='{$_UID}' LIMIT 1";
$total_info = System::getDB()->fetch($query); $total_info = $total_info[0];
?>
<div class="user_content" style="text-align:center;">
	<strong>Today:</strong> <?php echo $today_info['tc']; ?> views, $<?php echo number_format($today_info['te'], 5); ?> earned
	     
	<strong>Total:</strong> <?php echo $total_info['tc']; ?> views, $<?php echo number_format($total_info['te'], 5); ?> earned
</div>
<?php announcements(); ?>
<div class="user_content">
	<h2>
		<span id="report_date"><?php echo date('F Y'); ?></span> Report
		<div style="float: right; font-weight: normal;">
			Choose Month:
			<select name="report_date">
				<?php
					$my = explode('-', date('m-Y'));
					$m = 0; $y = 2011; $op = array();
					while ($m != (int)$my[0] || $y != (int)$my[1]) {
						if (++$m == 13) { $m = 1; $y++; }
						$op[] = "<option value='{$m}-{$y}'>" . date("F Y",mktime(0,0,0,$m,1,$y)) . "</option>";
					}
					$op = array_reverse($op);
					foreach ($op as $o) echo $o;
				?>
			</select>
		</div>
	</h2>
	<div id="report_graph" style="height:300px;margin:0 auto;"></div>
	<table cellspacing="2" class="report_info">
		<tr>
			<td><span id="report_date"><?php echo date('F Y'); ?></span></td>
			<td>Visitors: <span id="report_info_visitors">0</span></td>
			<td>Avg. CPM: $<span id="report_info_cpm">0.00</span></td>
			<td>Month Earned: $<span id="report_info_earned">0.0000</span></td>
		</tr>
	</table>
</div>
<div class="user_content">
	<h2>Your Links</h2>
	<table cellspacing="1" class="tablesorter links_table">
		<thead>
			<tr>
				<th width="55%">Website Address</th>
				<th width="14%">Advert Type</th>
				<th width="13%">Views</th>
				<th width="18%">Money Earned</th>
				<th align="center">Action</th>
			</tr>
		</thead>
		<tbody>
			<tr id="no_link">
				<td colspan="5"><em>No data available</em></td>
			</tr>
		</tbody>
	</table>
	<div id="_lp"></div>
</div>
<div class="user_content">
	<div style="width:50%;float:left;">
		<h2>Top 20 Countries</h2>
		<table cellspacing="1" class="tablesorter top_countries" style="width:90%;">
			<thead>
				<tr>
					<th>Country</th>
					<th align="right">Views</th>
					<th align="right">Money Earned</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td colspan="3"><em>No data available</em></td>
				</tr>
			</tbody>
		</table>
	</div>
	<div style="width:50%;float:left;">
		<h2>Top 20 Referrers</h2>
		<table cellspacing="1" class="tablesorter top_referrers" style="width:90%;">
			<thead>
				<tr>
					<th>Referrer</th>
					<th align="right">Views</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td colspan="2"><em>No data available</em></td>
				</tr>
			</tbody>
		</table>
	</div>
	<div style="clear:both;"></div>
</div>
<script type="text/javascript">
<?php
	function get_js_01() {
		ob_start();
?>
$('select[name="report_date"]').change(function() {
	var rd = $('option:selected', this).val().split('-');
	var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
	$('span#report_date').text(months[parseInt(rd[0] - 1)] + ' ' + rd[1]);
	$.ajaxSetup({cache:false});
	$.get('ajax.php',{opt: 'get_report', args:{month: rd[0], year: rd[1]}},
		function(r) {
			var j = eval('(' + r + ')');
			if (j.error) {
				alert(j.error);
			} else if (j.message) {
				$('span#report_info_visitors').text(j.message.visitors || '0');
				$('span#report_info_cpm').text(j.message.cpm || '0.00');
				$('span#report_info_earned').text(j.message.earned || '0.00000');
				var jm_data = '';
				eval('jm_data = [' + j.message.data + '];');
				$.plot($("div#report_graph"), [
					{ data: jm_data, lines: {show: true, fill: true} }
				], {
					xaxis: {
						ticks: j.message.x_max, min: 1, max: j.message.x_max,
						tickDecimals: 0
					},
					yaxis: { ticks: 10, min: 0, max: j.message.y_max }
				});
			} else {
				alert('[0x1gr01] Error Communicating With Server - Please try again');
			}
		}
	);
	$.get('ajax.php',{opt: 'get_t20_cr', args:{month: rd[0], year: rd[1]}},
		function(r) {
			var j = eval('(' + r + ')');
			if (j.error) {
				alert(j.error);
			} else if (j.message) {
				var tc = j.message.tc_data, tc_html = '';
				var tr = j.message.tr_data, tr_html = '';
				$.each(tc, function(k,v) {
					tc_html += '<tr>';
					tc_html += '<td>' + v.country + '</td>';
					tc_html += '<td align="right">' + v.hits + '</td>';
					tc_html += '<td align="right">$' + parseFloat(v.earned).toFixed(5) + '</td>';
					tc_html += '</tr>';
				});
				$.each(tr, function(k,v) {
					tr_html += '<tr>';
					tr_html += '<td>' + k + '</td>';
					tr_html += '<td align="right">' + v.hits + '</td>';
					tr_html += '</tr>';
				});
				if (!tc_html) {
					tc_html += '<tr>';
					tc_html += '<td colspan="3"><em>No data available</em></td>';
					tc_html += '</tr>';
				}
				if (!tr_html) {
					tr_html += '<tr>';
					tr_html += '<td colspan="2"><em>No data available</em></td>';
					tr_html += '</tr>';
				}
				
				$('tbody', 'table.top_countries').html(tc_html);
				$('tbody', 'table.top_referrers').html(tr_html);
			} else {
				alert('[0x1gt01] Error Communicating With Server - Please try again');
			}
		}
	);
});
$('select[name="report_date"]').change();
<?php
	$c = ob_get_contents();
	ob_end_clean();
	return $c;
}
echo Utilities::JSPack(get_js_01());
?>
</script>
<?php
} /* }}} Shrinker */

else { /* User Login {{{ */

$usr_email = !$_POST['usr_email'] ? $_COOKIE['USERNAME'] : $_POST['usr_email'];
$usr_pass = !$_POST['usr_pass'] ? $_COOKIE['PASSWORD'] : $_POST['usr_pass'];
?>
<div class="before"><em>Before shrink your URL, please read our <a href="terms.php">TERMS & CONDITIONS</a>.</em></div>
<div class="main_intro">
<h2><img src="images/what.png" align="absmiddle"/></h2>
<div class="intros left">
<?php echo SITE_NAME; ?> is a free URL shortening service with a twist.
<strong>you get paid to share your links on the Internet!</strong> Just register for a free account and start shrinking.
You get paid for every person that visits your URLs.
Example URL for Google:
 <a href="<?php echo SITE_LOCATION; ?>Bmc" class="uc"><?php echo SITE_LOCATION; ?>Bmc</a>
Place your short urls on Facebook, Twitter, forums,
personal websites, blogs, and any social networking sites.
</div>
</div>
<div class="main_intro">
<h2><img src="images/why.png" align="absmiddle"/></h2>
<div class="intros right">
Earn more than <a href="<?php echo SITE_LOCATION; ?>rates.php" class="uc">$5.00/1000 visitors</a> to your links.
Get short URLs, great for when text space is limited.
All advertising is strictly family-safe with no popups.
Real-time statistics with revenue reporting.
Refer users and get a whopping 20% commission!
Many tools:
 Mass url Shrinker.
- Easy Links.
- API key.
- Full Page Script.
- Google Analytics.
Low $5.00 minimum payout - Weekly Payment Every Monday.
</div>
</div>
<div style="clear:both"></div>
<?php
} /* }}} User Login */
?>
<script type="text/javascript">
<?php
	function get_js_02() {
		ob_start();
?>
$(document).ready(function() {
	$('div.user_login input[name="usr_email"]').watermark('your@mail.com');
	$('div.user_login input[name="usr_pass"]').watermark('password');
	$('div.user_login div.nspr.inneri2.dark').hover(function(){$('input',this).fadeTo(400,1);},
												   function(){$('input',this).fadeTo(400,.7);});
	$('div.user_login form').submit(function() {
		var email = $('input[name="usr_email"]', this).val(),
			pass = $('input[name="usr_pass"]', this).val();
		if (!email || !pass || email == 'your@mail.com' || pass == 'password') {
			alert('Please complete both fields in order to login');
			return false;
		}
	});
	
	<?php
		if (System::getUser()->loggedIn() != 2) {
	?>
	$('div.shrink div.nspr.inneri.dark input').fadeTo(0,.7);
	$('div.shrink div.nspr.inneri.dark').hover(function(){$('input',this).fadeTo(400,.9);},
											   function(){$('input',this).fadeTo(400,.7);});
	var _adb_url = $('div.shrink input[name="adb_url"]');
	_adb_url.val('http://').width(569);
			
	var _updateLinkEvents = function() {
		$.ajaxSetup({cache:false});
		$('table.links_table tr[id^="lid"] a#edit').click(function() {
			var _e = $(this).parent().parent();
			var _t = _e.attr('id').substr(4);
			var spanrtitle = $('span#rtitle',_e), spanlong = $('span#long',_e), tdadtype = $('td#adtype',_e), _tdlast = $('td:last',_e);
			var adtype = tdadtype.text();
			spanrtitle.css('display', 'block')
				.html('<span style="width:50px;display:inline-block;font-size:12px;">Title:</span><input type="text" name="title" size="30" value="'+spanrtitle.text()+'" />');
			spanlong.html('<span style="width:50px;display:inline-block;font-size:12px;">Website:</span><input type="text" name="website" size="30" value="'+spanlong.text()+'" />');
			tdadtype.html('<select name="adtype">'
						  + '<option value="1"'+(adtype=='Interstitial'?' selected':'')+'>Interstitial</option>'
						  + '<option value="2"'+(adtype=='Top Banner'?' selected':'')+'>Top Banner</option>'
						  + '<option value="3"'+(adtype=='None'?' selected':'')+'>None</option>'
						  + '</select>');
			var edit_btn = $('<input type="submit" value="save" />');
			_tdlast.children().hide();
			_tdlast.append(edit_btn);
			edit_btn.click(function() {
				var website = $('input[name="website"]',_e).val(), title = $('input[name="title"]',_e).val(), 
					adtype = $('select[name="adtype"]',_e).val();
				$.get('ajax.php',{opt:'edit_link',args:{lid:_t,website:website,title:title,adtype:adtype}},
					function(r) {
						var j = eval('(' + r + ')');
						if (j.error) {
							alert(j.error);
						} else if (j.message) {
							spanrtitle.html('<em>' + title + '</em>');
							spanlong.html(website);
							tdadtype.html(adtype==1?'Interstitial':(adtype==2?'Top Banner':'None'));
							edit_btn.remove();
							_tdlast.children().show();
						} else {
							alert('[0x1el01] Error Communicating With Server - Please try again');
						}
					}
				);
				return false;
			});
			return false;
		});
		$('table.links_table tr[id^="lid"] a#rem').click(function() {
			var e = $(this).parent().parent();
			var t = e.attr('id').substr(4);
			if (confirm('Are you sure you want to delete this link?')) {
				$.get('ajax.php',{opt:'rem_link',args:{lid:t}},
					function(r) {
						var j = eval('(' + r + ')');
						if (j.error) {
							alert(j.error);
						} else if (j.message) {
							e.remove();
							//$('table.links_table').trigger('change');
						} else {
							alert('[0x1rl01] Error Communicating With Server - Please try again');
						}
					}
				);
			}
			return false;
		});
	};
	
	var _updateLinks = function() {
		var lt = $('table.links_table tbody');
		$.ajaxSetup({cache:false});
		$.get('ajax.php',{opt:'get_links'}, function(r) {
			var j = eval('(' + r + ')');
			if (j.message) {
				lt.html(j.message.data).ready(function() {
					_updateLinkEvents();
					$('div#_lp').html(j.message.lp);
				});
			} else {
				lt.html('<tr id="no_link"><td colspan="5"><em>No data available</em></td></tr>');
			}
		});
	}; _updateLinks();
	
	ZeroClipboard.setMoviePath('js/ZeroClipboard.swf');
	var zclip = new ZeroClipboard.Client();
	zclip.addEventListener('mouseDown',function(){zclip.setText(_adb_url.val());});
	
	$('div.shrink form').submit(function() {
		var s = $('input[type="submit"]', this), t = _adb_url;
		switch (s.attr('value')) {
			case 'COPY': break;
			default:
				var tval = t.val();
				t.attr('readonly', '1');
				t.val('Shrinking...');
				var args = {adtype:$('select[name="advert_type"]',this).val(),
							title:$('input[name="custom_name"]',this).val()};
				$.get('ajax.php',{opt:'shrink',url:encodeURI(tval),args:args},
					function(r) {
						var j = eval('(' + r + ')');
						if (j.error) {
							t.removeAttr('readonly');
							t.val(tval);
							alert(j.error);
						} else if (j.message) {
							t.val(j.message);
							var do_another = $('<span class="do_another">DO ANOTHER</span>');
							t.width(475).parent().append(do_another);
							do_another.click(function() {
								_adb_url.removeAttr('readonly').val('http://').width(550);
								do_another.remove();
								s.attr('value', 'SHRINK!').attr('id', '');
								zclip.destroy();
								return false;
							});
							s.attr('value', 'COPY');
							s.attr('id', 'zero_copy');
							zclip.glue('zero_copy');
							_updateLinks();
						} else {
							alert('[0x1sh01] Error Communicating With Server - Please try again');
						}
					}
				);
				break;
		}
		return false;
	});
	//$('table.links_table').change(function() { _updateLinks(); });
	
	var $ml_options = $('div.ml_options_box');
	var ml_options_height = $ml_options.height();
	$ml_options.hide().height(0);
	$('div.ml_options div.nspr.outeri2').hover(
		function(){$('div.ml_options div.nspr.outeri2').toggleClass('over');}
	).click(function() {
		if ($ml_options.is(':visible')) {
			$ml_options.animate({ height: 0 }, { duration: 300, complete: function () {
				$ml_options.hide();
			} });
			$(this).text('More Options');
		} else {
			$ml_options.show().animate({ height: ml_options_height }, { duration: 300 });
			$(this).text('Less Options');
		}
	});
	
	<?php
		}
		
		if (!System::getUser()->loggedIn()) {
	?>
	$('div.joinbtn div.nspr.outeri2').hover(
		function(){$('div.joinbtn div.nspr.outeri2').removeClass('over');},
		function(){$('div.joinbtn div.nspr.outeri2').addClass('over');}
	).click(function() { 
		$('div.join_page').modal({
			opacity: 50,
			overlayCss: {backgroundColor:'#111111'}, 
			containerCss: {minWidth:'395px',minHeight:'469px'}, dataCss: {},
			closeHTML: '<a href="#" title="Close" class="btn_close">X CLOSE</a>',
			close: true, escClose: false,
			onOpen: function(d) {
				d.overlay.fadeIn('fast');
				d.container.fadeIn('fast');
				d.data.fadeIn('fast');
			},
			onClose: function(d) {
				d.data.fadeOut('fast');
				d.container.fadeOut('fast');
				d.overlay.fadeOut('fast');
			}
		}).open();
	});

	$('div.join_page form').submit(function() {
		var slf  = $(this);
		var html = slf.html();
		var args = {};
		$('input[name]', slf).each(function() {
			if ($(this).attr('name') == 'join_atype') {
				args[$(this).attr('name')] = $('input:radio[name="join_atype"]:checked', slf).val();
				return;
			}
			args[$(this).attr('name')] = $(this).val();
		});
		slf.html('<div class="load01"><img src="images/load01.gif" border="0" />   Registering...</div>');
		$.get('ajax.php',{opt:'join',args:args},
			function(r) {
				var j = eval('(' + r + ')');
				if (j.error) {
					slf.html(html);
					$('input:radio[name="join_atype"]:checked', slf).removeAttr("checked");
					$('input[name]', slf).each(function() {
						if ($(this).attr('name') == 'join_atype') {
							if (args.join_atype == $(this).val()) {
								$('input:radio[value="' + args.join_atype + '"]', slf).attr('checked', 'yes');
							}
						} else {
							$(this).val(args[$(this).attr('name')]);
						}
					});
					alert(j.error);
				} else if (j.message) {
					slf.html('<br /><center><h3 style="width:auto;">You have succesfully registered!</h3>'
							 + '<div class="load01" style="margin-top:4px;">Please check your email for the '
							 + 'confirmation code and validate your email address.</div>'
							 + '<div class="load01" style="margin-top:10px;font-size:11px;">'
							 + 'You may now close this window.</div>'
							 + '</center>');
				} else {
					alert('[0x1jp01] Error Communicating With Server - Please try again');
				}
			}
		);
		return false;
	});
	<?php } ?>
});
<?php
		$c = ob_get_contents();
		ob_end_clean();
		return $c;
	}
	echo Utilities::JSPack(get_js_02());
?>
</script>
<?php
site_footer();
?>

template.php
 

<?php
$H_TEMPLATE = $F_TEMPLATE = array(
					'PAGE_TITLE' => '', 
					'TITLE' => '', 
				    'MESSAGES' => array(), 
				    'ERRORS' => array()
);

function join_page($ret = false) {
	$site_name = SITE_NAME;
	$html = <<< HTML
<div class="join_page">
	<form action="" method="POST" style="margin-bottom:10px;">
		<h3>Join {$site_name}</h3>
		<div class="mainhr" style="margin-bottom:5px;"></div>
		<div class="field">
			<div class="field_name">Your Name:</div>
			<div class="nspr inneri2 left"></div>
			<div class="nspr inneri2 bg">
				<input type="text" name="join_name" />
			</div>
			<div class="nspr inneri2 right"></div>
		</div>
		<div class="field">
			<div class="field_name">Your Email:</div>
			<div class="nspr inneri2 left"></div>
			<div class="nspr inneri2 bg">
				<input type="text" name="join_email" />
			</div>
			<div class="nspr inneri2 right"></div>
		</div>
		<div class="field">
			<div class="field_name">Re-type Email:</div>
			<div class="nspr inneri2 left"></div>
			<div class="nspr inneri2 bg">
				<input type="text" name="join_remail" />
			</div>
			<div class="nspr inneri2 right"></div>
		</div>
		<div class="field">
			<div class="field_name">Password:</div>
			<div class="nspr inneri2 left"></div>
			<div class="nspr inneri2 bg">
				<input type="password" name="join_pass" />
			</div>
			<div class="nspr inneri2 right"></div>
		</div>
		<div class="field">
			<div class="field_name">Re-type Password:</div>
			<div class="nspr inneri2 left"></div>
			<div class="nspr inneri2 bg">
				<input type="password" name="join_rpass" />
			</div>
			<div class="nspr inneri2 right"></div>
		</div>
		<div class="field">
			<div class="field_name">Account Type:</div>
			<div class="field_name" style="font-size:12px;">
				<div>
					<span style="width:50px;">
						<input type="radio" name="join_atype" value="1" checked="yes" />
					</span>
					Link Shrinker
					<div style="margin-left:25px;font-size:11px;">
						- Share links
					</div>
				</div>
				<div>
					<span style="width:50px;">
						<input type="radio" name="join_atype" value="2" />
					</span>
					Advertiser
					<div style="margin-left:25px;font-size:11px;">
						- Advertise your ads
					</div>
				</div>
			</div>
		</div>
		<div style="clear:both;"></div>
		<div class="field" style="margin-top:10px;">
			<div class="nspr inneri2 left dark"></div>
			<div class="nspr inneri2 bg dark">
				<input type="submit" name="join_sub" value="I AGREE TO THE TERMS & CONDITIONS, LET ME JOIN!" />
			</div>
			<div class="nspr inneri2 right dark"></div>
		</div>
		<div style="clear:both;"></div>
	</form>
</div>
HTML;
	if ($ret) return $html;
	echo $html;
}

function announcements($ret = false) {
	global $_GLOBAL;
	$html = '<div class="user_content"><h2>Announcements</h2>';
	if ($news = System::getDB()->getRows($_GLOBAL['TABLES']['NEWS'], '', '`date` DESC', '10')) {
		foreach ($news as $item) {
			$html .= '<div style="min-width:75px;float:left;font-weight:bold;">';
			$html .= date('d/m/Y', strtotime($item['date'])) . '</div>';
			$html .= '<div style="float:left;">' . $item['message'] . '</div>';
			$html .= '<div style="clear:both;height:5px;"></div>';
		}
	} else {
		$html .= '<em>none</em>';
	}
	$html .= '</div>';
	if ($ret) return $html;
	echo $html;
}

function site_header($show_shrinker = 0, $extra_links = null, $isAdmin = false, $cWidth = 85) {
	global $H_TEMPLATE;
	/* site_header() {{{ */
?>
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
	<title><?php echo $H_TEMPLATE['PAGE_TITLE']; ?></title>
	<meta name="keywords" content="short links, tinyurl, bitly, bit.ly, earn money, link advertising, tiny url, url shortener" />
	<meta name="description" content="Earn cash for each visitor to your shortened url links with <?php echo SITE_NAME; ?>!" />
	<meta name="robots" content="index,follow" />
	<META name="author" content="kaylor <support@adglo.be, adglo.be>">
	<META name="designer" content="kaylor">
	<meta name="copyright" content="Copyright 2014">
	<meta http-equiv="X-UA-Compatible" content="IE=8; IE=9" />
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<link rel="stylesheet" type="text/css" href="<?php echo SITE_LOCATION; ?>css/jq.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo SITE_LOCATION; ?>css/style.css.php" />
	<link rel="stylesheet" type="text/css" href="<?php echo SITE_LOCATION; ?>css/jquery.dataTables.css" />
	<!--[if lte IE 9]><script language="javascript" type="text/javascript" src="<?php echo SITE_LOCATION; ?>js/excanvas.min.js"></script><![endif]-->
	<script type="text/javascript" src="<?php echo SITE_LOCATION; ?>js/jquery.min.js"></script> 
	<script type="text/javascript" src="<?php echo SITE_LOCATION; ?>js/jquery.libs.js"></script>
	<script type="text/javascript" src="<?php echo SITE_LOCATION; ?>js/jquery.flot.min.js"></script>
	<script type="text/javascript" src="<?php echo SITE_LOCATION; ?>js/jquery.tablesorter.min.js"></script>
    
    <script>
 
$(document).ready(function() { 
 
    //select all the a tag with name equal to modal
    $('a[name=modal]').click(function(e) {
        //Cancel the link behavior
        e.preventDefault();
        //Get the A tag
        var id = $(this).attr('href');
     
        //Get the screen height and width
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();
     
        //Set height and width to mask to fill up the whole screen
        $('#mask').css({'width':maskWidth,'height':maskHeight});
         
        //transition effect    
        $('#mask').fadeIn(1000);   
        $('#mask').fadeTo("slow",0.; 
     
        //Get the window height and width
        var winH = $(window).height();
        var winW = $(window).width();
               
        //Set the popup window to center
        $(id).css('top',  winH/2-$(id).height()/2);
        $(id).css('left', winW/2-$(id).width()/2);
     
        //transition effect
        $(id).fadeIn(2000);
     
    });
     
    //if close button is clicked
    $('.window .close').click(function (e) {
        //Cancel the link behavior
        e.preventDefault();
        $('#mask, .window').hide();
    });    
     
    //if mask is clicked
    $('#mask').click(function () {
        $(this).hide();
        $('.window').hide();
    });        
     
});
 
</script>

</head> 
<body>
<?php if (System::getUser()->loggedIn() && !$isAdmin) { ?>
	<body style="background:url(images/main_bg2.jpg) top center no-repeat #242634">
    <div class="main_ctr"<?php echo ($isAdmin?" style='width:{$cWidth}%;'":''); ?>>
<?php } else { ?>
<div id="boxes">
 
     
    <!-- #customize your modal window here -->
 
    <div id="dialog" class="window">
        <div class="user_login">
	<form action="" method="POST">
		<h3>Current users, login:</h3>
		<div class="fields">
        	
			<div class="nspr inneri2 left"></div>
			<div class="nspr inneri2 bg">
				<input type="text" name="usr_email" value="<?php echo $usr_email; ?>" />
			</div>
			<div class="nspr inneri2 right"></div>
            <br><br>
			<div class="nspr inneri2 left"></div>
			<div class="nspr inneri2 bg">
				<input type="password" name="usr_pass" value="<?php echo $usr_pass; ?>" />
			</div>
			<div class="nspr inneri2 right"></div>
            <br><br>
			<div class="nspr inneri2 left dark"></div>
			<div class="nspr inneri2 bg dark">
				<input type="submit" name="usr_sub" value="LOGIN" />
			</div>
			<div class="nspr inneri2 right dark"></div>
		</div>
		<div class="field_opts">
			<div style="float: left; margin-right: 15px;">
				<input type="checkbox" name="usr_rmbr" value="1"<?php echo ($_COOKIE['USERNAME']&&$_COOKIE['PASSWORD']?' checked':''); ?>>
				Remember Me
			</div>
            <a href="forgot.php">Forgot Password?</a>
		</div>
	</form>
</div>
 
    </div>
 
     
    <!-- Do not remove div#mask, because you'll need it to fill the whole screen --> 
    <div id="mask"></div>
</div>
	<div class="main_ctr"<?php echo ($isAdmin?" style='width:{$cWidth}%;'":''); ?>>
    <?php } ?>
    <?php if (System::getUser()->loggedIn() == 2) {
	} else if (System::getUser()->loggedIn()) { 
	} else if ((System::getUser()->loggedIn() && !$isAdmin) || is_array($extra_links)) {
	} else {?>
    <div style="float:right; margin:0px; display:block;"><a href="#dialog" name="modal"><img src="images/login.png" /></a></div>
        <?php } ?>
		<div class="logo"<?php if ((System::getUser()->loggedIn() && !$isAdmin)||is_array($extra_links)) echo ' style="float: left;"'; ?>>
			<a href="index.php"></a>
		</div>
		<?php if (System::getUser()->loggedIn() && !$isAdmin) { ?>
		<div class="navigation"<?php if (is_array($extra_links)) echo ' style="margin-top:15px;"'; ?>>
			<a href="index.php?">Home</a>
			<?php if (System::getUser()->loggedIn() == 2) { ?>
			<a href="advertising.php">Create Campaign</a>
			<a href="referrals.php">Referrals</a>
			<?php } else { ?>
			<a href="referrals.php">Referrals</a>
			<a href="tools.php">Tools</a>
			<a href="withdraw.php">Withdraw</a>
			<?php } ?>
			<a href="account.php">Account</a>
			<a href="index.php?logout">Logout</a>
			<?php
				if (is_array($extra_links)) {
					echo '<br />';
					foreach ($extra_links as $k=>$v) {
						echo "<a href='{$v[0]}' style='float:right;margin:15px 4px;font-size:10px;'";
						if ($v[1]) echo " class='selected'";
						echo ">{$k}</a>";
					}
					$extra_links_handled = true;
				}
			?>
		</div>
		<?php
			}
			if (is_array($extra_links) && $extra_links_handled !== true) {
				echo '<div class="navigation">';
				$first_broker = false;
				foreach ($extra_links as $k=>$v) {
					if (isset($v[2]) && $v[2] && !$first_broker) {
						echo '<br /><br />';
						$first_broker = true;
					}
					echo "<a href='{$v[0]}' style='font-size:13px;";
					if (isset($v[2]) && $v[2]) echo 'float:right;';
					echo "'" . ($v[1] ? " class='selected'" : '') . ">{$k}</a>";
				}
				echo '</div>';
				echo '<div style="clear:both;"></div>';
			}
			
			echo '<div class="error_box" style="display:' 
				 . (!empty($H_TEMPLATE['ERRORS'])?'block':'none') . ';">';
			if (!empty($H_TEMPLATE['ERRORS'])) {
				if (count($H_TEMPLATE['ERRORS']) > 1) {
					echo '<div style="text-align:left;font-size:10px;margin-bottom:10px;">';
					echo count($H_TEMPLATE['ERRORS']) .  ' ERRORS HAVE OCCURED:</div>';
				}
				for ($i = 0; $i < count($H_TEMPLATE['ERRORS']); $i++) {
					echo $H_TEMPLATE['ERRORS'][$i];
					if ($i < count($H_TEMPLATE['ERRORS']) - 1) echo '<br />';
				}
			}
			echo '</div>';
			
			echo '<div class="message_box" style="display:' 
				 . (!empty($H_TEMPLATE['MESSAGES'])?'block':'none') . ';">';
			if (!empty($H_TEMPLATE['MESSAGES'])) {
				if (count($H_TEMPLATE['MESSAGES']) > 1) {
					echo '<div style="text-align:left;font-size:10px;margin-bottom:10px;">';
					echo count($H_TEMPLATE['MESSAGES']) .  ' MESSAGES:</div>';
				}
				for ($i = 0; $i < count($H_TEMPLATE['MESSAGES']); $i++) {
					echo $H_TEMPLATE['MESSAGES'][$i];
					if ($i < count($H_TEMPLATE['MESSAGES']) - 1) echo '<br />';
				}
			}
			echo '</div>';
		?>
		<noscript>
			<div style="padding: 5px; background-color: red; color: #ffffff; text-align:center; margin-top: 10px; margin-bottom: 10px;">
				Your browser currently does not support javascript or you have javascript turned off.
				This site will have very limited functionality without javascript.
				Please use a modern browser with javascript or enable the javascript option.
			</div>
		</noscript>
		<?php
			if (System::getUser()->loggedIn() != 2 && $show_shrinker) {
		?>
		<div class="shrink">
			<form action="" method="POST" style="margin:0;">
				<div class="nspr outeri left"></div>
				<div class="nspr outeri bg">
					<div class="nspr inneri left"></div>
					<div class="nspr inneri bg">
						<input type="text" name="adb_url" class="shrinker" value="<?php echo $adb_url; ?>" />
					</div>
                    <div class="nspr inneri left dark"></div>
					<div class="nspr inneri bg dark">
						<input type="submit" name="adb_sub" class="shrinker" value="SHRINK!" />
					</div>
					<div class="nspr inneri right dark"></div>
				</div>
				<?php
					if (System::getUser()->loggedIn() != 1) {
				?>
				<div class="nspr outeri right"></div>
				<?php
					} else if (System::getUser()->loggedIn() == 1) {
				?>
					<div class="ml_options">
						<div class="nspr outeri2 bg">More Options</div>
						<div class="nspr outeri2 right"></div>
					</div>
					<div style="clear:both;"></div>
					<div class="ml_options_box">
						<span style="float:left;width:125px;margin-top:6px;">Advertising Type:</span>
						<span style="float:left;">
							<select style="width:200px;" name="advert_type">
								<option value="1">Interstitial Advert ($$$$$)</option>
								<option value="2">Framed Banner ($$$)</option>
								<option value="3">No Advert</option>
							</select>
						</span>
						<div style="clear:both;height:10px;"></div>
						<span style="float:left;width:125px;margin-top:6px;">Custom Name:</span>
						<span style="float:left;">
							<input type="text" name="custom_name" maxlength="40" style="width:200px;" />
						</span>
					</div>
				<?php } ?>
			</form>
		</div>
		<?php	if (!System::getUser()->loggedIn()) { ?>
		<div class="joinbtn">
			<div class="nspr outeri2 left over"></div>
			<div class="nspr outeri2 bg over" >JOIN NOW</div>
			<div class="nspr outeri2 right over"></div>
		</div>
		<?php
					join_page();
				}
			} else if (System::getUser()->loggedIn()) echo '<div style="clear:both"></div>';
		
			if ($H_TEMPLATE['TITLE']) {
				echo "<h2 class='page_title'>{$H_TEMPLATE['TITLE']}</h2>";
			}
		?>
<?php
} /* }}} site_header() */
	
function site_footer($show_copyright = true) {
	global $F_TEMPLATE;
	/* site_footer() {{{ */
	if ($show_copyright) {
?>
		<div class="footer" style="padding-top:40px;">
			<span style="float:left;">
				© Copyright 2014 <?php echo SITE_NAME; ?>
			</span>
			<span style="float:left; margin-left:20px;">
				<a href="rates.php">Publisher Payouts</a> |
				<a href="privacy.php">Privacy</a> |
				<a href="terms.php">Terms</a> | 
				<a href="faq.php">FAQ</a> | 
				<a href="contact.php">Contact</a> | 
				<a href="http://facebook.com/adglobe">Facebook</a>
			</span>
            <span style="float:right;"><a href="https://www.paypal.com/" target="_blank"><img src="/images/pay.png" /></a></span>
			<div style="clear:both;"></div>
		</div>
	</div>
	<?php
	}
	if (!empty($F_TEMPLATE['ERRORS'])) {
		$errors = '';
		echo '<script type="text/javascript">';
		foreach ($F_TEMPLATE['ERRORS'] as $err) $errors .= $err . '\n';
		echo "alert('{$errors}');";
		echo '</script>';
	}
	?>
</body> 
</html>
<?php
} /* }}} site_footer() */
?>
Link to comment
Share on other sites

Sorry - but since I don't understand what "shorten links" means at all, and since your code doesn't help me to understand, I can't offer any help.

plz test main page by yourself and put link and click shrink button

then login with this details:

email: test@test.com

pass: 123456

and put link and click shrink button

the problem on main page not when you logged in

if index and template codes not helped you i will give you full script

full script: mediafire

vt: virustotal

thanks for followed my topic and sorry for my bad english

Edited by ForexSon
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.