| |||||||
This is a discussion on Google Analytics - PHP within the Website Discussion forums, part of the Websites category; Not sure how you can get this to work as you cannot run anything with an output before the redirect. ...
![]() |
| | Thread Tools |
| | #21 |
| Looking for a new job!! | Not sure how you can get this to work as you cannot run anything with an output before the redirect. The only possible solution would be to use output buffering but there is no guarantee that this would run the complete javascript for the analytics code before redirecting.
__________________ |
|
| | #22 |
| Currently: Moderating! | Hmm, I guess I'll just have to leave it. Was just hoping I could do some more in depth analysis of what links worked best. Thanks anyway for trying!
__________________ Spoiler Free iPhone | Free iPhone | Free iPad 3 | Sign Define App | Freebie Proof Photo Blog Total Received: £7,446.87 plus Current Stats: 0 green 12 pending WIN an iPod Shuffle, XBox Live, Amazon or iTunes vouchers >> Free competition entry here << Spoiler Spoiler Spoiler |
|
| | #23 |
| Looking for a new job!! | The best bet would be to include a counter on the links. Might be something to ask Charlie about
__________________ |
|
| | #24 |
| iPod 30gb Join Date: Aug 2009 Location: Widnes
Posts: 1,090
![]() | I assume your trying to find out if ?id=freeipod is clicked more than ?id=freeipad ? You could just have one redirect page and use the ?id=XXXXX tags so like Code: <?php
$site = $_GET['id'];
$sql = mysql_query("SELECT * FROM `clicks` WHERE `site` = '$site'");
$row = mysql_fetch_array($sql);
$old = $row['clicks'];
$new = $old +1;
mysql_query("INSERT INTO `clicks` (`id`, `amount`) VALUES ('$site', '$new')");
REDIRECT CODE
__________________ Totally Free iPad | McFlurry Ice Cream Van Everything I say reflects my own opinions and not that of any company. |
|
| | #25 |
| Looking for a new job!! | Could you not simply expand on that and still use the same redirect code from the _GET statement after the counter had been added to? The parameter will still be the same even after the click has been added to the database Or am I missing something again. p.s. You will also have to put in the SQL connect parameters. I am going to have a play around with this later as I want to incorporate the redirect on my site and would like it to count clicks. Will let you know how I get on.
__________________ Last edited by ndev2k; 30-11-11 at 01:53 PM.. |
|
| | #26 | |
| Mini Mac | Quote:
For example, if I went to yourfile.php?id='; DROP TABLE `clicks`;--, assuming I haven't made any mistakes, I could delete your table | |
|
| | #27 |
| iPod 30gb Join Date: Aug 2009 Location: Widnes
Posts: 1,090
![]() | I have a script set up on my pc that everytime I use $_GET it rewrites it to the escape, was using my macbook for that and so didn't set textexpander up for it. But yes, use charlie's so it would be $site = mysql_real_escape_string($_GET['id']);
__________________ Totally Free iPad | McFlurry Ice Cream Van Everything I say reflects my own opinions and not that of any company. Last edited by cono1717; 30-11-11 at 03:59 PM.. |
|
![]() |
| Thread Tools | |
| |