summaryrefslogtreecommitdiff
path: root/down/view/templ-index.php
blob: 4186ed5229d6c2923a71e144ed9dd7663aff84cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!doctype html>
<html>
<head>
        <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"-->
	<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>
	<title>Is it down? | iamfabulous.de</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel='shortcut icon' href='../tools/favicon.ico' type='image/x-icon'>
</head>
<body>
	<?php require("../tools/navbar.php"); ?>
<div class="container">
	<div class="text-center">
		<div class="row">

		<form id="theform" class="form-horizontal">
		<fieldset>

		<!-- Form Name -->
		<legend>
			<h1>Uptime is the Game</h1>
			<p>Is your favourite website down?</p>
		</legend>

		<!-- Text input-->
		<div class="form-group">
		  <label class="col-md-4 control-label" for="url">Check if up: </label>  
		  <div class="col-md-4">
		  <div class="input-group">
		  <?php if ( isset($_REQUEST["url"]) && $_REQUEST["url"] != "" ){
		  ?>
		  <input id="url" name="url" placeholder="kernel.org" class="form-control input-md" required="" type="text" <?php echo 'value="'.htmlentities($_REQUEST["url"]) . '"'; ?> autofocus>
		  <?php
		  } else {
		  ?>
		  <input id="url" name="url" placeholder="kernel.org" class="form-control input-md" required="" type="text" autofocus>
		  <?php
		  }
		  ?>
		  <span class="input-group-btn">
		  	 <button id="clear" type="button" class="btn btn-default addButton" title="Clean Input">C</button>
		  </span>
		  </div>
		  </div>
		</div>

		<!-- Multiple Radios (inline) -->
		<div class="form-group">
		  <label class="col-md-4 control-label" for="action">Check Type:</label>
		  <div class="col-md-4 text-left"> 
		    <label class="radio-inline" for="action-0">
		      <input name="action" id="action-0" value="http" checked="checked" type="radio">
		      HTTP
		    </label> 
		    <label class="radio-inline" for="action-1">
		      <input name="action" id="action-1" value="ping" type="radio">
		      Ping
		    </label>
		  </div>
		</div>

		<!-- Button -->
		<div class="form-group">
		  <label class="col-md-4 control-label" for="submit"></label>
		  <div class="col-md-4">
		    <button type="submit" id="submit" name="" value="" class="btn btn-success">Check it</button>
		  </div>
		</div>

		</fieldset>
		</form>

		</div>
	</div>
</div>
	
	<?php require("../tools/footer.php"); ?>
	<script>
	window.onload = function(){

		$("#theform").submit( function(e){

			$.ajax({
				url: "",
				data: $("#theform").serialize(),
				dataType: "json",
				type: "GET",

				success: function( response ){
					
					if ( response.resp_code == 2 ) {
						var type = "success";
						var button= "btn-success";
					} else if ( response.resp_code == 1){
						var type= "warning";
						var button= "btn-warning";
					} else {
						var type= "error";
						var button= "btn-danger";
					}
					swal({
						title: response.host,
						text: response.status,
						type: type,
						confirmButtonClass: button
					});

				},
			});

			e.preventDefault();
		});

		$(".fa-spinner").addClass("fa-spin");

		document.addEventListener('keydown', function(event) {
			$("#url").focus();
		});

		$("#clear").click(function(){
			$("#url").val('').focus();
		})
	};
	</script>
	<script defer async src="../tools/static/sweet-alert.js"></script>