Yorumları: 296
Konuları: 92
Kayıt Tarihi: 17-12-2018
Aktif Kullandığınız Delphi Sürümü:
Rep Puanı: 353 Acemi
Merhaba
https://tckimlik.nvi.gov.tr/Modul/TcKimlikNoDogrula adresinden TC kimlik numarası doğrulanabiliyor.
Siz uygulamalarınızda bu işlemi nasıl yapıyorsunuz?
Yorumları: 1.314
Konuları: 111
Kayıt Tarihi: 01-07-2017
Aktif Kullandığınız Delphi Sürümü:
Rep Puanı: 6.983 Üstad
Yorumları: 292
Konuları: 90
Kayıt Tarihi: 28-01-2018
Aktif Kullandığınız Delphi Sürümü:
Rep Puanı: 345 Acemi
25-12-2019, Saat: 11:58
(Son Düzenleme: 25-12-2019, Saat: 12:29, Düzenleyen: DelphiCan.)
Doğrulama işlemini aşağıdaki algoritmaya göre yapabilirsin. Ben bu şekilde doğruluyorum
TC Kimlik numaraları 11 basamaktan oluşmaktadır. İlk 9 basamak arasında kurulan bir algoritma bize 10. basmağı, ilk 10 basamak arasında kurulan algoritma ise bize 11. basamağı verir.
11 hanelidir.
Her hanesi rakamsal değer içerir.
İlk hane 0 olamaz.
1. 3. 5. 7. ve 9. hanelerin toplamının 7 katından, 2. 4. 6. ve 8. hanelerin toplamı çıkartıldığında, elde edilen sonucun 10′a bölümünden kalan, yani Mod10′u bize 10. haneyi verir.
1. 2. 3. 4. 5. 6. 7. 8. 9. ve 10. hanelerin toplamından elde edilen sonucun 10′a bölümünden kalan, yani Mod10′u bize 11. haneyi verir.
Function TCKimlikDogrula(TCNo: String): Boolean;
var
bir, iki, uc, dort, bes, alti, yedi, sekiz, dokuz, onn, onbir, ilk, son, onuncu, onbirinci: integer;
_Soniki, pSoniki: string;
begin
if (Length(TCNo) < 11) or (Length(TCNo) > 11) then
begin
ShowMessage('doğru düzgün gir tc no nu !!');
Abort
end
else
bir := StrToInt(TCNo[1]);
iki := StrToInt(TCNo[2]);
uc := StrToInt(TCNo[3]);
dort := StrToInt(TCNo[4]);
bes := StrToInt(TCNo[5]);
alti := StrToInt(TCNo[6]);
yedi := StrToInt(TCNo[7]);
sekiz := StrToInt(TCNo[8]);
dokuz := StrToInt(TCNo[9]);
onn := StrToInt(TCNo[10]);
onbir := StrToInt(TCNo[11]);
ilk := (bir + uc + bes + yedi + dokuz) * 7;
son := iki + dort + alti + sekiz;
onuncu := (ilk - son) mod 10;
onbirinci := (bir + uc + bes + yedi + dokuz + iki + dort + alti + sekiz
+ onuncu);
onbirinci := onbirinci mod 10;
_Soniki := IntToStr(onuncu) + IntToStr(onbirinci);
pSoniki := TCNo[10] + TCNo[11];
if _Soniki = pSoniki then
begin
Result := True;
end
else
Result := False;
end;
Yorumları: 4
Konuları: 0
Kayıt Tarihi: 29-06-2017
Rep Puanı: 33 Başlangıç
Merhaba
@ gonulali Delphi'nin Mobil platformlardaki string index'i sıfırdan (ZEROBASEDSTRINGS) başlar. Yani 'TCNo[1]' ifadesinden mobilde başka desktop'ta başka değer döner. Desktop'tan mobile geçireceğiniz kodlarınız varsa buna dikkat etmeniz gerekir. Sorun yaşamamak için Delphi versiyonunuz destekliyorsa "String Helper" kullanabilirsiniz.
Aşağıdaki function her iki platformda da sorun yaşatmaz.
function CheckTCK(const ATCK:String):Boolean;
var
i:Byte;
iAll, iOdd, iEven:Integer;
LChar:Char;
begin
result:=false;
if (Length(ATCK)<>11) or (ATCK.Chars[0]='0') then exit; // 11 haneden farklı veya ilk hane sıfır ise
iAll:=0; iOdd:=0; iEven:=0; i:=0;
for LChar in ATCK do
begin
inc(i);
if not (LChar in ['0' .. '9']) then exit;
if i=11 then break; // 11'inci hane toplamlara eklenmeyecek
iAll:=iAll + StrToInt(LChar);
if (i mod 2)=0 then // çift haneler toplamı. 10'uncu hane hariç
begin
if i<>10 then
iEven:= iEven + StrToInt(LChar)
end
else
iOdd:= iOdd + StrToInt(LChar); // tek haneler toplamı. 11'inci hane hariç
end;
result:= ((iAll mod 10)=StrToInt(ATCK.Chars[10])) // (1+2+3+4+5+6+7+8+9+10 mod 10) = 11. hane
and ( (((iOdd * 7)-iEven) mod 10)=StrToInt(ATCK.Chars[9])); // ( (1+3+5+7+9 * 7) - 2+4+6+8 ) mod 10 = 10. hane
end;
Yorumları: 296
Konuları: 92
Kayıt Tarihi: 17-12-2018
Aktif Kullandığınız Delphi Sürümü:
Rep Puanı: 353 Acemi
Cevaplariniz icin tesekkurler.
Nufus ve vatandaslik islerinin sayfasina tc dogum tarihi ve ad syoda post ederek sorgulama/dogrulama islemi mumkun mu acaba ?
Kullanilabilen tek sorgulama yontemi ancak tc nin hesaplama yontemi midir ?
Iyi calismalar
Yorumları: 230
Konuları: 16
Kayıt Tarihi: 11-10-2016
Rep Puanı: 1.011 Programcı
Ben de böyle kullanıyorum
function checkTCId(tcId: String):Boolean;
Var
tmp, tmp1,
odd_sum, even_sum,
ChkDigit2, ChkDigit1,
total : Int64;
d : Array[01..11] of Int64;
n : Integer;
begin
if Length(tcId) <> 11 then Result := False
else
begin
tmp := Trunc(StrToInt64(tcId) / 100);
tmp1 := Trunc(StrToInt64(tcId) / 100);
for n := 1 to 9 do
begin
d[n] := tmp1 mod 10;
tmp1 := Trunc(tmp1 / 10);
end;
odd_sum := d[9]+d[7]+d[5]+d[3]+d[1];
even_sum := d[8]+d[6]+d[4]+d[2];
total := (odd_sum * 3) + even_sum;
ChkDigit1 := (10 - (total mod 10)) mod 10;
odd_sum := ChkDigit1+d[8]+d[6]+d[4]+d[2];
even_sum := d[9]+d[7]+d[5]+d[3]+d[1];
total := (odd_sum * 3) + even_sum;
ChkDigit2 := (10 - (total mod 10)) mod 10;
tmp := (tmp*100)+(ChkDigit1*10)+ChkDigit2;
if NOT (tmp = StrToInt64(tcId))
then Result := False
else Result := True;
end;
end;
procedure TForm1.edTCNoExit(Sender: TObject);
var
uzunluk : byte;
begin
uzunluk:=(Length(edTCNo.Text));
if (uzunluk<12) and (edTCNo.Text<>'') and not checkTCId(edTCNo.Text) then
begin
edTCNo.Color := clRed;
edTCNo.font.Color := clWhite;
end;
if (edTCNo.Text = '') then edTCNo.Color := clWhite;
if checkTCId(edTcNo.Text) then edTCNo.Color := clLime;
end;
Yorumları: 238
Konuları: 28
Kayıt Tarihi: 05-05-2017
Aktif Kullandığınız Delphi Sürümü:
Rep Puanı: 1.193 Programcı
(26-12-2019, Saat: 09:19)41linea41 Adlı Kullanıcıdan Alıntı: Cevaplariniz icin tesekkurler.
Nufus ve vatandaslik islerinin sayfasina tc dogum tarihi ve ad syoda post ederek sorgulama/dogrulama islemi mumkun mu acaba ?
Kullanilabilen tek sorgulama yontemi ancak tc nin hesaplama yontemi midir ?
Iyi calismalar
Mümkün ama android de çalışmıyor.
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL
// >Import : https://tckimlik.nvi.gov.tr/Service/KPSP...smx?WSDL>0
// Encoding : utf-8
// Version : 1.0
// (23.07.2018 11:57:39 - - $Rev: 90173 $)
// ************************************************************************ //
unit KPSPublic;
interface
uses Soap.InvokeRegistry, Soap.SOAPHTTPClient, System.Types, Soap.XSBuiltIns;
const
IS_OPTN = $0001;
IS_REF = $0080;
type
// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Embarcadero types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:boolean - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:int - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:long - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:string - "http://www.w3.org/2001/XMLSchema"[Gbl]
// ************************************************************************ //
// Namespace : http://tckimlik.nvi.gov.tr/WS
// soapAction: http://tckimlik.nvi.gov.tr/WS/TCKimlikNoDogrula
// transport : http://schemas.xmlsoap.org/soap/http
// style : document
// use : literal
// binding : KPSPublicSoap
// service : KPSPublic
// port : KPSPublicSoap
// URL : https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx
// ************************************************************************ //
KPSPublicSoap = interface(IInvokable)
['{67B5D205-8FBC-D2EF-B4C5-C2A9574FBEEC}']
function TCKimlikNoDogrula(const TCKimlikNo: Int64; const Ad: string; const Soyad: string; const DogumYili: Integer): Boolean; stdcall;
end;
function GetKPSPublicSoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): KPSPublicSoap;
implementation
uses System.SysUtils;
function GetKPSPublicSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): KPSPublicSoap;
const
defWSDL = 'https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL';
defURL = 'https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx';
defSvc = 'KPSPublic';
defPrt = 'KPSPublicSoap';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as KPSPublicSoap);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
initialization
{ KPSPublicSoap }
InvRegistry.RegisterInterface(TypeInfo(KPSPublicSoap), 'http://tckimlik.nvi.gov.tr/WS', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(KPSPublicSoap), 'http://tckimlik.nvi.gov.tr/WS/TCKimlikNoDogrula');
InvRegistry.RegisterInvokeOptions(TypeInfo(KPSPublicSoap), ioDocument);
{ KPSPublicSoap.TCKimlikNoDogrula }
InvRegistry.RegisterMethodInfo(TypeInfo(KPSPublicSoap), 'TCKimlikNoDogrula', '',
'[ReturnName="TCKimlikNoDogrulaResult"]');
end.
uses KPSPublic
procedure TForm1.Button1Click(Sender: TObject);
var
tc:KPSPublicSoap;
begin
try
tc:= getKPSPublicSoap(true);
if tc.TCKimlikNoDogrula(strtoInt64(edttckimlik.Text),edtadi.Text,edtsoyadi.Text,strtoint(edtyili.Text))=true then
lbsonuc.Text:='DOĞRU'
else
lbsonuc.Text:='YANLIŞ';
except
on E : Exception do
ShowMessage(E.ClassName+' Hata, Detay : '+E.Message);
end;
end;
Yorumları: 4.224
Konuları: 379
Kayıt Tarihi: 07-07-2016
Aktif Kullandığınız Delphi Sürümü:
Rep Puanı: 16.979 Üstad
Merhaba,
Mobil için;
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : https://tckimlik.nvi.gov.tr/Service/KPSP....asmx?wsdl
// >Import : https://tckimlik.nvi.gov.tr/Service/KPSP...smx?wsdl>0
// Encoding : utf-8
// Version : 1.0
// (26.12.2019 10:42:32 - - $Rev: 96726 $)
// ************************************************************************ //
unit KPSPublicV2;
interface
uses Soap.InvokeRegistry, Soap.SOAPHTTPClient, System.Types, Soap.XSBuiltIns;
const
IS_OPTN = $0001;
IS_NLBL = $0004;
IS_REF = $0080;
type
// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Embarcadero types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:int - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:boolean - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:string - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:long - "http://www.w3.org/2001/XMLSchema"[Gbl]
// ************************************************************************ //
// Namespace : http://tckimlik.nvi.gov.tr/WS
// soapAction: http://tckimlik.nvi.gov.tr/WS/KisiVeCuzdanDogrula
// transport : http://schemas.xmlsoap.org/soap/http
// style : document
// use : literal
// binding : KPSPublicV2Soap
// service : KPSPublicV2
// port : KPSPublicV2Soap
// URL : https://tckimlik.nvi.gov.tr/Service/KPSPublicV2.asmx
// ************************************************************************ //
KPSPublicV2Soap = interface(IInvokable)
['{06D7DD71-6A70-E64F-84BD-87C71115D891}']
function KisiVeCuzdanDogrula(const TCKimlikNo: Int64; const Ad: string;
const Soyad: string; const SoyadYok: Boolean; const DogumGun: Integer;
const DogumGunYok: Boolean; const DogumAy: Integer;
const DogumAyYok: Boolean; const DogumYil: Integer;
const CuzdanSeri: string; const CuzdanNo: Integer;
const TCKKSeriNo: string): Boolean; stdcall;
end;
function GetKPSPublicV2Soap(UseWSDL: Boolean = System.False; Addr: string = '';
HTTPRIO: THTTPRIO = nil): KPSPublicV2Soap;
implementation
uses System.SysUtils;
function GetKPSPublicV2Soap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO)
: KPSPublicV2Soap;
const
defWSDL = 'https://tckimlik.nvi.gov.tr/Service/KPSPublicV2.asmx?wsdl';
defURL = 'https://tckimlik.nvi.gov.tr/Service/KPSPublicV2.asmx';
defSvc = 'KPSPublicV2';
defPrt = 'KPSPublicV2Soap';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as KPSPublicV2Soap);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end
else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
initialization
{ KPSPublicV2Soap }
InvRegistry.RegisterInterface(TypeInfo(KPSPublicV2Soap),
'http://tckimlik.nvi.gov.tr/WS', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(KPSPublicV2Soap),
'http://tckimlik.nvi.gov.tr/WS/KisiVeCuzdanDogrula');
InvRegistry.RegisterInvokeOptions(TypeInfo(KPSPublicV2Soap), ioDocument);
{ KPSPublicV2Soap.KisiVeCuzdanDogrula }
InvRegistry.RegisterMethodInfo(TypeInfo(KPSPublicV2Soap), 'KisiVeCuzdanDogrula',
'', '[ReturnName="KisiVeCuzdanDogrulaResult"]');
InvRegistry.RegisterParamInfo(TypeInfo(KPSPublicV2Soap), 'KisiVeCuzdanDogrula',
'DogumGun', '', '', IS_NLBL);
InvRegistry.RegisterParamInfo(TypeInfo(KPSPublicV2Soap), 'KisiVeCuzdanDogrula',
'DogumAy', '', '', IS_NLBL);
InvRegistry.RegisterParamInfo(TypeInfo(KPSPublicV2Soap), 'KisiVeCuzdanDogrula',
'CuzdanNo', '', '', IS_NLBL);
end.
Örnek kullanım:
procedure TForm1.Button1Click(Sender: TObject);
var
tc: KPSPublicV2Soap;
begin
try
tc := GetKPSPublicV2Soap(true);
if tc.KisiVeCuzdanDogrula(strtoInt64(Edit1.Text), Edit2.Text, Edit3.Text,
False, 0, False, 0, False, StrToInt(Edit4.Text), '', 0, '') = true then
Label1.Text := 'DOĞRU'
else
Label1.Text := 'YANLIŞ';
except
on E: Exception do
ShowMessage(E.ClassName + ' Hata, Detay : ' + E.Message);
end;
end;
Not: Örnek kullanım, @ elixir84 in kodundan örnek alınmıştır.
Yorumları: 903
Konuları: 68
Kayıt Tarihi: 30-06-2017
Aktif Kullandığınız Delphi Sürümü:
Rep Puanı: 8.404 Üstad
14-06-2020, Saat: 12:15
(Son Düzenleme: 30-06-2020, Saat: 19:53, Düzenleyen: uparlayan.
Sebep: link eklendi.
)
YouTube'da kodları isteyen bir katılımcı için kaynak kodlar aşağıdaki linktedir.
https://mega.nz/file/3otSjSZb#aPpZhMUxIQ...naadHTxQrg
YouTube Delphi Tips
"Yaşlanarak değil, yaşayarak tecrübe kazanılır. Zaman insanları değil, armutları olgunlaştırır" Peyami Safa
Yorumları: 1.702
Konuları: 20
Kayıt Tarihi: 05-08-2016
Aktif Kullandığınız Delphi Sürümü:
Rep Puanı: 19.330 Üstad
@ uparlayan teşekkürler.
* Bir ara TCKimlik nosundan ileri / geri doğru "Aile Soyağacı" projesine soyunmuştum.
- O zaman sadece tek bir TCKimlik nosu ile cevap alabiliyorduk.
- Aşağıdaki şekilde yine bu mümkün olsa ne güzel olurdu değil mi ? Tüm isim verisini vermek zorunda da değiller. Kontrol amaçlı bir kaç karakter yeterli...
Saygılarımla
Muharrem ARMAN
|