diff --git a/public_html/api/links.php b/public_html/api/links.php new file mode 100644 index 0000000..c01dd93 --- /dev/null +++ b/public_html/api/links.php @@ -0,0 +1,24 @@ +hostname,$db_config->username,$db_config->password,$db_config->database); + +$key = $_GET['link_key']; +if($key != $api_config->key) die('{"message":"Access Denied."}'); + +$url = $_GET['url']; +$title = $_GET['title']; + +if(filter_var($url,FILTER_VALIDATE_URL) == false || !preg_match('{http://}',$url)) + die('{"message":"Malformed URL."}'); + +if($db->connect_error) die('{"message":"No Database Connection."}'); + +$db->query("INSERT INTO wia_links (url,text,status) VALUES ('$url','$title',0)"); +if($db->error) die('{"message":"Could Not Add."}'); + +$db->close(); +?> +{} \ No newline at end of file