if( isset($_POST['user_Email'], $_POST['user_birthsday'], $_POST['user_pass'], $_POST['user_RePass']) ) {
//reg
$errors = array();
if(R::count('users', "email = ?", array($data['user_Email'])) > 0) {
$errors[] = 'already reg';
}
if(empty ($errors)) {
$user = R::dispense('users');
$user->email = $data['user_Email'];
$user->birthsday = $data['user_birthsday'];
$user->password = password_hash($data['user_pass'], PASSWORD_DEFAULT);
R::store($user);
} else {
$error = array_shift($errors);
return $error;
}
$reg = R::findOne('users', 'email = ?', array($data['user_Email']));
$_SESSION['reg_user'] = $reg;
header('Location: /other_page');
die();
}
class usersView
{
private function info()
{
$sqlInfo = "SELECT * FROM `RegUsers`";
$mySql = new mysqli('localhost', 'root', '', 'GuestBook');
mysqli_query($mySql, "SET NAMES 'utf8' COLLATE 'utf8_general_ci'");
mysqli_query($mySql, "SET CHARACTER SET 'utf8'");
$resultSql = mysqli_query($mySql, $sqlInfo);
return $resultSql;
}
public function showUsers()
{
$resultSql = $this->info();
if ($resultSql) {
while ($row = mysqli_fetch_assoc($resultSql)) {
echo 'Логин ' . $row['Log'] . '<br>';
echo 'Пароль ' . $row['Pass'] . '<br>';
echo 'Маил ' . $row['mail'] . '<br>';
echo 'Город ' . $row['town'] . '<br>';
echo 'Пол ' . $row['pol'] . '<br>';
echo 'Возраст ' . $row['years'] . '<br>';
echo 'Аватарка ' . $row['ProfPic'] . '<br>';
echo 'Статус ' . $row['status'] . '<br>';
echo '<hr>';
};exit();
}
}
}
$user = new usersView();
$user->showUsers();
?>