Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void data()
- {
- if(SPIFFS.exists("/login.html"))
- {
- Serial.println();
- }
- else{
- SPIFFS.begin();
- File f=SPIFFS.open("/login.html","w");
- String s="<html><head><title>AP</title><h1>Welcome to AP page</h1>n";
- s+="</head><body><form name="/myform" action="/login" method="POST">n";
- s+="<input type="text" name="username" placeholder="username"><br/>n";
- s+="<input type="password" name="password" placeholder="password"><br/>n";
- s+="<input type="submit" value="login"></form></body></html>";
- f.println(s);
- f.close();
- }
- }
- WiFi.mode(WIFI_AP_STA);//Only Access point
- WiFi.softAP(ssid, password); //Start HOTspot removing password will disable security
- IPAddress myIP = WiFi.softAPIP(); //Get IP address
- Serial.print("HotSpt IP:");
- Serial.println(myIP);
- server.on("/", HTTP_GET, handleRoot); //Which routine to handle at root location
- server.on("/",HTTP_POST,handlelogin);
- server.onNotFound(handleerror);
- server.begin();
- void handleRoot()
- {
- SPIFFS.begin();
- File f=SPIFFS.open("/login.html","r");
- server.send(200, "text/html",f.readStringUntil('EOF'));
- }
Add Comment
Please, Sign In to add comment