GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Webmaster Q & Fuckin' A (https://gfy.com/forumdisplay.php?f=27)
-   -   PHP: Tracking incoming and outgoing its (https://gfy.com/showthread.php?t=1012921)

DirtyRider 03-04-2011 07:24 PM

PHP: Tracking incoming and outgoing its
 
I've seen $_SERVER['HTTP_REFERER'] used to track incoming hits. Is their anything more reliable then this?

Also, I was wondering if theirs a way to track outgoing hits some how? I don't want to use anything like out.php?s=domain.com. Maybe some Javascript onclick? Not sure how traffic trading scripts are really doing it.

Any help would be greatly appreciated :) Thanks.

Sexgenoten 03-13-2011 04:25 PM

I have no experience with trade scripts but if i would want to check on outgoing links i'd would do something like the following:

I'd have a href as a link with an id and a onmousedown function.

When the href is clicked, the onmousedown function would be triggered.

In this javascript function i'd retrieve the link and would use jquerys $.post to sent the information to an api page.

On the api page you would retrieve the information from the $_POST array and subsequently insert it into a database.

Make sure your api page only accepts incoming arrays from ur own domain.

GL!

daniel_webcams 03-14-2011 07:03 AM

you could use this java script : http://forum.lrytas.lt/topic_show.pl?tid=83254 works together with a small php code, not sure if the code work, but here's another another one as back up http://www.experts-exchange.com/Prog..._21661004.html

I think this is exactly what you need.

Dappz 03-14-2011 07:33 AM

not sure about this :)

robber 03-14-2011 10:50 AM

incoming would work as a refferer, but you could log them as incomings, but also record your ip for the current day and have a limitation as to how often someone will be logged on the system in the timeframe this would stop the same person repeatedly clicking a link, or produce a link code which ties into your system, thus meaning the trader would get nothing off a straight link they need to go through the link code

Rob

Sexgenoten 03-16-2011 12:25 AM

Well, i figured i too needed to track my outgoing traffic, so here is a fast and simpel javascript/jquery solution that works for me:

Code:

function outboudTraffic( obj ){
       
        // obj comes from a ahref
        // get the src of the ahref object
        var link = $( "#" + obj.id ).attr( "href");

        // post the link value as an clicked_link post variable ( $_POST['clicked_link'] )
        $.post("api.php",        {
               
                clicked_link                : link
       
       
                },  function(data){
       
                //i use this to alert debugging information
                //i turn it off when going live
                alert( data);                       
        });
       
}

On the api.php:

// make sure that the $_POST is coming from your domain and that you are not being
// spammed.
if ( isset( $_POST['clicked_link'] ) && !empty( $_POST['clicked_link'] ) ){

// insert it into a database
//

}

robber 03-25-2011 12:19 PM

You need to watch the script as:

Quote:

On the api.php:

// make sure that the $_POST is coming from your domain and that you are not being
// spammed.
if ( isset( $_POST['clicked_link'] ) && !empty( $_POST['clicked_link'] ) ){

// insert it into a database
//

}
could be easily spammed by being posted to by a cURL process :D, you need some sort of check for the requester to make sure it is your server

Otherwise, nice bit of code

Rob

Sexgenoten 03-26-2011 04:12 PM

Quote:

Originally Posted by robber (Post 18004678)
could be easily spammed by being posted to by a cURL process :D, you need some sort of check for the requester to make sure it is your server

Very true. As i havent implement security yet, i have no example code but i can tell what im going to do.

I think there are 2 options ( i might implement both ):

1. Check de $_SERVER array on the api page. I'm not sure if the desired information will be there as its a jquery post, but i think it will be.

2. Have hidden input array with session_id, logged_in_status encrypted with a set key and use base64_encode on it ( server side ). This much i already have ;)

Make an active table in the db and have javascript send a $.post every 15 min to the api to update the active table.

Then, when a request comes in to insert a new link, you can check if the last active entry in the table of the session, is within 15 min. If so, insert the link, if not, no action. ( perhaps log it, so you can see whose trying to screw u over or to check if your code isnt screwed up ;) )

I'll prolly end up implementing both ;)


All times are GMT -7. The time now is 03:29 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123