Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

php

Status
Not open for further replies.
Try this

Code:
function check_input($data)
{
    $data = htmlspecialchars($data);
    return $data;
}
if(isset($_GET['name']))
{
$domain = check_input($_GET['name']);
}
 
If you know the domain then below, otherwise if domain.php is parsing the url and you know the query parameter then GET as above. parse_url very useful if the whole url changes or you're wading through a list of urls. Example assumes one name=domain parameter, more with & will need more work.

Code:
$url_data = parse_url($url);
$query_data = $url_data['query'];
$query_data = explode('=', $query_data);
$domain = $query_data['name'];
 
Thats Great! Thanks for your help guys, ill post the url when done in the website review section :)
 
I always add checks, on the lengths, and the nature, if your expecting a number, then check is_numeric, check it as much as possible before allowing it out into the open as it were.
 
Don't just get the data from URL and process it how you want. It could be anything whatsoever.

Anyone can go to your page www.sitename/domain.php?name=domainName
and change "domainName" to be any data they want.
Your script will then happily take that data and process it, which could be an attack attempt etc.

You need to check the data, ideally from a whitelist of data you know it can only be (ie a list of domain names) or at least check there are no bad chars which cannot be in a domain name.
I'd weed out " ' < and > for starters
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members online

No members online now.

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom