Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: URL redirects and count clicks  (Read 128 times)

sibas

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 451
    • www.simply4all.net
URL redirects and count clicks
« on: January 23, 2013, 11:57:18 AM »

Hello
I try to make this simple mod work but Iím facing problems.

Here are the steps I make

1) alter articles
Quote
ALTER TABLE articles ADD linkcount INT( 11 ) NOT NULL DEFAULT '0';

2) In function articles()
find the first $query_articles = 'SELECT
and add after the a.visible
Code: [Select]
,a.linkcount
3) Find
if ($r['displaytitle'] == 'YES') {

before of this add the following
Code: [Select]
$uviews = $r['linkcount'];
if (isset($_GET['go'])){
if (empty($_GET['go'])) {
$go = _SITE;
} else {
$go = clean(cleanXSS($_GET['go']));
if ($go){
$uviews++;
$linkUpdate = "UPDATE "._PRE."articles SET linkcount = $uviews WHERE id = $_ID";
mysql_query($linkUpdate);
}
}
header("Location: $go", true, 301);
exit;
}

4) in any article add the following link
Code: [Select]
<a href="http://127.0.0.1/snews1.7/?go=http://snewscms.com">sNews</a>
5) click the link to try!

6) Help me to find why Is not work the mysql update!

Any idea??

PS: The mysql update is working if you added after the
Code: [Select]
if (isset($_GET['go'])){
...
...
}
$uviews++;
$linkUpdate = "UPDATE "._PRE."articles SET linkcount = $uviews WHERE id = $_ID";
mysql_query($linkUpdate);
echo $uviews;

 ???
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: URL redirects and count clicks
« Reply #1 on: January 23, 2013, 03:38:50 PM »

It might help if you described what you want to do with this mod... like... what is it supposed to do? That might provide a clue as to what might be missing or what additional changes might need to be made to make it work.  ;)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

sibas

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 451
    • www.simply4all.net
Re: URL redirects and count clicks
« Reply #2 on: January 23, 2013, 03:52:13 PM »

:D I thought the topic says what supposed to do!
I want to count the clicks when someone makes click on specific link.
Logged