SHOW:
|
|
- or go back to the newest paste.
1 | if(isset($_POST['username'])) { | |
2 | - | if(strlen($_POST['username']) >= 3 && strlen($_POST['password']) >= 6) { |
2 | + | if(strlen($_POST['username']) >= 3 && strlen($_POST['password']) >= 6) { |
3 | - | $logged_user = $user_api->login($_POST['username'], $_POST['password']); |
3 | + | $logged_user = $user_api->login($_POST['username'], $_POST['password']); |
4 | - | echo "<h1>IT WORKED! Welcome back to Clementeene {$_POST['username']}</h1> <a href='index.php'>Go play!</a>"; |
4 | + | echo "<h1>IT WORKED! Welcome back to Clementeene {$_POST['username']}</h1> <a href='index.php'>Go play!</a>"; |
5 | echo "<a href='usercp.php'>Go to control panel</a>"; | |
6 | - | echo "<a href='usercp.php'>Go to control panel</a>"; |
6 | + | |
7 | $_SESSION["logged_in"] = true; | |
8 | - | $_SESSION["logged_in"] = true; |
8 | + | $_SESSION["username"] = $logged_user['username']; |
9 | - | $_SESSION["username"] = $logged_user['username']; |
9 | + | $_SESSION["user_id"] = $logged_user['id']; |
10 | - | $_SESSION["user_id"] = $logged_user['id']; |
10 | + | |
11 | - | |
11 | + | else if($logged_user == false) { |
12 | - | if($logged_user == false) { |
12 | + | echo "Wrong username or password."; |
13 | - | echo "Wrong username or password. Or username or password length wrong"; |
13 | + | |
14 | } | |
15 | ||
16 | ||
17 | else { | |
18 | echo "Wrong username or password."; | |
19 | - | echo "Username and/or password too short."; |
19 | + | |
20 | } |