Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Recording a click thru

Posted on 2007-11-30
2
Medium Priority
?
215 Views
Last Modified: 2013-12-12
I am trying to figure out a good way to record a click thru on my new site.  I understand the concepts of having a second page which is redirected to that records the click, but I am stuck as to how to post across other data which I would also need to store (such as what link was clicked).

Here is the scenario.

The site lists advertisements for my clients.  Each advertisement is in the form of a product which they have listed on their site (i.e. on their e-commerce store).  My visitors find a product they are interested in and click to be taken to the site selling that product.  All nice and simple..

However, when they click the link and get redirected to my "clickthru.php" page (for example), how do I pass to the clickthru.php script what the product ID is for that particular item?

(I have actually just realised that I could actually use $_GET and embed the information in the URL calling my "clickthru.php" which would pass the data but my preference is very very much on keeping as much data $_POSTed rather than the more insecure $_GET (although I do escape all mysql variables)).

Just to check though, is there anyway to post this without creating a <FORM> for the links.

Cheers

Steve
0
Comment
Question by:ParadyneDesigns
2 Comments
 
LVL 21

Accepted Solution

by:
nizsmo earned 500 total points
ID: 20386910
Hi Steve

How about using session variables to pass through the data?
Something like this would work:

<?php
session_start();
// This has to be present on every page you want to access the variable

$_SESSION["click_url"] = "http://www.myurl.com";

//...more of your code...
session_write_close();
?>


then in your other pages you can access the click_url variable anywhere:
<?php
session_start();
echo $_SESSION["click_url"];
//.. more of your code..
session_write_close();
?>


Hope this shows you another way of going about it, apart from GET and POST methods which may be unreliable at times.
0
 
LVL 20

Assisted Solution

by:steelseth12
steelseth12 earned 500 total points
ID: 20387469
You could do it with javascript but its not worth it ... _POST is as insecure as _GET .....
What i do is send just an id ....  e.g clickthru.php?cid=43232 and get all the information from the database from there on.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this article, we’ll look at how to deploy ProxySQL.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Screencast - Getting to Know the Pipeline

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question