Home>
Isn't you jumping to index2.php, which is set after pressing the login button, but you just go back to this page again? Do you know what the cause is?
Membership registration and the contents are saved in the DB. If the address and password entered on the login page match the contents of the DB, it will be transferred to the page after pressing the login button.
I ’m following the textbook,
I do not know what is wrong, thank you.
<? php
session_start ();
require ("dbconnect.php");
# If ($_ COOKIE ["name"]! == "") {
# $name = $_ COOKIE ["name"];
#}
if (! empty ($_ POST)) {
if ($_ POST ["email"]! == ""&&$_POST ["password"]! == "") {
$login = $db->prepare ("select * from members where email =?
and password =? ");
$login->execute (array (
$_POST ["email"],
sha1 ($_ POST ["password"])
));
$member = $login->fetch ();
if ($member) {
$_SESSION ["id"] = $member ["id"];
$_SESSION ["time"] = time ();
#if ($_ POST ["save"] === "on") {
# setcookie ("name", $_ POST ["name"], time () + 60 * 60 * 24 * 14);
#}
header ("Location: index2.php");
exit ();
} else {
$error ["login"] = "failed";
}
} else {
$error ["login"] = "blank";
}
}
?>
Supplemental information (FW/tool version etc.)
Please provide more detailed information here.
-
Answer # 1
-
Answer # 2
In index2.php, check if $_SESSION ['id'] is set using echo etc.
Maybe there is no session set up and you are redirected from index2.php
Related articles
- php - send button display after entering required items
- php: i want to display the database information after inserting the data entered from the form
- user information cannot be edited with the login function being created in php
- php - i want to set the transition destination after posting a comment of wordpress for each comment source page
- php - please tell me about the transfer cost of the framework
- page transition after editing from php product correction page does not work
- php - suppressing database access after self-authentication using laravel
- ruby on rails - i want the login button to look like the sign-up button in the image
- php - about button reference in jquery
- about syntax error after php version upgrade
- php - i created a login screen but i don't understand why it isn't working
- php - about automatic login to vba scraping sakura rental server control
- php - i created an admin login in laravel, but i can not log in and no error occurs, so it is swamping
- i want to send a request to an app with a login screen using phpstorm's http client
- php - i want to open the edit screen (linked to the id of the wording) with the "edit" button on the top page
- i can't log in to wordpress with a php error after importing with all in one migration
- php - phenomenon that is not displayed even after uploading an image
- linux - command restrictions after sftp login
- php - error when implementing line login function by socialite
- memcached doesn't work after php version upgrade
Trends
Check which branch you are going through and see if each variable has the expected information.
Example: