Changeset 308
- Timestamp:
- Jan 31, 2010, 9:41:08 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Options.php
r302 r308 20 20 if(($_SESSION['Pass'] == $OldPass) and ($NewPass == $NewPass2)) 21 21 { 22 $Database->SQLCommand('UPDATE user SET pass = sha1("'.$NewPass.'") WHERE ID = '.$_SESSION['UserID']); 22 // Update password 23 $Salt = GetPasswordSalt(); 24 $Database->SQLCommand('UPDATE user SET pass = sha1(CONCAT(sha1("'.$NewPass.'"), "'.$Salt.'")), Salt="'.$Salt.'" WHERE ID = '.$_SESSION['UserID']); 23 25 echo('Heslo změněno!<br />'); 24 26 } else echo('<br />Hesla se neshodují!<br />'); 27 25 28 $Database->SQLCommand('UPDATE user SET Email = "'.$Email.'", Language = "'.$Language.'", redirecting = "'.$redirecting.'" WHERE ID = '.$_SESSION['UserID']); 26 29 echo('Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$User.'</b><br />'); -
trunk/export/process_task.php
r297 r308 39 39 echo 'Caught exception: ', $e->getMessage(), "\n"; 40 40 } 41 } else echo('Export '.$DbRow['Export'].' nenalezen'."\n"); 41 } else 42 { 43 $Database->SQLCommand('DELETE FROM ExportTask WHERE Export='.$DbRow['Export']); 44 echo('Export '.$DbRow['Export'].' nenalezen. Jeho úloha smazána.'."\n"); 45 } 42 46 } 43 47 sleep($Config['ExportTashProcessPeriod']); -
trunk/includes/global.php
r307 r308 198 198 echo('<strong>'.$Name.'</strong>'.$TextGM.'<br />'); 199 199 } 200 } 201 202 function CheckLogin() 203 { 204 global $Database; 205 206 if(!array_key_exists('UserID', $_SESSION)) $_SESSION['UserID'] = ''; 207 if(!array_key_exists('User', $_SESSION)) $_SESSION['User'] = 'NotRegistred'; 208 if(!array_key_exists('Pass', $_SESSION)) $_SESSION['Pass'] = ''; 209 210 // Přihlášení 211 if(array_key_exists('LoginUser', $_POST)) 212 { 213 $_SESSION['User'] = $_POST['LoginUser']; 214 $_SESSION['Pass'] = $_POST['LoginPass']; 215 216 $DbResult = $Database->SQLCommand('SELECT * FROM user WHERE LOWER(user) = LOWER("'.$_SESSION['User'].'") AND pass = sha1(CONCAT(sha1("'.$_SESSION['Pass'].'"), Salt))'); 217 if(mysql_num_rows($DbResult) == 0) 218 { 219 echo('<script> alert("Jméno nebo heslo bylo zadáno špatně!"); </script>'); 220 $_SESSION['UserID'] = ''; 221 $_SESSION['User'] = ''; 222 $_SESSION['Pass'] = ''; 223 } else 224 { 225 $User = mysql_fetch_assoc($DbResult); 226 $_SESSION['UserID'] = $User['ID']; 227 $_SESSION['User'] = $User['user']; 228 WriteLog('Login: '.$_SESSION['User'], 3); 229 } 230 } 231 232 // Odhlášení 233 if(array_key_exists('Logout', $_GET) and ($_SESSION['User'] != '')) 234 { 235 WriteLog('Odhlášení', 3); 236 if(is_numeric($_SESSION['UserID'])) 237 $Database->SQLCommand('UPDATE user SET LastLogout = NOW() WHERE ID = '.$_SESSION['UserID']); 238 $_SESSION['User'] = ''; 239 $_SESSION['Pass'] = ''; 240 $_SESSION['UserID'] = ''; 241 } 242 243 // Záznam o aktivitě 244 if(Licence(0) and array_key_exists('REMOTE_ADDR', $_SERVER)) 245 $Database->SQLCommand('UPDATE user SET LastIP = "'.$_SERVER['REMOTE_ADDR'].'", LastLogin = NOW() WHERE ID = '.$_SESSION['UserID']); 200 246 } 201 247 … … 227 273 </table>'); 228 274 229 if(!array_key_exists('UserID', $_SESSION)) $_SESSION['UserID'] = ''; 230 if(!array_key_exists('User', $_SESSION)) $_SESSION['User'] = 'NotRegistred'; 231 if(!array_key_exists('Pass', $_SESSION)) $_SESSION['Pass'] = ''; 232 233 234 // Odhlášení 235 if(array_key_exists('Logout', $_GET)) 236 { 237 WriteLog('Odhlášení', 3); 238 if(is_numeric($_SESSION['UserID'])) 239 $Database->SQLCommand('UPDATE user SET LastLogout = NOW() WHERE ID = '.$_SESSION['UserID']); 240 $_SESSION['User'] = ''; 241 $_SESSION['Pass'] = ''; 242 $_SESSION['UserID'] = ''; 243 } 244 245 // Přihlášení 246 if(array_key_exists('LoginUser', $_POST)) 247 { 248 $_SESSION['User'] = $_POST['LoginUser']; 249 $_SESSION['Pass'] = $_POST['LoginPass']; 250 251 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM user WHERE LOWER(user) = LOWER("'.$_SESSION['User'].'") AND pass = sha1("'.$_SESSION['Pass'].'")')); 252 if(!$Line) 253 { 254 echo('<script> alert("Jméno nebo heslo bylo zadáno špatně!"); </script>'); 255 $_SESSION['UserID'] = ''; 256 $_SESSION['User'] = ''; 257 $_SESSION['Pass'] = ''; 258 } else 259 { 260 $_SESSION['UserID'] = $Line['ID']; 261 $_SESSION['User'] = $Line['user']; 262 WriteLog('Login: '.$_SESSION['User'], 3); 263 } 264 } 265 266 // Záznam o aktivitě 267 if(Licence(0) and array_key_exists('REMOTE_ADDR', $_SERVER)) 268 $Database->SQLCommand('UPDATE user SET LastIP = "'.$_SERVER['REMOTE_ADDR'].'", LastLogin = NOW() WHERE ID = '.$_SESSION['UserID']); 269 275 CheckLogin(); 270 276 ShowTopBar(); 271 277 -
trunk/includes/global_function.php
r307 r308 208 208 if(isset($_SESSION['User']) and ($_SESSION['User'] <> '') and ($_SESSION['UserID'] != '')) 209 209 { 210 // 210 // $User = $_SESSION['User']; 211 211 $Pass = $_SESSION['Pass']; 212 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM user WHERE ID = '.$_SESSION['UserID'].' 213 AND GM >= '.$Licence.' AND pass = sha1("'.$Pass.'")')); 214 // echo "SELECT * FROM user WHERE ID = ".$_SESSION['UserID']." AND GM <= $Licence AND pass = '$Pass'"; 212 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM user WHERE ID = '.$_SESSION['UserID'].' AND GM >= '.$Licence.' AND pass = sha1(CONCAT(sha1("'.$Pass.'"), Salt))')); 215 213 return($Line); 216 214 } else … … 547 545 } 548 546 547 function GetPasswordSalt() 548 { 549 return(substr(sha1(mt_rand()), 0, 8)); 550 } 549 551 550 552 ?> -
trunk/registrace.php
r307 r308 23 23 { 24 24 $Address = $_SERVER['REMOTE_ADDR']; 25 $Database->SQLCommand('INSERT INTO `user` (`user` , `pass` , `LastIP` , `LastLogin` , `Email` , `Language` , `team` , `NeedUpdate`, `RegistrationTime` ) 26 VALUES ("'.$User.'", sha1("'.$Pass.'"), "'.$Address.'", NOW(), "'.$Email.'", '.$Language.', '.$Team.', 1, NOW())'); 25 $Salt = GetPasswordSalt(); 26 $Database->SQLCommand('INSERT INTO `user` (`user` , `pass` , `Salt`, `LastIP` , `LastLogin` , `Email` , `Language` , `team` , `NeedUpdate`, `RegistrationTime` ) 27 VALUES ("'.$User.'", sha1(CONCAT(sha1("'.$Pass.'"), "'.$Salt.'")), "'.$Salt.'", "'.$Address.'", NOW(), "'.$Email.'", '.$Language.', '.$Team.', 1, NOW())'); 27 28 // $Database->SQLCommand("INSERT INTO user () VALUES('$User','$Pass','0','$Addres',now(),'0','$Email')"); 28 29 echo('Registrace proběhla úspěšně.<br />');
Note:
See TracChangeset
for help on using the changeset viewer.