30 lines
1.0 KiB
PHP
30 lines
1.0 KiB
PHP
<?php
|
|
require 'connect.inc.php';
|
|
require_once 'core.inc.php';
|
|
|
|
if (isset($_POST['email']) && isset($_POST['password'])) {
|
|
$email = $_POST['email'];
|
|
$password = $_POST['password'];
|
|
$password_hash = md5($password);
|
|
|
|
if (!empty($email) && !empty($password)) {
|
|
$query = "SELECT `id` FROM `globaly_accounts` WHERE `email` ='" . mysqli_real_escape_string($con, $email) .
|
|
"' AND `password` = '" .mysqli_real_escape_string($con, $password_hash )."'";
|
|
if ($query_run = mysqli_query($con, $query)) {
|
|
$query_num_rows = mysqli_num_rows($query_run);
|
|
if ($query_num_rows == 0) {
|
|
echo 'invalid email/password combination';
|
|
} else if ($query_num_rows == 1) {
|
|
$row = mysqli_fetch_assoc($query_run);
|
|
$user_id = $row['id'];
|
|
|
|
$_SESSION['user_id'] = $user_id;
|
|
header('Location: index_loged.php');
|
|
}
|
|
} else {
|
|
}
|
|
} else {
|
|
echo 'You must suply email or password';
|
|
}
|
|
}
|
|
?>
|