-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
77 lines (68 loc) · 1.47 KB
/
index.php
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
<html>
<head>
<title> Config wifi</title>
<style>
div.ssid {
position:absolute;
top : 100px;
left : 35%;
background: #FFFFFF;
padding: 20px;
width: 300px;
height: 150px;
margin:0px;
padding:10px;
}
label {
width:100px;
display: inline-block;
padding-bottom:5px;
}
div.topdiv {
border-top-right-radius: 10px;
border-top-left-radius: 10px;
background-color:#5291EA;
padding:10px;2
}
div.centrediv{
border-left:2px solid;
border-right:2px solid;
border-bottom:2px solid;
border-color: #5291EA;
padding:10px;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
span > input {
padding : 10px;
margin : 10px;
width : 250px;
}
</style
</head>
<body>
<?php if(isset($_POST['submit'])) {
if((!empty($_POST['ssid'])) && (!empty($_POST['psk']))){
$config = fopen("/etc/wpa_supplicant/wpa_supplicant.conf","a");
$text = "\n";
$text.= 'network={
ssid="'.$_POST['ssid'].'"
psk="'.$_POST['psk'].'"
}';
chmod($config,'0777');
fwrite($config,$text);
fclose($config);
}
}?>
<div class="ssid">
<div class="topdiv">Raspberry Pi Wifi Connection</div>
<div class="centrediv">
<form method="POST">
<label>SSID :</label> <input type="text" name="ssid" /><br />
<label>Password :</label> <input type="text" name="psk" /><br >
<span><input type="submit" name="submit" value="Connect to Wifi" /></span>
</form>
</div>
</div>
</body>
</html>