Changeset 19 for types/Password.php
- Timestamp:
- Oct 22, 2008, 9:12:20 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
types/Password.php
r18 r19 3 3 // SHA1 hash used 4 4 5 function TypePasswordOnView($Item) 5 class TypePassword 6 6 { 7 $Output = ''; 8 for($I = 0; $I < 6; $I++) 9 $Output .= '*'; 10 return($Output); 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 } 11 38 } 12 39 13 function TypePasswordOnEdit($Item) 14 { 15 $Output = '<input type="password" name="'.$Item['Name'].'" value="">'; 16 return($Output); 17 } 18 19 function TypePasswordOnLoad($Item) 20 { 21 global $Database; 22 23 if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]); 24 else 25 { 26 $DbRestult = $Database->query('SELECT '.$Item['Name'].' FROM '.$Item['SourceTable'].' WHERE Id='.$Item['SourceItemId']); 27 if($DbResult->num_rows > 0) 28 { 29 $DbRow = $DbResult->fetch_assoc(); 30 if($_POST[$Item['Name']] == '') $Result = $DbRow[$Item['Name']]; 31 else $Result = sha1($_POST[$Item['Name']]); 32 } else $Result = sha1($_POST[$Item['Name']]); 33 } 34 return($Result); 35 } 40 $TypeDefinitionList['Password'] = new TypePassword; 36 41 37 42 ?>
Note:
See TracChangeset
for help on using the changeset viewer.