BlackBoard (http://www.black-board.net/index.php)
- Design, Programmierung & Entwicklung (http://www.black-board.net/board.php?boardid=55)
-- Programmieren (http://www.black-board.net/board.php?boardid=4)
--- PHP SozialversicherungsNR (http://www.black-board.net/thread.php?threadid=22791)


Geschrieben von ColdFire am 02.03.2007 um 17:54:

  SozialversicherungsNR

Hy Coder...

Wollte mal wissen ob jemand eine fertige funktion für mich hat zum checken der sozialversicherungsNR:

Like:

http://www2.argedaten.at/static/svnr.html

mfg CF



Geschrieben von phlox81 am 02.03.2007 um 18:08:

 

Könnte man mit einer RegEx prüfen, evtl. mal über Google suchen, ob sich da was finden.



Geschrieben von LX am 02.03.2007 um 18:23:

Achtung

Mit einer RegEx bekommt man zumindest das Format geprüft, die Prüfziffer am Ende ist da schon schwieriger. Hier gibt's eine Prüfziffernberechnung dafür.



Geschrieben von ColdFire am 02.03.2007 um 18:26:

 

Nunja es ist nur leider das thema mit den prüfziffern...

Es wird doch möglich sein dass jemand eine vernünftige funktion gecodet hat und diese auch freigibt !

lg CF



Geschrieben von Cpt.Miller am 02.03.2007 um 21:36:

 

Also ich habs gerad mal in Python gelöst, allerdings sehr unschön smile .

Du brauchst es in PHP richtig? Dann könnte ich es dir auch coden, wenn du es brauchst.

EDIT:
Wobei ich schon glaube, dass es sowas bereits fertig gibt.
Google mal kräftig.



Geschrieben von ColdFire am 03.03.2007 um 15:33:

 

Ja währe nice wennst dus für php lösen könntest...

googlen nützt nichts im punkto free code..

lg CF
Kann dieser code funktionieren:

code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 4                                                        |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group                                |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.php.net/license/3_0.txt.                                  |
// | If you did not receive a copy of the PHP license and are unable to   |
// | obtain it through the world-wide-web, please send a note to          |
// | license@php.net so we can mail you a copy immediately.               |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 Michael Wallner <mike@iworks.at>                  |
// +----------------------------------------------------------------------+
//
// $Id: AT.php,v 1.1 2005/03/07 21:00:53 krabu Exp $

/**
* Requires Validate
*/
require_once('Validate.php');

/**
* Validate_AT
*
* @author       Michael Wallner <mike@php.net>
* @package      Validate
* @category     PHP
*
* @version      $Revision: 1.1 $
* @access       public
*/
class Validate_AT
{
    /**
    * Validate postcode ("Postleitzahl")
    *
    * @static
    * @access   public
    * @param    string  postcode to validate
    * @param    bool    optional; strong checks (e.g. against a list of postcodes)
    * @return   bool    true if postcode is ok, false otherwise
    */
    function postcode($postcode, $strong=false)
    {
        if ($strong) {
            static $postcodes;
    
            if (!isset($postcodes)) {
                $file = '/usr/share/pear/data/Validate/AT_postcodes.txt';
                $postcodes = array_map('trim', file($file));
            }
    
            return in_array((int) $postcode, $postcodes);
        } else {
            return (ereg('^[0-9]{4}$', $postcode));
        }
    }

    /**
    * Validate SSN
    *
    * "Sozialversicherungsnummer"
    *
    * @static
    * @access   public
    * @param    string  $svn
    * @return   bool
    */
    function ssn($svn)
    {
        $matched = preg_match(
            '/^(\d{3})(\d)\D*(\d{2})\D*(\d{2})\D*(\d{2})$/',
            $svn,
            $matches
        );

        if (!$matched) {
            return false;
        }

        list(, $num, $chk, $d, $m, $y) = $matches;

        if (!Validate::date("$d-$m-$y", array('format' => '%d-%m-%y'))) {
            return false;
        }

        $str = (string) $num . $chk . $d . $m . $y;
        $len = strlen($str);
        $fkt = '3790584216';
        $sum = 0;

        for ($i = 0; $i < $len; $i++) {
            $sum += $str{$i} * $fkt{$i};
        }

        $sum = $sum % 11;
        if ($sum == 10) {
            $sum = 0;
        }

        return ($sum == $chk);
    }
}
?>



Geschrieben von Cpt.Miller am 03.03.2007 um 22:21:

 

Also ich habe mich jetzt auf die Quelle von LX verlassen und hab es wie gesagt schon zwar in Python gelöst, nur eins versteh ich noch nicht ganz.

Ist die Prüfziffer bereits ein Teil der Sozialversicherungsnummer oder nicht? Weil mein Code kriegt bei LX' Quelle genau wie im Beispiel vorgerechnet die Prüfziffer 1 raus.



Geschrieben von LX am 04.03.2007 um 02:45:

Achtung

Zitat:
Original von Cpt.Miller
Ist die Prüfziffer bereits ein Teil der Sozialversicherungsnummer oder nicht?
Die letzte Ziffer der Nummer ist die Prüfziffer, ja.



Geschrieben von Cpt.Miller am 04.03.2007 um 08:44:

 

Sehr gut, dass geht aus dem Beispiel nämlich nicht hervor. Dann werd ich das bald in PHP hier posten.



Geschrieben von ColdFire am 05.03.2007 um 11:49:

 

@ Cpt.

Währe echt suppi schonmal danke im voraus!

lg CF


Forensoftware: Burning Board 2.3.6, entwickelt von WoltLab GmbH