Changeset 286 for trunk/includes/global.php
- Timestamp:
- Dec 22, 2009, 10:22:38 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/global.php
r284 r286 183 183 function ShowPage() 184 184 { 185 global $Config, $Database, $RSSChannels ;185 global $Config, $Database, $RSSChannels, $PageFooterRequested; 186 186 187 187 echo('<?xml version="1.0" encoding="'.$Config['Web']['Charset'].'"?> … … 208 208 </table>'); 209 209 210 if(!array_key_exists('UserID', $_SESSION)) $_SESSION['UserID'] = '';211 if(!array_key_exists('User', $_SESSION)) $_SESSION['User'] = 'NotRegistred';212 if(!array_key_exists('Pass', $_SESSION)) $_SESSION['Pass'] = '';213 214 215 //odhlášení216 if(array_key_exists('Logout', $_GET))217 {218 WriteLog('Odhlášení', 3);219 if(is_numeric($_SESSION['UserID']))220 $Database->SQLCommand('UPDATE user SET LastLogout = NOW() WHERE ID = '.$_SESSION['UserID']);221 $_SESSION['User'] = '';222 $_SESSION['Pass'] = '';223 $_SESSION['UserID'] = '';224 }225 226 // Přihlášení227 if(array_key_exists('LoginUser', $_POST))228 {229 $_SESSION['User'] = $_POST['LoginUser'];230 $_SESSION['Pass'] = $_POST['LoginPass'];231 232 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM user WHERE LOWER(user) = LOWER("'.$_SESSION['User'].'") AND pass = sha1("'.$_SESSION['Pass'].'")'));233 if(!$Line)234 {235 echo('<script> alert("Jméno nebo heslo bylo zadáno špatně!"); </script>');236 $_SESSION['UserID'] = '';237 $_SESSION['User'] = '';238 $_SESSION['Pass'] = '';239 } else240 {241 $_SESSION['UserID'] = $Line['ID'];242 $_SESSION['User'] = $Line['user'];243 WriteLog('Login: '.$_SESSION['User'], 3);244 }245 }210 if(!array_key_exists('UserID', $_SESSION)) $_SESSION['UserID'] = ''; 211 if(!array_key_exists('User', $_SESSION)) $_SESSION['User'] = 'NotRegistred'; 212 if(!array_key_exists('Pass', $_SESSION)) $_SESSION['Pass'] = ''; 213 214 215 // Odhlášení 216 if(array_key_exists('Logout', $_GET)) 217 { 218 WriteLog('Odhlášení', 3); 219 if(is_numeric($_SESSION['UserID'])) 220 $Database->SQLCommand('UPDATE user SET LastLogout = NOW() WHERE ID = '.$_SESSION['UserID']); 221 $_SESSION['User'] = ''; 222 $_SESSION['Pass'] = ''; 223 $_SESSION['UserID'] = ''; 224 } 225 226 // Přihlášení 227 if(array_key_exists('LoginUser', $_POST)) 228 { 229 $_SESSION['User'] = $_POST['LoginUser']; 230 $_SESSION['Pass'] = $_POST['LoginPass']; 231 232 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM user WHERE LOWER(user) = LOWER("'.$_SESSION['User'].'") AND pass = sha1("'.$_SESSION['Pass'].'")')); 233 if(!$Line) 234 { 235 echo('<script> alert("Jméno nebo heslo bylo zadáno špatně!"); </script>'); 236 $_SESSION['UserID'] = ''; 237 $_SESSION['User'] = ''; 238 $_SESSION['Pass'] = ''; 239 } else 240 { 241 $_SESSION['UserID'] = $Line['ID']; 242 $_SESSION['User'] = $Line['user']; 243 WriteLog('Login: '.$_SESSION['User'], 3); 244 } 245 } 246 246 247 247 //záznam o aktivitě … … 258 258 ShowSearchBox(); 259 259 echo('</td><td id="border-left"></td><td class="content">'); 260 $PageFooterRequested = true; 260 261 } 261 262 … … 277 278 function ShowFooter() 278 279 { 279 global $Database, $Config, $ScriptStartTime; 280 281 $ScriptGenerateDuration = round(GetMicrotime() - $ScriptStartTime, 2); 282 283 echo('</td>'); 284 echo('<td class="menu2">'); 285 ShowTranslatedMenu(); 286 echo('<br />'); 287 ShowShoutBox(); 288 echo('</td>'. 280 global $Database, $Config, $ScriptStartTime, $PageFooterRequested; 281 282 if(isset($PageFooterRequested)) 283 { 284 $ScriptGenerateDuration = round(GetMicrotime() - $ScriptStartTime, 2); 285 286 echo('</td>'); 287 echo('<td class="menu2">'); 288 ShowTranslatedMenu(); 289 echo('<br />'); 290 ShowShoutBox(); 291 echo('</td>'. 289 292 '</tr><tr>'. 290 293 '<td colspan="4" class="page-bottom">Autoři: maron, chronos <a href="http://wowpreklad.zdechov.net/trac/wowpreklad/browser/trunk">Zdrojové soubory</a> '. … … 297 300 </script>'); 298 301 299 echo('</td></tr>'); 300 if($Config['Web']['ShowRuntimeInfo'] == true) echo('<tr><td colspan="3" style="text-align: center;">Doba generování: '.$ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B</td></tr>'); 301 echo('</table>'. 302 '</body>'. 303 '</html>'); 304 $Database->Disconnect(); 302 echo('</td></tr>'); 303 if($Config['Web']['ShowRuntimeInfo'] == true) echo('<tr><td colspan="3" style="text-align: center;">Doba generování: '.$ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B</td></tr>'); 304 echo('</table>'. 305 '</body>'. 306 '</html>'); 307 $Database->Disconnect(); 308 } 305 309 } 306 310 … … 313 317 if($Part != '') 314 318 { 319 if(!strpos($Part, '=')) $Part .= '='; 315 320 $Item = explode('=', $Part); 316 321 $Result[$Item[0]] = $Item[1];
Note:
See TracChangeset
for help on using the changeset viewer.