summaryrefslogtreecommitdiff
path: root/down
diff options
context:
space:
mode:
Diffstat (limited to 'down')
-rw-r--r--down/ajax.php6
-rw-r--r--down/http.php10
-rw-r--r--down/view/templ-index.php16
3 files changed, 22 insertions, 10 deletions
diff --git a/down/ajax.php b/down/ajax.php
index 63a63d1..f5a4ce6 100644
--- a/down/ajax.php
+++ b/down/ajax.php
@@ -11,9 +11,9 @@ if( !isset($_REQUEST["url"]) || $_REQUEST["url"] == "" ){
exit;
}
-function ipv6($host){
+function ipv6($ip){
- if ( filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) ) {
+ if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) ) {
return true;
}
@@ -40,7 +40,7 @@ switch($_REQUEST["action"]){
if ( !ipv6($_REQUEST["url"]) && filter_var(sanitizeUrl($_REQUEST["url"]), FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED) === false ){
echo "not valid";
} else {
- if( isUp($_REQUEST["url"]) ){
+ if( isUp($_REQUEST["url"], ipv6($_REQUEST["url"]) ) ){
$r["status"] = "Looks like it's up from here.";
$r["data"] = 1;
} else {
diff --git a/down/http.php b/down/http.php
index 9973cb4..5e0351d 100644
--- a/down/http.php
+++ b/down/http.php
@@ -1,7 +1,14 @@
<?php
-function isUp($url){
+function isUp($url, $ipv6 = false){
+
$agent = "Just checking if you are up or not.";
$ch=curl_init();
+
+ if ( $ipv6 ){
+ $url = "[".$url."]";
+ curl_setopt($ch,CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
+ }
+
curl_setopt ($ch, CURLOPT_URL,$url );
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_NOBODY, true);
@@ -11,6 +18,7 @@ function isUp($url){
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch,CURLOPT_SSLVERSION,3);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, FALSE);
+
$page=curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
diff --git a/down/view/templ-index.php b/down/view/templ-index.php
index cd67451..bfa68ab 100644
--- a/down/view/templ-index.php
+++ b/down/view/templ-index.php
@@ -4,8 +4,9 @@
<meta charset="utf-8">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
- <link rel="stylesheet" href="../tools/static/sweet-alert.css">
+ <!--link rel="stylesheet" href="../tools/static/sweet-alert.css"-->
<style>
+ <?php echo file_get_contents("../tools/static/sweet-alert.css"); ?>
<?php echo file_get_contents("../tools/style.css"); ?>
</style>
<noscript><style>.navbar{margin-bottom:0;}</style></noscript>
@@ -44,7 +45,7 @@
}
?>
<span class="input-group-btn">
- <button type="button" class="btn btn-default addButton" title="Clean Input" onclick="clean('#url');">C</button>
+ <button id="clear" type="button" class="btn btn-default addButton" title="Clean Input">C</button>
</span>
</div>
</div>
@@ -116,10 +117,13 @@
$(".fa-spinner").addClass("fa-spin");
- };
+ document.addEventListener('keydown', function(event) {
+ $("#url").focus();
+ });
- function clean(id){
- $(id).val('');
- }
+ $("#clear").click(function(){
+ $("#url").val('').focus();
+ })
+ };
</script>
<script defer src="../tools/static/sweet-alert.js"></script>