Signup is not working properly.
Open
LilPhyziX
opened this issue 2 years ago
•
8 comments
Hello. When i try to register, i am greeted with this message: Field 'id' doesn't have a default value 1364
I dont know what this means but all i know is its preventing the details to go into the database.
Any help would be greatly appreciated.
Thanks in advance!
It looks like you don't have AUTO_INCREMENT set on your id column in the database - this assigns IDs automatically when you insert a new record.
I do have auto increment on though. However i dont see anything in the code that inserts anything into the id
Then you don't need to include the id in the list of fields in the insert statement, or in the list of values. New records will be assigned a new value automatically.
Alright. I fixed the signup, however the login is not working now.
Here is the code for the signin page:
real_escape_string($_POST["email"]));
$result = $mysqli->query($sql);
$user = $result->fetch_assoc();
if ($user) {
if (password_verify($_POST["password"], $user["password_hash"])) {
session_start();
session_regenerate_id();
$_SESSION["user_id"] = $user["id"];
header("Location: index.php");
exit;
}
}
$is_invalid = true;
}
?>
Sign In
CherryBerry Studios
<li class="nav-item">
<a class="nav-link" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="about.html">About Us</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" aria-expanded="false">
Story
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="mission.html">Mission</a></li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="vision.html">Vision</a></li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="objective.html">Objective</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="community.html">Community</a>
</li>
<li class="nav-item">
<a class="nav-link" href="support.html">Support</a>
</li>
</ul>
<form class="d-flex ms-lg-5">
<a href="signup.html" class="btn btn-menu">Sign Up</a>
</form>
</div>
</div>
</nav>
</div>
</div>
</div>
Sign In To Your Account
Let's get started with your account
<div class="card reg-form pt-3 pb-3">
<div class="card-body">
<em>Invalid login</em>
<?php endif; ?>
<form method="post">
<p class="mb-2 pt-1 label-fr">Username</p>
<div class="input-group mb-3 input-group-custom">
<span class="input-group-text input-group-custom-field">
<i class="far fa-user"></i>
</span>
<input type="text" class="form-control input-group-custom-field" placeholder="Username" name="email" id="email" value="<?= htmlspecialchars($_POST["email"] ?? "") ?>">
</div>
<p class="mb-2 pt-1 label-fr">Password</p>
<div class="input-group mb-3 input-group-custom">
<span class="input-group-text input-group-custom-field">
<i class="fa fa-lock"></i>
</span>
<input type="password" class="form-control input-group-custom-field" placeholder="XXXXXXX" name="password" id="password">
</div>
<div class="form-group pt-1">
<label>
<input type="checkbox" required>
<span class="rem"> Remember Me </span>
</label>
</div>
<div class="form-group text-center mb-4 mt-3">
<button type="button" class="btn btn1 ps-4 pe-4 pt-2 pb-2"> SIGN IN </button>
</div>
<div class="d-lg-flex justify-content-between links text-center f15">
<p class="mb-md-0 mb-1">
Don't have an account? <a href="signup.html" class="gray text-links">Sign Up</a>
</p>
<p class="mb-md-0 mb-1">
Forgot Password? <a href="forgot-password.html" class="gray text-links">Reset it</a>
</p>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
Uhm. I dont think it was supposed to display the actual elements
I will just upload the file. #
signin.php.txt
Please can you describe exactly what the problem is? Do you get any error messages?