- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
# POST /register
Public Function Register(){
foreach((array)$_POST as $k=>$v)
$_POST[$k] = addslashes(strip_tags($v));
$login = $_POST['Login'];
$password = $_POST['Password'];
$email = $_POST['Email'];
$firstname = $_POST['FirstName'];
$lastname = $_POST['LastName'];
$errors = array();
IF(!Session::Restore()){
Driver::Init();
IF(String::is_valid_email_address($email)){
IF(strlen($login) > 3 && strlen($login) <= 12 && String::Check('([a-zA-Z0-9_]+)', $login) ){
IF(strlen($password) > 5 && $password == $_POST['RePassword']){
$users = Collection::Get('users')->Select(Query::Equal('login', $login));
IF(!sizeof($users)){
$user = new User;
$user->login = strtolower($login);
$user->password = md5($password);
$user->regtime = time();
$photo = UploadedFiles::Get('Photo');
IF($photo)
IF($photo->exists){
$photoHash = md5('photo_'.$user->login);
$photosPath = APPLICATION_DIR.'/assets/uploads/photos';
$photo->Path = $photosPath.'/tmp/'.$photoHash;
ImageProcessing::MakeThumb($photo->Path, $photosPath.'/300/'.$photoHash.'.jpg', 100, 300, 500);
ImageProcessing::MakeThumb($photo->Path, $photosPath.'/100/'.$photoHash.'.jpg', 100, 100);
ImageProcessing::MakeThumb($photo->Path, $photosPath.'/50/'.$photoHash.'.jpg', 100, 50);
@unlink($photo->Path);
$user->photo = $photoHash;
}
$user->save();
Session::Link($login, $password);
return Router::Redirect('/profile');
}
else $errors[] = l('This username is already taken');
}
else $errors[] = l('Password length must be more than 3');
}
else $errors[] = l('Login length must be more than 3, and less than 13 characters and contain only Latin characters');
}
else $errors[] = l('Your email address must be in the format of [email protected]');
}
else $errors[] = l("You are already registered");
$view = new View('main.php');
return $view->Set('Content', 'registration.php')->Set('login', $login)->Set('email', $email)->Set('firstname', $firstname)->Set('lastname', $lastname)->Set('errors', $errors);
}
d3n4 14.12.2012 15:35 # −1
Lowezar 14.12.2012 16:06 # −2
Не, передаётся.
d3n4 14.12.2012 16:15 # −2
Lowezar 20.12.2012 14:36 # −1
d3n4 20.12.2012 16:13 # −2
Я не имел ввиду что он передается или нет
Я имел ввиду что массив всегда будет содержать 1 элемент
поэтому не вижу смысла делать его массивом.
Lowezar 20.12.2012 20:59 # −1
d3n4 14.12.2012 16:24 # −1
tirinox 18.12.2012 23:01 # +1