Solved

Recording a click thru

Posted on 2007-11-30
2
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 21

Accepted Solution

by:
nizsmo earned 125 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 125 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

617 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