Location: PHPKode > scripts > LinkShort > LinkShort/checklink.php
<?php

session_start();

include('includes/settings.inc.php');
include('includes/functions.inc.php');
include('includes/db.inc.php');

$hdrtheme = file_get_contents('themes/header.theme.html');
$ftrtheme = file_get_contents('themes/footer.theme.html');
$chktheme = file_get_contents('themes/checklink.theme.html');
	
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
	if(isset($_POST['url']) && !empty($_POST['url'])){
		$url = htmlspecialchars($_POST['url'],ENT_QUOTES);
		$key = substr(strrchr($url, "/"), 1);
		$result = mysql_query('SELECT * FROM links WHERE UID = "'.$key.'" LIMIT 1') or die();
		$cnt = mysql_num_rows($result);
		if($cnt > 0){
			$row = mysql_fetch_array($result);
			$datatable = '<div style="font-weight:normal;padding:20px;margin:auto;width:80%;text-align:left">
			<table border="0" cellspacing="0" cellpadding="2" style="width:100%">
				<tr><td colspan="2" align="center">Stats for <strong>'.$url.'</strong></td>
				<tr><td align="right"><strong>Key:</strong> </td><td align="left">'.$row['UID'].'</td></tr>
				<tr><td align="right"><strong>URL:</strong> </td><td align="left">'.$row['MURL'].'</td></tr>
				<tr><td align="right"><strong>Entry Date:</strong> </td><td align="left">'.$row['ENTRYDATE'].'</td></tr>
				<tr><td align="right"><strong>Number of Clicks:</strong> </td><td align="left">'.$row['COUNT'].'</td></tr>
				<tr><td align="right"><strong>Last Click:</strong> </td><td align="left">'.$row['LASTCLICK'].'</td></tr></table></div>';
			$chktheme = str_replace('%LINKSTATUS%',$datatable,$chktheme);
		}else{
			$msg = '<div style="padding:20px;margin:auto;width:80%;text-align:left">The web address you entered does not exist or has already been removed from the system.  If you want to maintain links please register.<br /><br /></div>';
			$chktheme = str_replace('%LINKSTATUS%',$msg,$chktheme);
		}
		
	}
}else{
	$chktheme = str_replace('%LINKSTATUS%','',$chktheme);
}

	$entirepage = $hdrtheme.$chktheme.$ftrtheme;
	if (strrpos($entirepage, '%LOGIN%') > 0){
		if($_SESSION['ID']){
			$entirepage = str_replace('%LOGIN%','<span><a href="users.php?act=logout">logout</a></span><span><a href="users.php">user area</span></a>',$entirepage);
		}else{
			$entirepage = str_replace('%LOGIN%','<span><a href="users.php">login</a></span>',$entirepage);
		}
	}
	echo $entirepage;

?>
Return current item: LinkShort