Solved

how to get the Get variables from a link clicked in an email

Posted on 2014-12-09
8
69 Views
Last Modified: 2014-12-15
Hi

How do i get the get variables from a link clicked in an email?

I've seen parse_str but i dont know how to make sure the data is safe

do i use html_special_chars or strip_tags or preg_replace.i I was thinking something like this...assuming here just one variable $data


$data = strip_tags($data');
$data = preg_replace('/on[a-z]+=\".*\"/i', '', $data);

Thank you
0
Comment
Question by:andieje
  • 3
  • 3
  • 2
8 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40490125
Example link?
If it's just standard querystring name pairs then

    $name = $_GET['name'];
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40490130
It is no different than a link with a query string in a web page.  You use the $_GET variables to retrieve them.  This page shows simplified ways of handling them: http://www.w3schools.com/php/php_forms.asp   There is also a page there about handling email variables and checking them.
0
 

Author Comment

by:andieje
ID: 40492566
How do i make them safe? I want one of the get variables to be an email. thanks
0
 
LVL 58

Expert Comment

by:Gary
ID: 40492572
Safe to do what?
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:andieje
ID: 40492581
safe to store in datbase and then echo to string

I want all javascript tags removing and to be on the safe side all html takgs too for now please


I didnt know what to do wht the @ and - and _ and chracters like that in an email address

thanks.
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40492584
Use strip_tags

    $email = strip_tags($_GET['email]);

I didnt know what to do wht the @ and - and _ and chracters
You don't do anything, they are valid in email adresses
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40492714
I agree with Gary.  I have hundreds of forms out there that have email addresses as inputs.  You must accept those characters in an email because they are valid parts of an email.  This page http://en.wikipedia.org/wiki/Email_address shows what characters are valid in an email address.
0
 

Author Closing Comment

by:andieje
ID: 40501553
excellent
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to count occurrences of each item in an array.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now