У меня такой вопрос я создал форму для регистрации и потом чтобы войти. Так вот для регистрации надо вводить почту пароль телефон и Фамилию. Вот код:
<?php
include_once('dbcon.php');
$error = false;
if(isset($_POST['buttonreg'])){
$name = $_POST['name'];
$name = strip_tags($name);
$name = htmlspecialchars($name);
$tel = $_POST['tel'];
$tel = strip_tags($tel);
$tel = htmlspecialchars($tel);
$email = $_POST['email'];
$email = strip_tags($email);
$email = htmlspecialchars($email);
$password = $_POST['password'];
$password = strip_tags($password);
$password = htmlspecialchars($password);
//encrypt password with md5
$password = md5($password);
//insert data if no error
if(!$error){
$sql = "insert into users(name,tel, email ,password)
values('$name','$tel', '$email', '$password')";
if(mysqli_query($conn, $sql)){
header('location: index.php');
}else{
echo 'Error '.mysqli_error($conn);
}
}
}
?>
А войти можно с помощью почты и пароля:
<?php
session_start();
include_once('dbcon.php');
$error = false;
if(isset($_POST['buttonlogin'])){
$email = trim($_POST['email']);
$email = htmlspecialchars(strip_tags($email));
$password = trim($_POST['password']);
$password = htmlspecialchars(strip_tags($password));
if(!$error){
$password = md5($password);
$sql = "select * from users where email='$email' ";
$result = mysqli_query($conn, $sql);
$count = mysqli_num_rows($result);
$row = mysqli_fetch_assoc($result);
if($count==1 && $row['password'] == $password){
$_SESSION['email'] = $row['email'];
header('location: home.php');
}else{
$errorMsg = '<center><p>Doğru olmayan email/şifrə daxil etmisiniz</p></center>';
}
}
}
?>
Я хочу чтобы после того как зашел кто то там отображалась Имя Фамилия там телефон например т.д помогите мне буду блогадарен!
home.php
находится?