hi every one , i just try to create bot for travian , i find some login code
//download html
WebClient client = new WebClient();
client.Encoding = System.Text.Encoding.UTF8;
string source = client.DownloadString(@"Http://" + server + "/login.php");
source = source.Replace("\"", "");
//search for user
Regex rloginName = new Regex(@"name=login value=\w*");
Match mloginName = rloginName.Match(source);
if (mloginName.Success)
{
string loginName = mloginName.ToString().Replace(@"name=login value=", "");
}
//search for pass
Regex rloginPassword = new Regex(@"type=password name=\w*");
Match mloginPassword = rloginPassword.Match(source);
if (mloginPassword.Success)
{
string loginPassword = mloginPassword.ToString().Replace(@"type=password name=", "");
}
Regex rloginUsername = new Regex(@"input class=fm fm110 type=text name=\w*");
Match mloginUsername = rloginUsername.Match(source);
if (mloginUsername.Success)
{
string loginUsername = mloginUsername.ToString().Replace(@"input class=fm fm110 type=text name=", "");
}
Regex rloginRand = new Regex(@"<p align=center><input type=hidden name=\w*");
Match mloginRand = rloginRand.Match(source);
if (mloginRand.Success)
{
string loginrand = mloginRand.ToString().Replace("<p align=center><input type=hidden name=", "");
}
string postString = @"w=1024:768&login=" + loginName + "&" + loginUsername + "=" + user + "&" + loginPassword + "=" + pass + "&" + loginrand + "=&s1.x=10&s1.y=10&s1=login";
WebRequest req = WebRequest.Create(@"http://" + server + "/dorf1.php");
req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(postString);
req.ContentLength = bytes.Length;
req.ContentLength = bytes.Length;
Stream os = req.GetRequestStream();
os.Write(bytes, 0, bytes.Length);
os.Close();
WebResponse resp = req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
but when i try to run i see this error ,
Form1.cs(67,144): error CS0103: The name 'loginrand' does not exist in the current context error CS0103: The name 'loginPassword' does not exist in the current context error CS0103: The name 'loginUsername' does not exist in the current context error CS0103: The name 'loginName' does not exist in the current context
can some one help