• Welcome to AcornDomains.co.uk, a friendly community for UK domain investors, developers and anyone interested in domain names.

    Whether you're looking to buy or sell domains, learn more about the UK domain market, get feedback on your names, or simply chat with other domainers, you're in the right place. AcornDomains has been bringing together people from across the UK domain industry for many years, from complete beginners to experienced investors.

    Have a look around, join the discussions and, if you haven't already, create a free account and introduce yourself.

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.
Top Bottom