source:
trunk/types/Password.php
| Last change on this file was 29, checked in by , 17 years ago | |
|---|---|
| File size: 899 bytes | |
| Line | |
|---|---|
| 1 | <?php |
| 2 | |
| 3 | // SHA1 hash used |
| 4 | |
| 5 | class TypePassword extends TypeBase |
| 6 | { |
| 7 | function OnView($Item) |
| 8 | { |
| 9 | $Output = ''; |
| 10 | for($I = 0; $I < 6; $I++) |
| 11 | $Output .= '*'; |
| 12 | return($Output); |
| 13 | } |
| 14 | |
| 15 | function OnEdit($Item) |
| 16 | { |
| 17 | $Output = '<input type="password" name="'.$Item['Name'].'" value="">'; |
| 18 | return($Output); |
| 19 | } |
| 20 | |
| 21 | function OnLoad($Item) |
| 22 | { |
| 23 | global $Database; |
| 24 | |
| 25 | if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]); |
| 26 | else |
| 27 | { |
| 28 | $DbRestult = $Database->query('SELECT '.$Item['Name'].' FROM '.$Item['SourceTable'].' WHERE Id='.$Item['SourceItemId']); |
| 29 | if($DbResult->num_rows > 0) |
| 30 | { |
| 31 | $DbRow = $DbResult->fetch_assoc(); |
| 32 | if($_POST[$Item['Name']] == '') $Result = $DbRow[$Item['Name']]; |
| 33 | else $Result = sha1($_POST[$Item['Name']]); |
| 34 | } else $Result = sha1($_POST[$Item['Name']]); |
| 35 | } |
| 36 | return($Result); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | ?> |
Note:
See TracBrowser
for help on using the repository browser.
