The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
I would like to have a counter that writes in a file how often a banner is clicked.
The script below works, but how do I add to this that once the banner is clicked this link in a (new) window opens up? I've tried everything, but nothing seems to work. I tried also to put ANOTHER a href with the link that needs to open in the new window after the existing a href. Then the link works, but the counter doesn't anymore! Please help??? PHP Code:
|
|
#2
|
|||
|
|||
|
have you tried putting target="_blank" after yes" ?
|
|
#3
|
|||
|
|||
|
Yes, i tried that also...
There will be a new window opened, however... Firefox than says that the page is not redirected correctly, and the counter increases with 21 !!! I just dont see how to go to another page when the ?click = yes. Edit: When using the target="_blank", the new window is called: http://www.mydomain/test.php?click=yes Edit 2: Lets say for test that the new page has to be google.com. <a href="http://www.google.com"> |
|
#4
|
|||
|
|||
|
I find that John's suggestion works, like this:
Code:
<a href="?click=yes" target="_blank"> but it just creates a new tab in FF each time (I think there is a way to specify that the new window be a smaller popup, if that's what you want). Edit: so you want a different site to open in a new window? This seems to work for me: Code:
<?php
if(!file_exists('counter.txt')){
file_put_contents('counter.txt', '0');
}
if($_GET['click'] == 'yes'){
file_put_contents('counter.txt', ((int) file_get_contents('counter.txt')) + 1);
header('Location: http://www.google.com');
die;
}
?>
<head>
<title>counter example</title>
</head>
<body>
<a href="?click=yes" target="_blank">Click</a>
</body>
</html>
|
|
#5
|
|||
|
|||
|
YES!!!!!!
Thanks Kh99 What i tried was: header('Location: ' . $_SERVER['http://www.google.com']); It was in the right direction, but that didn't work! |
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|