entity Posted June 29, 2006 Share Posted June 29, 2006 Hi there.Recently I have been developing My MySQL and PHP skills, and so far so good. Well I've come across a little problem while trying to write a little script that counts my affiliates hits in and out. Well I've done the code so it sends the members out and in with special links, but for some reason it just wont update the amount of hits in or out! This is where I need a little help. I am currently working with MySQL version 5.0.18 and have been used to v4 for too long, I've had to go through a lot of things and add the connection code to queries and add an i after every single mysql. Anyway, here is the code, please help me![code]<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Entitys Arena » Re-Directing » Your Source For Final Fantasy!</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> <meta name="author" content="entity" /> <meta name="robots" content="index,follow,all"> <meta name="description" content="Entitys Arena is a site dedicated to several things, Final Fantasy, Transformers and other such things. Always updating and expanding we hope to become one of the most reliable and most used websites for our catergory!" /> <meta name="keywords" content="Final Fantasy, Transformers, Webdesign, Graphics, Images, Tutorials, Downloads, Media, Final Fantasy Images, Transformers Images, Final Fantasy VII, Final Fantasy VIII, Final Fantasy IX, Final Fantasy X, Final Fantasy XII, Final Fantasy XIII, Materia, Eidolons, Aeons, Bahamut, Sephiroth, Cloud, Final Fantasy VII: Advent Children, Advent Children, Magic, Skills, Items, Weapons, Armour, Monsters, Strategy Guides" /> <meta http-equiv="imagetoolbar" content="no" /> <link rel="stylesheet" type="text/css" href="http://entitys-arena.co.uk/stylesheets/ne/style.css" /> <script language="Javascript" type="text/javascript"> window.defaultStatus = " Entitys Arena -->> Affiliate Redirection. " </script> <?php // include the connect.php require_once("./inc/config.php"); // count clicks $mode = $_GET['mode']; $id = htmlspecialchars($_GET[id]); // get the mode // a switch is like a series of ifs and elses, but in less space, and more efficent if($mode == "in") { $id = htmlspecialchars($_GET[id]); // for incomming hits, log and redirect to site index $NEED = mysqli_query($con, "SELECT * FROM affiliates WHERE id='$id' LIMIT 1") or die (mysql_error()); //just need to count() while($get = mysqli_fetch_array($NEED)) { $id = $get['id']; $in = $get['in']; $out = $get['out']; $url = $get['url']; $name = stripslashes($get['name']); $img = stripslashes($get['banner']); $user = $get['user']; $insert = mysqli_query($con, "UPDATE affiliates SET in=(in+1) WHERE id='$id'"); echo("<meta http-equiv=\"refresh\" content=\"3; URL=http://entitys-arena.co.uk\" />\n"); echo("</head>\n"); echo("<body>\n"); echo("<br /><br /><br /><br /><br /><br />\n"); echo("<div align=\"center\">\n"); echo("<table cellpadding=\"0\" cellspacing=\"0\" class=\"infotable\">\n"); echo("<tr class=\"infohead\"><td>Entitys Arena Affiliate Redirection ~ $mode</td></tr>\n"); echo("<tr><td>\n"); echo("Redirecting from <a href=\"$url\">$name</a><br />\n"); echo("<div align=\"center\"><img src=\"$img\" alt=\"$name\" /></div>\n"); echo("</tr></td>\n"); echo("<tr class=\"infofoot\"><td>Hits In: $in | Hits Out: $out | User: $user</td></tr>\n"); echo("</table>\n"); echo("</div>\n"); echo("</body>\n"); } } elseif($mode == "out") { $id = htmlspecialchars($_GET[id]); // for outbound hits, log and redirect to affiliates site $NEED = mysqli_query($con, "SELECT * FROM affiliates WHERE id='$id' LIMIT 1") or die (mysql_error()); //just need to count() while($get = mysqli_fetch_array($NEED)) { $id = $get['id']; $mode = $_GET['mode']; $out = $get['out']; $in = $get['in']; $url = $get['url']; $name = stripslashes($get['name']); $img = stripslashes($get['banner']); $user = $get['user']; $insert = mysqli_query($con, "UPDATE affiliates SET out=(out+1) WHERE id='$id'"); echo("<meta http-equiv=\"refresh\" content=\"3; URL=$url\" />\n"); echo("</head>\n"); echo("<body>\n"); echo("<br /><br /><br /><br /><br /><br />\n"); echo("<div align=\"center\">\n"); echo("<table cellpadding=\"0\" cellspacing=\"0\" class=\"infotable\">\n"); echo("<tr class=\"infohead\"><td>Entitys Arena Affiliate Redirection ~ $mode</td></tr>\n"); echo("<tr><td>\n"); echo("Redirecting to <a href=\"$url\">$name</a><br />\n"); echo("<div align=\"center\"><img src=\"$img\" alt=\"$name\" /></div>\n"); echo("</tr></td>\n"); echo("<tr class=\"infofoot\"><td>Hits In: $in | Hits Out: $out | User: $user</td></tr>\n"); echo("</table>\n"); echo("</div>\n"); echo("</body>\n"); } // header("Location: $url"); } ?> [/code]Thank you very much!Made a newer style for it, still doesn't work though! Quote Link to comment https://forums.phpfreaks.com/topic/13189-affiliate-system-problems/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.