projects
/
scuttle
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* Fixed REG_BADRPT error in isValidEmail() that prevented registration
[scuttle]
/
services
/
userservice.php
diff --git
a/services/userservice.php
b/services/userservice.php
index 1e7ed46981a39e46b0a4370d2b8735246ffd65d5..e0b7ba9320c02ee79b4edff6c3cbd4969f9a9d9d 100644
(file)
--- a/
services/userservice.php
+++ b/
services/userservice.php
@@
-63,8
+63,6
@@
class UserService {
}
function _randompassword() {
}
function _randompassword() {
- $seed = (integer) md5(microtime());
- mt_srand($seed);
$password = mt_rand(1, 99999999);
$password = substr(md5($password), mt_rand(0, 19), mt_rand(6, 12));
return $password;
$password = mt_rand(1, 99999999);
$password = substr(md5($password), mt_rand(0, 19), mt_rand(6, 12));
return $password;
@@
-145,7
+143,7
@@
class UserService {
return false;
}
return false;
}
- function login($username, $password, $remember = FALSE) {
+ function login($username, $password, $remember = FALSE
, $path = '/'
) {
$password = $this->sanitisePassword($password);
$query = 'SELECT '. $this->getFieldName('primary') .' FROM '. $this->getTableName() .' WHERE '. $this->getFieldName('username') .' = "'. $this->db->sql_escape($username) .'" AND '. $this->getFieldName('password') .' = "'. $this->db->sql_escape($password) .'"';
$password = $this->sanitisePassword($password);
$query = 'SELECT '. $this->getFieldName('primary') .' FROM '. $this->getTableName() .' WHERE '. $this->getFieldName('username') .' = "'. $this->db->sql_escape($username) .'" AND '. $this->getFieldName('password') .' = "'. $this->db->sql_escape($password) .'"';
@@
-158,7
+156,7
@@
class UserService {
$id = $_SESSION[$this->getSessionKey()] = $row[$this->getFieldName('primary')];
if ($remember) {
$cookie = $id .':'. md5($username.$password);
$id = $_SESSION[$this->getSessionKey()] = $row[$this->getFieldName('primary')];
if ($remember) {
$cookie = $id .':'. md5($username.$password);
- setcookie($this->cookiekey, $cookie, time() + $this->cookietime);
+ setcookie($this->cookiekey, $cookie, time() + $this->cookietime
, $path
);
}
return true;
} else {
}
return true;
} else {
@@
-166,8
+164,8
@@
class UserService {
}
}
}
}
- function logout() {
- @setcookie($this->cookiekey, NULL, time() - 1);
+ function logout(
$path = '/'
) {
+ @setcookie($this->cookiekey, NULL, time() - 1
, $path
);
unset($_COOKIE[$this->cookiekey]);
session_unset();
$this->getCurrentUser(TRUE, false);
unset($_COOKIE[$this->cookiekey]);
session_unset();
$this->getCurrentUser(TRUE, false);
@@
-335,7
+333,7
@@
class UserService {
}
function isValidEmail($email) {
}
function isValidEmail($email) {
- if (
eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$", $email)
) {
+ if (
preg_match("/^((?:(?:(?:\w[\.\-\+_]?)*)\w)+)\@((?:(?:(?:\w[\.\-_]?){0,62})\w)+)\.(\w{2,6})$/i", $email) > 0
) {
list($emailUser, $emailDomain) = split("@", $email);
// Check if the email domain has a DNS record
list($emailUser, $emailDomain) = split("@", $email);
// Check if the email domain has a DNS record
Benjamin Mako Hill
||
Want to submit a patch?