Esempio n. 1
0
					<div class="right_part">
					<?php 
        if (isset($_POST['passreset_send'])) {
            $mail = $_POST['passreset_mail'];
            $link = 'http://wi.ourtrips.pl/passreset.php?action=resetNow&code=' . md5($_POST['passreset_mail'] . 'zXdfcmKs35Dc') . '&mail=' . $_POST['passreset_mail'];
            $wiadomosc = <<<EOD
<html>
\t<body>
\t\t<h2>Reset hasła dla {$mail}!</h2>
\t\t<p>Jeżeli chcesz zresetować swoje hasło, kliknij w link ponieżej:</p>
\t\t<a href="{$link}">{$link}</a>
\t</body>
</html>
EOD;
            if ($my_userAction->pass_reset($_POST['passreset_mail'])) {
                my_eMail::send($wiadomosc, '*****@*****.**', $_POST['passreset_mail'], 'Reset hasła :: WiRunner', 'passreset');
            }
        }
        ?>
					</div>
				</section>

<?php 
    }
} else {
    header("Location: konto.php");
}
?>
		</article>
<?php 
include 'php/bottom.php';
Esempio n. 2
0
    function register($dane)
    {
        if (!my_validDate::wymagane(array($dane['email'], $dane['haslo'], $dane['eqhaslo']))) {
            $bledy[] = 'Aby się zarejestrować wprowadź adres e-mail i hasło';
        }
        if (!my_validDate::specjalne(array($dane['haslo']))) {
            $bledy[] = 'Hasło może zawierać tylko litery i cyfry';
        }
        if (!my_validDate::dlugoscmin(array($dane['haslo']), 4)) {
            $bledy[] = 'Minimalna długość hasła to cztery znaki';
        }
        if (!my_validDate::wymagane(array($dane['zgoda']))) {
            $bledy[] = 'Musisz zaakceptować regulamin serwisu';
        }
        if (!my_validDate::email(array($dane['email']))) {
            $bledy[] = 'Podano niepoprawny adres e-mail';
        }
        if ($dane['haslo'] != $dane['eqhaslo']) {
            $bledy[] = 'Podane hasła nie zgadzają się';
        }
        if (!my_validDate::wymagane(array($dane['plec']))) {
            $bledy[] = 'Podaj swoją płeć';
        }
        if (!isset($bledy)) {
            try {
                $stmt = $this->pdo->prepare('SELECT id_uzytkownika FROM uzytkownicy WHERE email LIKE BINARY :email');
                $stmt->bindValue(':email', $dane['email'], PDO::PARAM_STR);
                $stmt->execute();
                if ($stmt->rowCount() == 1) {
                    $bledy[] = 'Użytkownik o takim adresie e-mail już istnieje';
                }
                $stmt->closeCursor();
                unset($stmt);
            } catch (PDOException $e) {
                echo '<p>Wystąpił błąd biblioteki PDO</p>';
                //echo '<p>Wystąpił błąd biblioteki PDO: ' . $e -> getMessage().'</p>';
            }
        }
        if (!isset($bledy)) {
            try {
                $stmt = $this->pdo->prepare('INSERT INTO uzytkownicy(email, haslo, data_rejestracji, nr_rangi, plec) VALUES(:mail, :haslo, :data, :ranga, :plec)');
                $stmt->bindValue(':mail', $dane['email'], PDO::PARAM_STR);
                $stmt->bindValue(':haslo', md5($dane['haslo']), PDO::PARAM_STR);
                $stmt->bindValue(':data', date("Y-m-d H:i:s"), PDO::PARAM_STR);
                $stmt->bindValue(':ranga', 3, PDO::PARAM_INT);
                $stmt->bindValue(':plec', $dane['plec'], PDO::PARAM_STR);
                $count = $stmt->execute();
                if ($count != 1) {
                    $bledy[] = 'Nieoczekiwany błąd podczas dodawania użytkownika';
                } else {
                    if ($count == 1) {
                        $last_id = $this->pdo->lastInsertId();
                        $mail = $dane['email'];
                        $link = 'http://wi.ourtrips.pl/login.php?action=accountActiv&code=' . md5($last_id . 'zXdfcmKs35Dc') . '&mail=' . $dane['email'];
                        $wiadomosc = <<<EOD
<html>
\t<body>
\t\t<h2>Aktywacja konta {$mail}!</h2>
\t\t<p>Jeżeli rejestrowałeś się na naszej stronie, kliknij w poniższy link w celu aktywacji:</p>
\t\t<a href="{$link}">{$link}</a>
\t</body>
</html>
EOD;
                        my_eMail::send($wiadomosc, '*****@*****.**', $dane['email'], 'Aktywacja konta :: WiRunner', 'mailactiv');
                        header("Location: login.php?msg=justReg");
                    }
                }
                $stmt->closeCursor();
                unset($stmt);
            } catch (PDOException $e) {
                echo '<p>Wystąpił błąd biblioteki PDO</p>';
                //echo '<p>Wystąpił błąd biblioteki PDO: ' . $e -> getMessage().'</p>';
            }
        }
        if (isset($bledy) && count($bledy) > 0) {
            my_simpleMsg::show('Błedy rejestracji!', $bledy, 0);
            if (count($bledy) === 1 && $bledy[0] == 'Użytkownik o takim adresie e-mail już istnieje') {
                return 0;
            }
            return -1;
        }
        return 0;
    }