Parašė Erdfcvxl· 2013 Sau. 11 22:01:00
#6
Kodas daug kartu reduoguotas ir t.t. tuo labiau savamokslis tai ir palieku tokias nesamones :) Kabinekis, tik i nauda iseis :)
Del to header tai pasiskaiciau kad cia del whitespacing gali but, kad palieku tarpelius, bet perziurejau visa koda atydziai ir ka radau pataisiau, bet erroras nedingsta :/ Nzn kaip cia prasisukti. Elementarus loginas neveikia...
Visa koda numesiu dar:
<?php
session_start();
include("mysql.php");
$psl = (isset($_GET['psl']) ? $_GET['psl'] : "");
if (isset($login) && $psl == "login") {
unset($_SESSION['er']);
if($_POST['username'] == "") {$_SESSION['er'] = "Please enter Customer's ID";}
elseif ($_POST['passwort'] == "") {$_SESSION['er'] = "Please enter Password";}
else { $row = mysql_fetch_assoc(mysql_query("Select * from users WHERE u_id='".$_POST['username']."'"));
if($_POST['username'] == $row['u_id'] && $_POST['passwort'] == $row['u_pass']) {$_SESSION['user'] = $row['id'];}
else{$_SESSION['er'] = "Customer ID or Password is wrong";}
}
if (isset($_SESSION['user'])) {
header("Location: /customer.php");
} else {
header("Location: index.php");
}
}
}
unset($_SESSION['user']);
include("header.php");
if($psl == "" && !isset($_SESSION['user'])){ ?>
<form method="POST" action="index.php?psl=login">
<div class="forma">
<div class="customer_name">
Customer's ID: <br> <br> <br>
Password:
</div>
<div class="password">
<input type="text" name="username" size="15">
<input type="password" name="passwort" size="15" style="margin-top:5px;"/>
</div>
<center>
<input type="submit" value="Login" name='login' /></p>
<?php if(isset($_SESSION['er'])) {echo $_SESSION['er'];} ?>
<center>
</div>
</form>
<?php
}
include("footer.php");
?>
Redagavo Erdfcvxl· 2013 Sau. 11 22:01:37