09-01-17, 04:48 PM
السلام عليكم ورحمة الله نعالى وبركاته
وجدة هذا الكود مع الشرح في المنتدى لكن لم اتمكن من تطبيقه
هذا الكود تقوم بالدخول للموقع هذا عن طريق الكوكيز ارجو من لديه الخبرة في اللغة ان يعمل لنا مشروع مع الشرح وشكرا
وجدة هذا الكود مع الشرح في المنتدى لكن لم اتمكن من تطبيقه
كود :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public static string MD5(string STR)
{
ASCIIEncoding encoding = new ASCIIEncoding();
string str = string.Empty;
byte[] bytes = encoding.GetBytes(STR);
byte[] buffer2 = new MD5CryptoServiceProvider().ComputeHash(bytes);
foreach (byte num in buffer2)
{
str = str + num.ToString("x2");
}
return str;
}
public Encoding getEncoding(string url)
{
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse rs = (HttpWebResponse)rq.GetResponse();
return Encoding.GetEncoding(rs.CharacterSet);
}
CookieContainer _cookies = new CookieContainer();
private void button1_Click(object sender, EventArgs e)
{
Encoding charset = getEncoding("http://vb4arb.com/vb");
string Password = MD5("8798797");
string stringData = string.Format("vb_login_username={0}&vb_login_password=&vb_login_password_hint=%DF%E1%E3%C9+%C7%E1%E3%D1%E6%D1&cookieuser=1&s=&securitytoken=guest&do=login&vb_login_md5password={1}&vb_login_md5password_utf={1}",
"شكشوك", Password);
byte[] postData = charset.GetBytes(stringData);
HttpWebRequest LoginRequset = (HttpWebRequest)WebRequest.Create("http://vb4arb.com/vb/login.php?do=login");
LoginRequset.ContentType = "application/x-www-form-urlencoded";
LoginRequset.Method = WebRequestMethods.Http.Post;
LoginRequset.ContentLength = postData.Length;
LoginRequset.CookieContainer = _cookies; //مهم
LoginRequset.KeepAlive = true;
System.IO.Stream wr = LoginRequset.GetRequestStream();
wr.Write(postData, 0, postData.Length);
wr.Close();
using (HttpWebResponse LoginResponse = (HttpWebResponse)LoginRequset.GetResponse())
{
_cookies.Add(LoginResponse.Cookies);
}
//GET
//المتواجدون الان
HttpWebRequest onlineRequset = (HttpWebRequest)WebRequest.Create("http://vb4arb.com/vb/online.php");
onlineRequset.Method = "GET";
onlineRequset.CookieContainer = _cookies; //مهم
HttpWebResponse onlineResponse = (HttpWebResponse)onlineRequset.GetResponse();
webBrowser1.DocumentStream = onlineResponse.GetResponseStream();
}
}
}