[ Index ] |
PHP Cross Reference of phpwcms V1.4.7 _r403 (01.11.10) |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 Copyright notice 4 5 (c) 2002-2010 Oliver Georgi (oliver@phpwcms.de) // All rights reserved. 6 7 This script is part of PHPWCMS. The PHPWCMS web content management system is 8 free software; you can redistribute it and/or modify it under the terms of 9 the GNU General Public License as published by the Free Software Foundation; 10 either version 2 of the License, or (at your option) any later version. 11 12 The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html 13 A copy is found in the textfile GPL.txt and important notices to the license 14 from the author is found in LICENSE.txt distributed with these scripts. 15 16 This script is distributed in the hope that it will be useful, but WITHOUT ANY 17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 18 PARTICULAR PURPOSE. See the GNU General Public License for more details. 19 20 This copyright notice MUST APPEAR in all copies of the script! 21 *************************************************************************************/ 22 23 // ---------------------------------------------------------------- 24 // obligate check for phpwcms constants 25 if (!defined('PHPWCMS_ROOT')) { 26 die("You Cannot Access This Script Directly, Have a Nice Day."); 27 } 28 // ---------------------------------------------------------------- 29 30 // general frontend login form 31 32 $_loginData = array(); 33 $_loginData['template'] = ''; // this is what is to be displayed in frontend 34 35 if(strpos($content['all'], '{LOGIN_DATA}')) { 36 37 // 1st we load template data 38 if(is_file(PHPWCMS_TEMPLATE.'inc_default/fe_login.tmpl')) { 39 40 $_loginData['template'] = @file_get_contents(PHPWCMS_TEMPLATE.'inc_default/fe_login.tmpl'); 41 42 $_loginData['form'] = get_tmpl_section('LOGIN_FORM', $_loginData['template']); 43 $_loginData['logged_in'] = get_tmpl_section('LOGIN_IS', $_loginData['template']); 44 $_loginData['settings'] = get_tmpl_section('LOGIN_SETTINGS', $_loginData['template']); 45 $_loginData['settings'] = parse_ini_str($_loginData['settings'], false); 46 $_loginData['settings'] = array_merge( array( 'date_format' => "%m/%d/%y", 47 'set_locale' => '', 48 'cookie_exire' => 7776000 49 ) , $_loginData['settings'] ); 50 51 // for future use 52 //$_loginData['profile'] = get_tmpl_section('LOGIN_PROFIE', $_loginData['template']); 53 54 $_loginData['session_key'] = session_id(); 55 56 $_loginData['template'] = $_loginData['form']; 57 $_loginData['error'] = false; 58 $_loginData['login'] = ''; 59 $_loginData['password'] = ''; 60 $_loginData['remember'] = 0; 61 62 // handle Login 63 if(isset($_POST['feLogin'])) { 64 65 $_loginData['login'] = slweg($_POST['feLogin']); 66 $_loginData['password'] = slweg($_POST['fePassword']); 67 $_loginData['remember'] = empty($_POST['feRemember']) ? 0 : 1; 68 69 $_loginData['query_result'] = _checkFrontendUserLogin($_loginData['login'], md5($_loginData['password'])); 70 71 // ok, and now check if we got valid login data 72 if($_loginData['query_result'] !== false && is_array($_loginData['query_result']) && count($_loginData['query_result'])) { 73 74 $_SESSION[ $_loginData['session_key'] ] = $_loginData['login']; 75 76 if($_loginData['remember']) { 77 78 setcookie( 'phpwcmsFeLoginRemember', $_loginData['login'].'##-|-##'.md5($_loginData['password']), 79 time()+$_loginData['settings']['cookie_expire'], '/', getCookieDomain() ); 80 81 } 82 83 } else { 84 85 $_loginData['error'] = true; 86 87 } 88 89 } 90 91 if(_getFeUserLoginStatus()) { 92 // user is logged in 93 if(isset($_POST['feLogin'])) { 94 headerRedirect(decode_entities(FE_CURRENT_URL)); 95 } 96 $_loginData['template'] = $_loginData['logged_in']; 97 $_loginData['template'] = str_replace('{LOGIN}', html_specialchars( $_SESSION[ $_loginData['session_key'] ] ), $_loginData['template']); 98 99 } else { 100 101 $_loginData['template'] = render_cnt_template($_loginData['template'], 'ERROR', ($_loginData['error'] ? 'login/pass wrong' : '') ); 102 $_loginData['template'] = render_cnt_template($_loginData['template'], 'LOGIN', html_specialchars($_loginData['login'])); 103 $_loginData['template'] = render_cnt_template($_loginData['template'], 'PASSWORD', ''); 104 $_loginData['template'] = render_cnt_template($_loginData['template'], 'REMEMBER', ($_loginData['remember'] ? ' checked="checked"' : '') ); 105 106 } 107 108 $_loginData['template'] = str_replace('{FORM_TARGET}', FE_CURRENT_URL, $_loginData['template']); 109 110 } 111 } 112 113 $content['all'] = str_replace('{LOGIN_DATA}', $_loginData['template'], $content['all']); 114 115 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Nov 16 22:51:00 2010 | Cross-referenced by PHPXref 0.7 |