-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify.php
More file actions
28 lines (23 loc) · 797 Bytes
/
verify.php
File metadata and controls
28 lines (23 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
session_start();
include("dbconnect.php");
function verify_pass($user, $pass){
$user_id = mysql_query("SELECT id FROM user WHERE user_name = '$user' and password='$pass';")
or die(mysql_error());
while ($row = mysql_fetch_assoc($user_id)) {
$_SESSION['logged'] = $row['id'];
return true;
}
return false;
};
if (verify_pass($_POST['user'], $_POST['pass'])) { // if user/pass correct
if (isset($_SESSION['tosave'])) { // if user got here by attempting to save a recipe
include("savemeal.php");
} else { // else
header("Location: index.php"); // after user verification, redirect back
}
} else { // if user/pass incorrect
$_SESSION["msg"] = "Username and password do not match";
header("Location: login.php");
}
?>