Solved

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

Posted on 2014-12-09
8
73 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 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

803 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