コード例 #1
0
        
      
    </div>

	<?php 
include 'config.php';
db_connect();
if (!$_SESSION['logged']) {
    if (isset($_POST['zarejestruj'])) {
        $_POST['check'] = filtruj($_POST['check']);
        $_POST['imie'] = filtruj($_POST['imie']);
        $_POST['nazwisko'] = filtruj($_POST['nazwisko']);
        $_POST['password'] = filtruj($_POST['password']);
        $_POST['password2'] = filtruj($_POST['password2']);
        $haslomd5 = md5($_POST['password']);
        $_POST['email'] = filtruj($_POST['email']);
        if (empty($_POST['check']) || empty($_POST['imie']) || empty($_POST['password']) || empty($_POST['password2']) || empty($_POST['email'])) {
            echo '<p class="alert">Musisz wypełnić wszystkie pola.</p>';
        } elseif ($_POST['password'] != $_POST['password2']) {
            echo '<p class="alert">Podane hasła różnią się od siebie.</p>';
        } elseif (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) {
            echo '<p class="alert">Podany email jest nieprawidłowy.</p>';
        } elseif ($_POST['check'] == fotograf) {
            $result = mysql_query("SELECT Count(id_fotografa) FROM `fotograf` WHERE `email` = '{$_POST['email']}'");
            $row = mysql_fetch_row($result);
            if ($row[0] > 0) {
                echo '<p class="alert">Już istnieje fotograf z takim adresem e-mail.</p>';
            } else {
                mysql_query("INSERT INTO fotograf (`nazwisko`, `imie`, `haslo`, `email`) VALUES ('{$_POST['nazwisko']}', '{$_POST['imie']}', '{$haslomd5}', '{$_POST['email']}')");
                echo '<p>Zostałeś poprawnie zarejestrowany jako fotograf! Możesz się teraz <a href="login.php">zalogować</a>.</p>';
            }
コード例 #2
0
  <div id="container">
   <div class="navbar navbar-fixed-top">
      
        <a class="pull-left" style="vertical-align:middle; line-height:100%;width:60%;height:100%;font-family:'Bree Serif',cursive;font-size:18px;color:white;background-color:#ed5050;" href="website.php"><img src="home.png"><label href="website.php">&nbsp;&nbsp;START</label></a>
        <a  class="pull-right" style="vertical-align:middle; line-height:100%;width:20%;height:100%;text-align:right;font-family:'Bree Serif',cursive;font-size:18px;color:white;background-color:#00A2E8;"  href="login.php" ><label href="login.php" class="hidden-xs-right">LOGOWANIE&nbsp;&nbsp;</label><img src="login.png"></a>
        <a  class="pull-right" style="vertical-align:middle; line-height:100%;width:20%;height:100%;text-align:right;font-family:'Bree Serif',cursive;font-size:18px;color:white;background-color:#64e05c;" href="register.php" ><label href="register.php" class="hidden-xs-right">REJESTRACJA&nbsp;&nbsp;</label><img src="register.png"></a>
        
      
    </div>
  <?php 
include 'config.php';
db_connect();
if (!$_SESSION['logged']) {
    if (isset($_POST['logemail'])) {
        $_POST['email'] = filtruj($_POST['logemail']);
        $_POST['haslo'] = filtruj($_POST['loghaslo']);
        $haslomd5 = md5($_POST['haslo']);
        $result = mysql_query("SELECT `id_fotografa`,`imie`,`nazwisko` FROM `fotograf` WHERE `email` = '{$_POST['email']}' AND `haslo` = '{$haslomd5}' LIMIT 1");
        if (mysql_num_rows($result) > 0) {
            $row = mysql_fetch_assoc($result);
            $_SESSION['logged'] = true;
            $_SESSION['id'] = $row['id_fotografa'];
            $_SESSION['imie'] = $row['imie'];
            $_SESSION['nazwisko'] = $row['nazwisko'];
            header('Location: fotografprofil.php');
        } else {
            $result = mysql_query("SELECT `id_klienta`,`imie`,`nazwisko` FROM `klient` WHERE `email` = '{$_POST['email']}' AND `haslo` = '{$haslomd5}' LIMIT 1");
            if (mysql_num_rows($result) > 0) {
                $row = mysql_fetch_assoc($result);
                $_SESSION['logged_klient'] = true;
                $_SESSION['id'] = $row['id_klienta'];