Changeset 466 for trunk/Options.php
- Timestamp:
- Apr 15, 2010, 8:20:31 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Options.php
r455 r466 4 4 ShowPage(); 5 5 6 if($User->Licence(LICENCE_USER)) 6 7 function UserOptionsFrom() 7 8 { 8 if(array_key_exists('Email', $_POST)) 9 { 10 $Email = $_POST['Email']; 11 $OldPass = $_POST['OldPass']; 12 $NewPass = $_POST['NewPass']; 13 $NewPass2 = $_POST['NewPass2']; 14 $Language = $_POST['Language']; 15 $Redirecting = $_POST['redirecting']; 16 17 if($NewPass == $NewPass2) 18 { 19 $DbResult = $System->Database->query('SELECT `Pass`, '.$User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$User->Id); 20 $DbRow = $DbResult->fetch_assoc(); 21 if($DbRow['Hash'] == $DbRow['Pass']) 22 { 23 // Update password 24 $Salt = $User->GetPasswordSalt(); 25 $System->Database->query('UPDATE `User` SET `Pass` = '.$User->CryptPasswordSQL('"'.$NewPass.'"', '"'.$Salt.'"').', `Salt`="'.$Salt.'" WHERE `ID` = '.$User->Id); 26 echo('Heslo změněno!<br />'); 27 } else echo('<br />Staré heslo neodpovídá!<br />'); 28 } else echo('<br />Hesla se neshodují!<br />'); 29 30 $System->Database->query('UPDATE `User` SET `Email` = "'.$Email.'", `Language` = "'.$Language.'", `Redirecting` = "'.$Redirecting.'" WHERE `ID` = '.$User->Id); 31 echo('Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$User->Name.'</b><br />'); 32 WriteLog('Úprava nastavení!', LOG_TYPE_USER); 33 } else 34 { 35 echo('<form action="Options.php" method="post"> 9 global $User, $System; 10 11 echo('<form action="Options.php" method="post"> 36 12 <fieldset><legend>Nastavení uživatele</legend> 37 13 <table> … … 99 75 </form>'); 100 76 echo('</fieldset>'); 77 } 78 79 if($User->Licence(LICENCE_USER)) 80 { 81 if(array_key_exists('Email', $_POST)) 82 { 83 $Email = $_POST['Email']; 84 $OldPass = $_POST['OldPass']; 85 $NewPass = $_POST['NewPass']; 86 $NewPass2 = $_POST['NewPass2']; 87 $Language = $_POST['Language']; 88 $Redirecting = $_POST['redirecting']; 89 90 if($NewPass == $NewPass2) 91 { 92 $DbResult = $System->Database->query('SELECT `Pass`, '.$User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$User->Id); 93 $DbRow = $DbResult->fetch_assoc(); 94 if($DbRow['Hash'] == $DbRow['Pass']) 95 { 96 // Update password 97 $Salt = $User->GetPasswordSalt(); 98 $System->Database->query('UPDATE `User` SET `Pass` = '.$User->CryptPasswordSQL('"'.$NewPass.'"', '"'.$Salt.'"').', `Salt`="'.$Salt.'" WHERE `ID` = '.$User->Id); 99 ShowMessage('Heslo změněno.'); 100 101 $System->Database->query('UPDATE `User` SET `Email` = "'.$Email.'", `Language` = "'.$Language.'", `Redirecting` = "'.$Redirecting.'" WHERE `ID` = '.$User->Id); 102 ShowMessage('Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$User->Name.'</b>'); 103 WriteLog('Úprava nastavení!', LOG_TYPE_USER); 104 } else ShowMessage('Staré heslo neodpovídá.', MESSAGE_CRITICAL); 105 } else ShowMessage('Hesla se neshodují.', MESSAGE_CRITICAL); 101 106 } 102 } else echo('Nejste přihlášený!'); 107 108 UserOptionsFrom(); 109 } else ShowMessage('Nejste přihlášený.', MESSAGE_CRITICAL); 103 110 ShowFooter(); 104 111
Note:
See TracChangeset
for help on using the changeset viewer.