<?php
session_start();
$file_name="login.php";
require_once "root_url.php";
require_once "php/user_Json.php";
require_once "php/baratok_Json.php";
require_once "php/user_class.php";
if(isset($_POST['sub'])){
$hibak;
if(isset($_POST['email']) && !empty($_POST['email'])){
$emai=$_POST['email'];
if(isset($_POST['paswd']) && !empty($_POST['paswd'])){
$pass=$_POST['paswd'];
$userj=user_emial_keres($_POST['email'],$GLOBALS['user_json']);
if(isset($userj) && !empty($userj)){
$reg_date=($userj->reg_date);
if(pass_ell_login($userj->jelszo,$_POST['paswd'],$reg_date)){
$user=new User($userj->nev,$userj->email,$userj->jelszo,$userj->id,$userj->reg_date,$userj->szul_date,$userj->nem,$userj->pkep_id,$userj->zene_id,$userj->rang_admin);
$hibak=$user->hibak();
if(empty($hibak)){
$_SESSION['user']=$user;
header('Location: index.php') ;
}
}else{
$hibak['pass']="Rossz jelszó!";
}
}else{
$hibak['email']="Ez az email nincs regisztrálva!";
}
}else{
$hibak['pass']="Nem adtad meg a jelszót!";
}
}else{
$hibak['email']="Nem adtad meg az emailt!";
}
}
?>
<!DOCTYPE HTML >
<html lang="hu">
<head>
<meta charset="utf-8">
<title>login</title>
<link href="css/CSS0.css" rel="stylesheet" type="text/css">
<link href="css/CSS1index.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" sizes="256x256" href="php/php/kep.php?id=0" >
<link href="css/center.css" rel="stylesheet" type="text/css">
</head>
<body >
<div id="sejtbody" style="position:fixed"></div>
<div id="body_tart">
<section id="zaszlo">
<h1>
<span>J</span>
<span>á</span>
<span>t</span>
<span>é</span>
<span>k</span>
<span> </span>
<span>G</span>
<span>é</span>
<span>p</span>
</h1>
</section>
<div class="center"><fieldset id="be" class="center"><legend id="cim"><h1 ><b>Bejelentkezés</b></h1> </legend>
<form action="login.php" method="post"><table>
<tr><td>Email cím:</td><td><input type="email" name="email" <?php if(isset($emai) && !empty($emai)){ echo"value='".$emai."'"; } ?> ></td> <?php if(isset($hibak['email']) && !empty($hibak['email'])){ echo"<td style='color:red;'>".$hibak['email']."</td>"; } ?> </tr>
<tr><td>Jelszó:</td><td><input type="password" name="paswd" <?php if(isset($pass) && !empty($pass)){ echo"value='".$pass."'"; } ?>> </td> <?php if(isset($hibak['pass']) && !empty($hibak['pass'])){ echo"<td style='color:red;'>".$hibak['pass']."</td>"; } ?> </tr>
</table>
<input type="submit" value="Bejelenkezés!" onclick="belep()" name='sub'>
</form>
<p id="sz">Nincs még profilod? <a href="reg.php">Regisztrálj</a></p>
</fieldset>
</div>
</div>
</body>
</html>