This is how you should post it to get the most out of the forum. This is your home.ino file.
/*
Web server sketch for IDE v1.0.1 and w5100/w5200
Posted October 2012 by SurferTim
*/
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <Utility\Socket.h>
#include "Dns.h"
#include <Time.h>
int dmnhd=0; // domain hider value (automatically changed)
byte mac[] = {
0x00, 0x00, 0xAA, 0xBB, 0xCC, 0xDD }; //physical mac address
IPAddress ip(192, 168, 10, 150); // ip in lan
byte gateway[] = { 192, 168, 10, 254 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //8085 forwarded on parnasidos house
static byte g_TargetMacAddress[] = {0x00,0x24,0x1D,0x7D,0x54,0x25}; //for wol NaThAN-PC
IPAddress clientIP;
IPAddress loggedIP;
//char loggedip[]="";
char user[ ] = "admin"; // YOUR Username for Login
char pwd[ ] = "1234"; // YOUR Password for Login
int loggedin = 0;
//////////////////////
void setup()
{
Serial.begin(9600);
// disable w5100 while setting up SD
// uncomment next 5 lines if using a microSD card
pinMode(9,OUTPUT);
digitalWrite(9,LOW);
// Serial.print("Starting SD..");
// if(!SD.begin(4)) Serial.println("failed");
// else Serial.println("ok");
Ethernet.begin(mac, ip, gateway, gateway, subnet);
delay(2000);
server.begin();
Serial.println("Ready");
}
void loop()
{
if (loggedin==0){
login();
}
else if (loggedin==1){
if(loggedIP==clientIP){
digitalWrite(9, HIGH); // set pin 4 high
homepage();
}
else{
loggedin=0;
loop();
}
}
}
/////////////////////////
int freeRam() {
extern int __heap_start,*__brkval;
int v;
return (int)&v - (__brkval == 0 ? (int)&__heap_start : (int) __brkval);
}
If you want to check your code first for any exclamation marks. If you use three in a row like this, the code upload could fail. It causes the Mega bootloader to enter a monitor/debugging mode.
Serial.println("It works!!!");