";$lang="NULL";}else{$lang="'".$lang."'";}
$Mcon->close();
}else{
echo "Language is helpful
";
}
if (isset($_POST['SiteName']) and $_POST['SiteName']!==""){
$SiteName=$_POST['SiteName'];
$name=htmlentities($SiteName,ENT_QUOTES|ENT_HTML5,'UTF-8');
$name="'".str_ireplace('\'',''',$name)."'";
echo "Valid SiteName: ".$name."
";
}else{
echo "Must have Site Name";
exit;
}
if (isset($_POST['url']) and $_POST['url']!==""){
$url=mb_trim($_POST['url'],"/");
if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$url)){
echo "Must have VALID Site Address";
exit;
}else{
if (!test_channel($url)){
echo "Must have VALID Site Address";
exit;
}else{
echo "Valid Address: ".$url." ";
$aa="SELECT * FROM tidysearch.sites WHERE sites.url LIKE '%".$url."%';";
$ab=pg_fetch_array(pg_query($TS_con,$aa));
if (!isset($ab['index'])){
$site_INSERT="INSERT INTO tidysearch.sites (index,remoteid,url,name,_lang)VALUES(".$dex.",".$dex.",'".$url."',".$name.",".$lang.");";
}else{
echo "Found that URL";
}
echo "
";
}
}
}else{
echo "Must have VALID Site Address";
exit;
}
if (isset($_POST['rss']) and $_POST['rss']!==""){
$rss=mb_trim($_POST['rss'],"/");
if (filter_var($rss,FILTER_VALIDATE_URL)){
if (!test_channel($rss)){
echo "INVALID RSS Address";
exit;
}else{
if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$rss)){
echo "INVALID RSS Address";
exit;
}else{
echo "Valid RSS Address: ".$rss." ";
$aa="SELECT * FROM tidysearch.sites WHERE sites.url LIKE '%".$url."%';";
$ab=pg_fetch_array(pg_query($TS_con,$aa));
if (!isset($ab['index'])){
$rss_INSERT="INSERT INTO tidysearch.sites_rss (sitesid,remoteid,url,sitename)VALUES(".$dex.",".$dex.",'".$rss."',".$name.");";
}else{
echo "Found that RSS";
}
echo "
";
}
}
}
}else{
echo "RSS Address is helpful ";
}
if (isset($_POST['email']) and $_POST['email']!==""){
$email=$_POST['email'];
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo "Invalid email format: ".$email."
";
}else{
echo "Your email is only used to thank you if we add it
";
}
}else{
echo "Your email is only used to thank you if we add it
";
}
if (!is_null($name) and !is_null($url) and !is_null($rss)){
echo "".$site_INSERT."
".$rss_INSERT."
";
// Send alert to XMPP bob@mpaq.org
if (isset($lang)){
$INSERT="INSERT INTO recommend (name,url,rss,lang)VALUES(".$name.",'".$url."','".$rss."',".$lang.");";
}else{
$INSERT="INSERT INTO recommend (name,url,rss)VALUES(".$name.",'".$url."','".$rss."');";
}
echo $INSERT;
pg_query($TS_con,$INSERT);
}
header("Refresh:1; url=/");
echo "
";
var_dump($_POST);
exit;
/*
*/
?>
Thank you, sending you back to TidySearch