$license = $_POST['license'];
$document_root = $_POST['doc'];
$website_url = $_POST['url'];
$server_ip = $_POST['ip'];
if ( !preg_match ('/^[a-zA-Z0-9]+$/', $license ) ) #alphanumeric
{
echo $_POST['license'].'<br />';
}
if ( !preg_match ('/^[0-9\.]+$/', $server_ip ) || strlen ($server_ip)>15 ) ##Ip only
{
echo $_POST['ip'].'<br />';
}
if ( !preg_match ('/^(http:\/\/)?(www\.)?[a-z0-9\/\.-]+$/i', $website_url ) )##domain name
{
echo $_POST['url'].'<br />';
}
if ( !preg_match ( '/^[a-z0-9_-]+$/i', $document_root ) )##
{
echo $_POST['doc'];
}
Its not the best coding ever but it all works apart from the document root. I'm echoing all that fail so I can tweak it and see what may be getting through.
What I would like to do is match /home/user/public_html and any other type of root path associated with hosting accounts. I.e does windows server use backslashes?
If someone could optimize the above for me or just help fix the document root part it would be a great help.