private void Aviso(string descripcion, string archivo, string direccion) { if (chkEmail.Checked) { if (txtServidor.Text != "" && txtEmail.Text!="") { SmtpClient client = new SmtpClient(txtServidor.Text); client.Credentials = new NetworkCredential("HMOMARTINREA\\ecarrillo", "Troya2016"); MailMessage mail = new MailMessage("[email protected]", txtEmail.Text); mail.Subject = "Archivo " + descripcion + ": " + archivo ; mail.Body = direccion; mail.BodyEncoding = Encoding.UTF8; mail.IsBodyHtml = false; try { client.Send(mail); } catch (Exception ex) { string es = ex.ToString(); } } } if (chkAlerta.Checked) { TaskbarNotifier tn = new TaskbarNotifier(); tn.SetBackgroundBitmap("skin.bmp", Color.FromArgb(255, 0, 255)); tn.SetCloseBitmap("close.bmp", Color.FromArgb(255, 0, 255), new Point(127, 8)); tn.TitleRectangle = new Rectangle(40, 9, 70, 25); tn.ContentRectangle = new Rectangle(8, 20, 133, 88); tn.ReShowOnMouseOver = true; tn.StackPosition = position++; tn.ContentClick += new EventHandler(Notifier_ContentClick); tn.VisibleChanged += new EventHandler(Notifier_VisibleChanged); tn.Tag = direccion; tn.Visible = true; tn.Show(descripcion , archivo , 250, 1500000000, 250); Thread.Sleep(1000); } if (chkSonido.Checked) { WSounds ws = new WSounds(); ws.Play("beep.wav", ws.SND_FILENAME | ws.SND_ASYNC); } }
void webBrowser_NavigateComplete2(object pDisp, ref object URL) { // If the site or url is null, do not continue if (pDisp == null || URL == null) return; // Access both the web browser object and the url passed // to this event handler SHDocVw.WebBrowser browser = (SHDocVw.WebBrowser)pDisp; // 웹브라우저가 페이지 이동 중에 만드는 웹브라우저 메소드(webBrowser와 browser은 페이지 이동 중에 딱 한 번 일치한다.) // 이를 이용해 한번만 검사하도록 변경한게 if (webBrowser.LocationURL.Equals(browser.LocationURL)) string url = URL.ToString(); int rating = 0; IHTMLDocument2 document = null; if (webBrowser.LocationURL.Equals(browser.LocationURL) && check) // 현재 이동하는 페이지가 사용자가 URL창에 입력한 주소와 동일한지 체크 // 혹은 이미 체크했는지 체크(안하면 차단 페이지에 못들어가고 // 원래 URL -> 차단 페이지의 버튼 누르면 들어가지는 URL(php 페이지의 burl)의 변수로 들어감 -> 또들어감 -> 또들어감 의 반복 { /* 6월 18~19일 내용 수정 * 차단 php 페이지 띄우도록 변경 */ // Grab the document object off of the Web Browser control document = (IHTMLDocument2)webBrowser.Document; if (document == null) return; rating = DBConnector.GetSiteInfo(url); if (rating > 0) { check = false; } } if (rating <= 0) { // This is Safe Site. // Pass the current URL to the broker PassUrlToBroker(url); } else if (rating >= 1 && rating <= 25) { // 낮은 점수의 페이지에 접근하면 화면 오른쪽 하단에서 메신저 // 알림 올라오듯이 만드려고 한거, 근데 작동안함, 하지만 에러가 아예 없어 뭐가 문제인지 파악불가 // This is Reported Site. But Not Blocked Site // Pass the current URL to the broker TaskbarNotifier tNotify = new TaskbarNotifier(); tNotify.SetBackgroundBitmap("popup.bmp", Color.FromArgb(0, 0, 0)); tNotify.SetCloseBitmap("close.bmp", Color.FromArgb(0, 0, 0), new Point(127, 8)); tNotify.TitleRectangle = new Rectangle(40, 9, 70, 25); tNotify.ContentRectangle = new Rectangle(8, 41, 133, 68); tNotify.TitleClick += new EventHandler(TitleClick); tNotify.ContentClick += new EventHandler(ContentClick); tNotify.CloseClick += new EventHandler(CloseClick); tNotify.Show("경고", "신고된 페이지입니다. 주의하여 사용해주세요", 100, 300, 100); // 수정이 필요하면 이 위에까지 잘라내고 새로 넣어도 무방함. 아래는 페이지를 띄워주는 코드이므로 안됨 PassUrlToBroker(url); } else if (rating >= 26 && rating <= 75) { // This is Reported Site. // Move to weak Blocked page // 점수가 그냥 높은 수준일 때 차단 페이지로 이동. // webBrowser.LocationURL : URL을 직접 입력, 혹은 Navigate2로 이동할 때 기록되는 페이지 // BeforeURL : 이전 주소 browser.Stop(); browser.Navigate2("http://siteblocker.iptime.org/blocked.php?lvl=0&url=" + webBrowser.LocationURL + "&burl=" + BeforeURL, true); } else if (rating >= 76 && rating <= 100) { // This is Reported Site. // Move to String Blocked Page browser.Stop(); browser.Navigate2("http://siteblocker.iptime.org/blocked.php?lvl=1&url=" + webBrowser.LocationURL + "&burl=" + BeforeURL, true); } rating = 0; }