|
|
@ -5,6 +5,24 @@ |
|
|
|
if(count($_SESSION['CART']) <= 0) { |
|
|
|
header("location: /acquistare"); |
|
|
|
} |
|
|
|
|
|
|
|
if($_POST['login_usr'] && $_POST['login_pwd']) { |
|
|
|
$q = mysqli_query($conn, "SELECT * FROM users WHERE email = '".trim($_POST['login_usr'])."' AND |
|
|
|
password = '".md5(trim($_POST['login_pwd']))."'"); |
|
|
|
$r = mysqli_fetch_array($q); |
|
|
|
|
|
|
|
if(mysqli_num_rows($q)) { |
|
|
|
$_SESSION['AUTH'] = $r; |
|
|
|
} else { |
|
|
|
unset($_SESSION['AUTH']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if($getQ[1] == 'logout') { |
|
|
|
unset($_SESSION['AUTH']); |
|
|
|
header("location: /checkout"); |
|
|
|
} |
|
|
|
|
|
|
|
?> |
|
|
|
|
|
|
|
|
|
|
@ -14,55 +32,101 @@ |
|
|
|
|
|
|
|
<div class="col-12 col-md-8 pb-5"> |
|
|
|
<span class="title">Dettagli fatturazione</span> |
|
|
|
<span class="subtitle">Sei già nostro cliente? <span class="toggle-login">Accedi</span></span> |
|
|
|
<span class="subtitle"> |
|
|
|
<span class="question <?= isset($_SESSION['AUTH']) ? 'd-none' : '';?>">Sei già nostro cliente?</span> |
|
|
|
<span class="toggle-login <?= isset($_SESSION['AUTH']) ? 'd-none' : '';?>">Accedi</span> |
|
|
|
</span> |
|
|
|
|
|
|
|
<form class="login-form <?= isset($_SESSION['AUTH']) ? 'd-none' :'';?>" action="/checkout" method="POST"> |
|
|
|
<div class="row"> |
|
|
|
<div class="col-12 col-md-6"> |
|
|
|
<span class="label">E-mail</span> |
|
|
|
<input type="email" name="login_usr" class="input-text"> |
|
|
|
</div> |
|
|
|
<div class="col-12 col-md-6"> |
|
|
|
<span class="label">Password</span> |
|
|
|
<input type="password" name="login_pwd" class="input-text"> |
|
|
|
</div> |
|
|
|
<div class="col-12 mt-4"> |
|
|
|
<button class="button button-brown button-big ml-auto">Accedi</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</form> |
|
|
|
|
|
|
|
<div class="row"> |
|
|
|
<div class="row new-user-form <?= isset($_SESSION['AUTH']) ? 'logged' :'';?>"> |
|
|
|
<div class="col-12 col-md-6 pr-2 pr-md-4"> |
|
|
|
<span class="label">Nome *</span> |
|
|
|
<input type="text" name="first_name" class="input input-text" required> |
|
|
|
<input type="text" name="first_name" class="input input-text" |
|
|
|
value="<?= $_SESSION['AUTH']['first_name'];?>" |
|
|
|
<?= isset($_SESSION['AUTH']) ? 'disabled' : '';?> required> |
|
|
|
</div> |
|
|
|
<div class="col-12 col-md-6 pr-2 pr-md-4"> |
|
|
|
<span class="label">Cognome *</span> |
|
|
|
<input type="text" name="last_name" class="input input-text" required> |
|
|
|
<input type="text" name="last_name" class="input input-text" |
|
|
|
value="<?= $_SESSION['AUTH']['last_name'];?>" |
|
|
|
<?= isset($_SESSION['AUTH']) ? 'disabled' : '';?> required> |
|
|
|
</div> |
|
|
|
<div class="col-12 col-md-6 pr-2 pr-md-4"> |
|
|
|
<span class="label">E-mail *</span> |
|
|
|
<input type="email" name="email" class="input input-text" required> |
|
|
|
<input type="email" name="email" class="input input-text" |
|
|
|
value="<?= $_SESSION['AUTH']['email'];?>" |
|
|
|
<?= isset($_SESSION['AUTH']) ? 'disabled' : '';?> required> |
|
|
|
</div> |
|
|
|
<div class="col-12 col-md-6 pr-2 pr-md-4"> |
|
|
|
<span class="label">Telefono</span> |
|
|
|
<input type="tel" name="phone" class="input input-text"> |
|
|
|
<input type="tel" name="phone" class="input input-text" |
|
|
|
value="<?= $_SESSION['AUTH']['phone'];?>" |
|
|
|
<?= isset($_SESSION['AUTH']) ? 'disabled' : '';?>> |
|
|
|
</div> |
|
|
|
<div class="col-12 col-md-6 pr-2 pr-md-4"> |
|
|
|
<span class="label">Indirizzo *</span> |
|
|
|
<input type="text" name="address" class="input input-text" required> |
|
|
|
<input type="text" name="address" class="input input-text" |
|
|
|
value="<?= $_SESSION['AUTH']['address'];?>" |
|
|
|
<?= isset($_SESSION['AUTH']) ? 'disabled' : '';?> required> |
|
|
|
</div> |
|
|
|
<div class="col-12 col-md-6 pr-2 pr-md-4"> |
|
|
|
<span class="label">Città *</span> |
|
|
|
<input type="text" name="city" class="input input-text" required> |
|
|
|
<input type="text" name="city" class="input input-text" |
|
|
|
value="<?= $_SESSION['AUTH']['city'];?>" |
|
|
|
<?= isset($_SESSION['AUTH']) ? 'disabled' : '';?> required> |
|
|
|
</div> |
|
|
|
<div class="col-12 col-md-4 pr-2 pr-md-4 mr-auto"> |
|
|
|
<span class="label">CAP *</span> |
|
|
|
<input type="text" name="zip_code" class="input input-text" required> |
|
|
|
<input type="text" name="zip_code" class="input input-text" |
|
|
|
value="<?= $_SESSION['AUTH']['zip_code'];?>" |
|
|
|
<?= isset($_SESSION['AUTH']) ? 'disabled' : '';?> required> |
|
|
|
</div> |
|
|
|
<div class="col-12 col-md-4 pr-2 pr-md-4 mr-auto"> |
|
|
|
<span class="label">Provincia *</span> |
|
|
|
<select name="province" class="input input-select" required> |
|
|
|
<?php |
|
|
|
if(isset($_SESSION['AUTH'])) { |
|
|
|
echo "<input type=\"text\" name=\"province\" class=\"input input-text\" |
|
|
|
value=\"".$_SESSION['AUTH']['province']."\" disabled required>"; |
|
|
|
} else { |
|
|
|
?> |
|
|
|
<select name="province" class="input input-select" |
|
|
|
<?= isset($_SESSION['AUTH']) ? 'disabled' : '';?> required> |
|
|
|
<?php |
|
|
|
foreach($PROV as $k => $p) { |
|
|
|
echo "<option value=\"".$k."\">".$p."</option>"; |
|
|
|
echo "<option value=\"".$k."\" ".($_SESSION['AUTH']['province'] == $k ? 'selected' : '').">". |
|
|
|
$p."</option>"; |
|
|
|
} |
|
|
|
?> |
|
|
|
</select> |
|
|
|
<?php |
|
|
|
} |
|
|
|
?> |
|
|
|
</div> |
|
|
|
<div class="col-12 col-md-6 pr-2 pr-md-4"> |
|
|
|
<div class="col-12 col-md-6 pr-2 pr-md-4 <?= isset($_SESSION['AUTH']) ? 'd-none' : '';?>"> |
|
|
|
<span class="label">Scegli una password *</span> |
|
|
|
<input type="password" name="password" class="input input-text" required> |
|
|
|
<input type="password" name="password" class="input input-text" |
|
|
|
<?= !isset($_SESSION['AUTH']) ? 'required' : '';?>> |
|
|
|
<span class="font-10">deve essere di almeno 8 caratteri contenere almeno un numero, un carattere maiuscolo, uno minuscolo</span> |
|
|
|
</div> |
|
|
|
<div class="col-12 col-md-6 pr-2 pr-md-4"> |
|
|
|
<div class="col-12 col-md-6 pr-2 pr-md-4 <?= isset($_SESSION['AUTH']) ? 'd-none' : '';?>"> |
|
|
|
<span class="label">Conferma password *</span> |
|
|
|
<input type="password" name="password_confirm" class="input input-text" required> |
|
|
|
<input type="password" name="password_confirm" class="input input-text" |
|
|
|
<?= !isset($_SESSION['AUTH']) ? 'required' : '';?>> |
|
|
|
</div> |
|
|
|
<div class="col-12 col-md-6 pr-2 pr-md-4"> |
|
|
|
<span class="label">Vuoi spedire ad un indirizzo diverso?</span> |
|
|
|