|
65 | 65 | $szRedir = "index.php"; // Default |
66 | 66 | $szRedir = SecureRedirect($szRedir); |
67 | 67 |
|
68 | | -if ( isset($_POST['op']) && $_POST['op'] == "login" ) |
69 | | -{ |
| 68 | +if ( isset($_POST['op']) && $_POST['op'] == "login" ) { |
70 | 69 | // Perform login! |
71 | 70 | if ( $_POST['op'] == "login" ) |
72 | 71 | { |
73 | 72 | if ( |
74 | 73 | (isset($_POST['uname']) && strlen($_POST['uname']) > 0) |
75 | 74 | && |
76 | 75 | (isset($_POST['pass']) && strlen($_POST['pass']) > 0) |
77 | | - ) |
78 | | - { |
79 | | - // Set Username and password |
80 | | - $content['uname'] = DB_RemoveBadChars($_POST['uname']); |
81 | | - $content['pass'] = $_POST['pass']; // RAW Copy of password string, otherwise passwords with special characters can be broken. |
| 76 | + ) { |
| 77 | + // Copy Username and password for template system |
| 78 | + $content['uname'] = htmlspecialchars(DB_RemoveBadChars($_POST['uname'])); // URL Decode the username to avoid XSS issues! |
| 79 | + $content['pass'] = htmlspecialchars($_POST['pass']); // RAW Copy of password string, otherwise passwords with special characters can be broken. |
82 | 80 |
|
83 | | - if ( !CheckUserLogin( $content['uname'], $content['pass']) ) |
84 | | - { |
| 81 | + // Use raw properties for database login check |
| 82 | + if ( !CheckUserLogin( DB_RemoveBadChars($_POST['uname']), $_POST['pass']) ) { |
85 | 83 | $content['ISERROR'] = "true"; |
86 | 84 | $content['ERROR_MSG'] = $content['LN_LOGIN_ERRWRONGPASSWORD']; |
87 | 85 | } |
88 | 86 | else |
89 | 87 | RedirectPage( urldecode($szRedir) ); |
90 | | - } |
91 | | - else |
92 | | - { |
| 88 | + } else { |
93 | 89 | $content['ISERROR'] = "true"; |
94 | 90 | $content['ERROR_MSG'] = $content['LN_LOGIN_USERPASSMISSING']; |
95 | 91 | } |
96 | 92 | } |
97 | | -} |
98 | | -else if ( isset($_GET['op']) && $_GET['op'] == "logoff" ) |
99 | | -{ |
| 93 | +} else if ( isset($_GET['op']) && $_GET['op'] == "logoff" ) { |
100 | 94 | // logoff in this case |
101 | 95 | DoLogOff(); |
102 | 96 | } |
|
0 commit comments