<?php
/* PHP Link Directory Copyright 2011 Robert Rook */
function validate_url($url) {
$match = '/^(http|ftp)\:\/\/[a-z0-9\-]{1,}\.[a-z0-9\.\-\/]{2,}$/i';
if(preg_match($match, $url)) { return true; }
return false;
}
function validate_email($email) {
$match = '/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]{2,})+$/i';
if(preg_match($match, $email)) { return true; }
return false;
}
function validate_reciprocal($url) {
/* Physically load and check the page for a link */
if(!ini_get('allow_url_fopen')) { return false; }
$htmlinkcode = file_get_contents("data/linkcode.txt");
$data = file_get_contents($url, null, null, -1, 250000);
if(strstr($data, $htmlinkcode)!==false) {
unset($data);
return true;
}
unset($data);
return false;
}
?>