Solved

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

Posted on 2014-12-09
8
92 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
[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
  • 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 83

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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 58

Expert Comment

by:Gary
ID: 40492572
Safe to do what?
0
 

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 83

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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
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 dynamically set the form action using jQuery.

696 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