It seems my PHP doesn't work when executing code following a question mark. Take for example, the following php code... as far as i can tell, it all looks fine.
Code: Select all
<?php
// links coded like this:
//<a href="out.php?site=http://juicystudio.com">Visit Juicy Studio</a>
### Define variables
$yoursite = "http://www.iamkoa.net/links/";
### Define database values
$dbhost = "localhost"; // database host
$dbuser = "----"; // database username
$dbpassword = "----"; // database password
$db2use = "----"; // name of database
function dbconnect()
{
global $dbhost, $dbuser, $dbpassword, $db2use;
$link = @mysql_connect($dbhost,$dbuser,$dbpassword)
or die("Connection failed: Please try later.");
@mysql_select_db($db2use,$link)
or die("Connection to database refused: Please try later.");
return $link;
}
// Connect to database
dbconnect();
if (!empty($site))
{
$qry = "SELECT hits FROM links WHERE site = '$site'";
$hitcounter = mysql_query($qry);
$hitcount = mysql_fetch_array($hitcounter);
$hits = $hitcountї0];
// next check if URL is in database
if ($hits == 0)
{
// if not then add it!
$newurl = "INSERT INTO links (site,hits) VALUES('$site',1)";
// Site already exists so just update the hit count
$newurl = "UPDATE links SET hits=$hits+1 WHERE site='$site'";
mysql_query($newurl);
mysql_close();
// re-direct to the required site as defined in the "out.php?site=" link
header ("Location: $site");
exit;
}
else
{
// site variable not entered, so redirect back to "yoursite" as defined above
header ("Location: $yoursite");
exit;
}
?>Here's an example:
http://www.iamkoa.net/links/out.php?sit ... adplus.com
The website above is in the proper MySQL database and table. Everything should work...
Any ideas of what's happening? Is this a PHP.ini problem?