- Timestamp:
- Feb 4, 2014, 12:02:38 PM (11 years ago)
- Location:
- trunk/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r27043 r27158 2019 2019 function url_check_format($url) 2020 2020 { 2021 if (version_compare(PHP_VERSION, '5.2.0') >= 0) 2022 { 2023 return filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED)!==false; 2024 } 2025 else 2026 { 2027 // http://mathiasbynens.be/demo/url-regex @imme_emosol 2028 return (bool)preg_match('@^https?://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?$@iS', $url); 2029 } 2021 return filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED)!==false; 2030 2022 } 2031 2023 … … 2038 2030 function email_check_format($mail_address) 2039 2031 { 2040 if (version_compare(PHP_VERSION, '5.2.0') >= 0) 2041 { 2042 return filter_var($mail_address, FILTER_VALIDATE_EMAIL)!==false; 2043 } 2044 else 2045 { 2046 $atom = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]'; // before arobase 2047 $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name 2048 $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i'; 2049 2050 return (bool)preg_match($regex, $mail_address); 2051 } 2032 return filter_var($mail_address, FILTER_VALIDATE_EMAIL)!==false; 2052 2033 } 2053 2034 -
trunk/include/functions_user.inc.php
r26461 r27158 940 940 { 941 941 $cookie = $user_id.'-'.$now.'-'.$key; 942 if (version_compare(PHP_VERSION, '5.2', '>=') ) 943 { 944 setcookie($conf['remember_me_name'], 945 $cookie, 946 time()+$conf['remember_me_length'], 947 cookie_path(),ini_get('session.cookie_domain'),ini_get('session.cookie_secure'), 948 ini_get('session.cookie_httponly') 949 ); 950 } 951 else 952 { 953 setcookie($conf['remember_me_name'], 954 $cookie, 955 time()+$conf['remember_me_length'], 956 cookie_path(),ini_get('session.cookie_domain'),ini_get('session.cookie_secure') 957 ); 958 } 942 setcookie($conf['remember_me_name'], 943 $cookie, 944 time()+$conf['remember_me_length'], 945 cookie_path(),ini_get('session.cookie_domain'),ini_get('session.cookie_secure'), 946 ini_get('session.cookie_httponly') 947 ); 959 948 } 960 949 }
Note: See TracChangeset
for help on using the changeset viewer.