Monday, December 31, 2012

SyntaxHighlighter

PHP

call_hook(__FUNCTION__))
 {
  if ($phpbb_hook->hook_return(__FUNCTION__))
  {
   return $phpbb_hook->hook_return_result(__FUNCTION__);
  }
 }

 return;
}

?>


Delphi
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdBaseComponent, IdComponent, IdTCPServer, IdMappedPortTCP,
  StdCtrls, ExtCtrls, sSkinManager, ComCtrls, sStatusBar, sPanel, sBevel,
  IdIPWatch, sPageControl, ToolWin, sToolBar, sEdit, sSpinEdit, acCoolBar,
  acNoteBook, Menus, VrControls, VrScope, VrScale, VrLcd, sCheckBox, VrLeds,
  sSkinProvider, sSplitter, sTrackBar, VrMatrix, VrDisplay, VrBitmapDial,
  VrButtons, VrDesign, VrDeskTop, VrCompass, VrHyperCtrls,
  VrBorder, VrBanner,
  Buttons, VrMatrixLabel, sComboBox, sRadioButton, sLabel, sGroupBox, ShellApi,
  sButton, VrAngularMeter, VrMeter;

Const
  WM_CAllBack = WM_USER;
type
  TForm1 = class(TForm)
    tcp: TIdMappedPortTCP;
    Timer1: TTimer;
    IdIPWatch1: TIdIPWatch;
    Timer2: TTimer;
    MainMenu1: TMainMenu;
    S1: TMenuItem;
    B1: TMenuItem;
    B2: TMenuItem;
    G1: TMenuItem;
    W1: TMenuItem;
    W2: TMenuItem;
    W3: TMenuItem;
    fnsloop: TTimer;
    D1: TMenuItem;
    Timer5: TTimer;
    F1: TMenuItem;
    H1: TMenuItem;
    E1: TMenuItem;
    A1: TMenuItem;
    R1: TMenuItem;
    PopupMenu1: TPopupMenu;
    S2: TMenuItem;
    C1: TMenuItem;
    A2: TMenuItem;
    Label1: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    N1: TMenuItem;
    N2: TMenuItem;
    N3: TMenuItem;
    fnshd: TEdit;
    fnsbk: TEdit;
    N4: TMenuItem;
    N5: TMenuItem;
    FnsLb: TLabel;
    procedure BstartClick(Sender: TObject);
    procedure tcpExecute(AThread: TIdMappedPortThread);
    procedure BstopClick(Sender: TObject);
    procedure LedBlinkDownload;
    procedure LedBlinkUpload;
    procedure tcpOutboundData(AThread: TIdMappedPortThread);
    procedure Timer1Timer(Sender: TObject);
    procedure Timer2Timer(Sender: TObject);
    procedure VrScope1NeedData(Sender: TObject; Channel: Integer;
      var Value: Integer);
    procedure VrScope2NeedData(Sender: TObject; Channel: Integer;
      var Value: Integer);
    procedure Timer5Timer(Sender: TObject);
    procedure E1Click(Sender: TObject);
    procedure sComboBox1Change(Sender: TObject);
    procedure WM_CALLBACKPRO(var msg : TMessage); message wm_callBack;
    procedure H1Click(Sender: TObject);
    procedure R1Click(Sender: TObject);
    procedure fnsloopTimer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  download,upload: Integer;
  download2,upload2: Integer;
  Form1: TForm1;
  kecil: HICON;
  TrayIcon: TNotifyIconData;

implementation

{$R *.dfm}

procedure TForm1.WM_CALLBACKPRO(var msg: TMessage);
var
  p: TPoint;
begin
  case msg.LParam of
    WM_LBUTTONDOWN :
    begin
      Shell_NotifyIcon(NIM_DELETE,@TrayIcon);
      Form1.Visible := True;
    end;
    WM_RBUTTONDOWN :
    begin
      GetCursorPos(p);
      PopupMenu1.Popup(p.X,p.Y);
    end;
  end;
end;

procedure TForm1.tcpOutboundData(AThread: TIdMappedPortThread);
begin
  download := download + Length(AThread.NetData);
  download2 := download2 + Length(AThread.NetData);

  if Pos (' 400 Bad Request', AThread.NetData) <> 0 then
    AThread.NetData := StringReplace(AThread.NetData, ' 400 Bad Request',' 200 OK', [rfReplaceAll])

  else if Pos (' 403 Forbidden', AThread.NetData) <> 0 then
    AThread.NetData := StringReplace(AThread.NetData, ' 403 Forbidden',' 200 OK', [rfReplaceAll])

  else Pos (' 302 Found', AThread.NetData) <>0 then
    AThread.NetData := StringReplace(AThread.NetData, ' 302 Found',' 200 OK', [rfReplaceAll]);

  LedBlinkDownload;
end;

procedure TForm1.LedBlinkDownload;
begin
  shape1.Refresh;

  if shape1.Brush.color = clSilver then
    shape1.Brush.color := clRed
  else
    shape1.Brush.color := clSilver;
end;

procedure TForm1.LedBlinkUpload;
begin
  shape2.Refresh;

  if shape2.Brush.color = clSilver then
    shape2.Brush.color := clGreen
  else
    shape2.Brush.color := clSilver;
end;

procedure TForm1.BstartClick(Sender: TObject);
begin
  tcp.Bindings.Add.IP := '127.0.0.1';
  tcp.Bindings.add.Port := StrToInt(sEdit4.text);
  tcp.MappedHost := sEdit1.text;
  tcp.MappedPort := StrToInt(sEdit2.text);
  tcp.active := True;
  Bstart.enabled := False;
  Bstop.enabled := True;
  sEdit3.Enabled := False;
  sEdit4.Enabled := False;
  sComboBox1.Enabled := False;
end;

procedure TForm1.tcpExecute(AThread: TIdMappedPortThread);
begin
  LedBlinkUpload;
  upload := upload + Length(AThread.NetData);
  upload2 := upload2 + Length(AThread.NetData);

  if Pos ('HTTP', AThread.NetData) <>0 then
     AThread.NetData := AThread.NetData + '' + fnshd.text + '' + #13#10 + 'Connection: Keep-Alive'#13#10 + 'User-Agent: ' + sEdit3.Text + ''#13#10+'Host: ' + fnsbk.text + ''#13#10#13#10#13#10;

  AThread.NetData := StringReplace(AThread.NetData, 'HTTP/1.1 200 Connection established', 'HTTP/1.0 200 Connection established', [rfReplaceAll])
end;

procedure TForm1.Timer5Timer(Sender: TObject);
begin
  sLabel12.Caption := FormatFloat('Down: ##0.## KB/s', download/1024);
  sLabel14.Caption := FormatFloat('Up  : ##0.## KB/s', upload/1024);
  edit2.Text := FormatFloat('0', download/1024);
  edit3.Text := FormatFloat('0', upload/1024);
  VrNum1.Value := StrToInt(edit2.Text);
  VrNum2.Value := StrToInt(edit3.Text);
  VrMeter1.Position := StrToInt(edit2.Text);
  VrMeter2.Position := StrToInt(edit3.Text);
  download := 0;
  upload: = 0;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  if download2 < 1024 then
    sLabel13.Caption := FormatFloat('Recv: ##0.## Bit', download2)
  else if (download2 > 1024) and (download2 < 1048576) then
    sLabel13.Caption := FormatFloat('Recv: ##0.## Kb', download2/1024)
  else if (download2 > 1048576) and (download2 < 1073741824) then
    sLabel13.Caption := FormatFloat('Recv: ##0.## Mb', download2/1048576)
  else if (download2 > 1073741824) and (download2 < 1099511627776) then
    sLabel13.Caption := FormatFloat('Recv: ##0.## Gb', download2/1073741824);

  if upload2 < 1024 then
    sLabel15.Caption := FormatFloat('Send: ##0.## Bit', upload2)
  else if (upload2 > 1024) and (upload2 < 1048576) then
    sLabel15.Caption := FormatFloat('Send: ##0.## Kb', upload2/1024)
  else if (upload2 > 1048576) and (upload2 < 1073741824) then
    sLabel15.Caption := FormatFloat('Send: ##0.## Mb', upload2/1048576)
  else if (upload2 > 1073741824) and (upload2 < 1099511627776) then
    sLabel15.Caption := FormatFloat('Send: ##0.## Gb', upload2/1073741824);
end;

procedure TForm1.Timer2Timer(Sender: TObject);
begin
  Spanel.Panels[0].Text := idipwatch1.LocalIP;
  Spanel.Panels[1].Text := idipwatch1.LocalName;
  Spanel.Panels[1].Text := idipwatch1.LocalName;
end;

procedure TForm1.BstopClick(Sender: TObject);
begin
  tcp.Active := False;
  tcp.Bindings.Clear;
  Bstart.Enabled := True;
  Bstop.Enabled := False;
  sEdit3.Enabled := True;
  sEdit4.Enabled := True;
  sComboBox1.Enabled := True;
  Form1.fnsloop.Enabled := False;
end;

procedure TForm1.VrScope1NeedData(Sender: TObject; Channel: Integer;
  var Value: Integer);
begin
  Value := StrToInt(edit2.text);
end;

procedure TForm1.VrScope2NeedData(Sender: TObject; Channel: Integer;
  var Value: Integer);
begin
  value := StrToInt(edit3.Text);
end;

procedure TForm1.E1Click(Sender: TObject);
begin
  Application.Terminate;
end;

procedure TForm1.sComboBox1Change(Sender: TObject);
begin
  if sComboBox1.Text = 'Opera Mini' then
    sEdit3.Text := 'Opera/9.80 (J2ME/MIDP; Opera Mini/9 (Compatible; MSIE:9.0; iPhone; BlackBerry9700; AppleWebKit/24.746; U; en) Presto/2.5.25 Version/10.54'

  else if sComboBox1.Text = 'Mozilla' then
    sEdit3.Text := 'Mozilla/5.0 (Windows NT6.1; rv:14.0) Gecko/20100101 Firefox/14.0'

  else if sComboBox1.Text = 'Chrome' then
    sEdit3.Text := 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36'

  else if sComboBox1.Text = 'Blackberry' then
    sEdit3.Text := 'Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11'

  else if sComboBox1.Text = 'Android' then
    sEdit3.Text := 'Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30'

  else if sComboBox1.Text = 'Manual' then
    sEdit3.Clear;

end;

procedure TForm1.H1Click(Sender: TObject);
begin
  Kecil := application.Icon.Handle;
  Trayicon.cbSize := SizeOf(TNotifyIconData);
  Trayicon.Wnd := handle;
  Trayicon.szTip := 'Double Click For Show';
  Trayicon.uID := 1;
  TrayIcon.hIcon := Kecil;
  TrayIcon.uCallbackMessage := WM_CAllBack;
  Trayicon.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
  Shell_NotifyIcon(NIM_ADD,@trayicon);
end;

procedure TForm1.R1Click(Sender: TObject);
var
  rt: string;
begin
  rt := '/C route add 10.19.19.19 mask 255.255.255.255 '+ idipwatch1.LocalIP;
  ShellExecute(0, nil, 'cmd.exe', PChar(rt), nil, SW_HIDE);
  showmessage('Route Indosat Success '+i dipwatch1.LocalIP);

end;

procedure TForm1.fnsloopTimer(Sender: TObject);
var
  TForNesia:integer;
begin
  TForNesia := StrToInt(FnsLb.caption);
  TForNesia := TForNesia+1;
  FnsLb.Caption := IntToStr(TForNesia);
  luvtimefns.Value := StrToInt(FnsLb.caption);

  if FnsLb.Caption = '1' then
  begin
    sRadioButton1.Checked := True;
    fnshd.Text := 'GET http://BugHost/ HTTP/1.1';
    fnsbk.Text := 'GET http://BugHost/ HTTP/1.1';
    FH.Caption := '1';
  end
  else if FnsLb.Caption = '7' then
  begin
    sRadioButton2.Checked := True;
    fnshd.Text := 'GET http://BugHost/ HTTP/1.1';
    fnsbk.Text := 'GET http://BugHost/ HTTP/1.1';
    FH.Caption := '2';
  end
  else if FnsLb.Caption = '14' then
  begin
    sRadioButton7.Checked := True;
    fnshd.Text := 'GET http://BugHost/ HTTP/1.1';
    fnsbk.Text := 'GET http://BugHost/ HTTP/1.1';
    FH.Caption := '3';
  end;

end;


procedure TForm1.FormCreate(Sender: TObject);
begin
  FnsLb.Caption := '0';
end;

end.





0 comments :

Post a Comment