Problem with passed url
Posted: Sun May 25, 2008 10:40 am
I have the lines of code below calling hitCounter.php and passing it 2 parameters, tag and url. hitCounter.php has 2 purposes: first, to open the url of a external page and secondly to update the table (which works fine).
Opening the url's works some of the time and at others I get "the requested URL \$page\ was not found" when, in fact, the proper url's are being passed. Anyway, below is the calling line of code and then the program called:
Anyone have any ideas what I'm doing wrong? Thanking you in advance for any help you can provide.
Opening the url's works some of the time and at others I get "the requested URL \$page\ was not found" when, in fact, the proper url's are being passed. Anyway, below is the calling line of code and then the program called:
Code: Select all
// calling line
$destination = urlencode($url);
echo '<td class="title"><a href="hitCounter.php?tag='.$tag.'&url=' . $destination . '">'. $title .'</a></td><td></td>';Code: Select all
// hitCounter.php
<?php
// get url passed
$page = $_SERVER['QUERY_STRING'];
$page = urldecode($_GET['url']);
// open url passed
ob_start();
$uri = 'http://';
$uri .= $_SERVER['HTTP_HOST'];
header('Location: '.$uri.'/$page/');
// get tag passed from url
$search = $_SERVER['QUERY_STRING'];
$search = strtolower($_GET['tag']);
require_once('mysql_connect.php');
// update hit count
$result = mysql_query("UPDATE words SET count=count+1 WHERE root='$tag'");
?>