I’m having trouble finding the lines in the post box in this forum in order to highlight the lines. Therefore, I do not have any other options but to just list below the lines where the errors occur:
I am getting these absurd errors on reg.php:
Notice: Undefined variable: site in C:\xampp\htdocs…\register.php on line 24
Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs…\register.php on line 78
Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs…\register.php on line 79
Warning: mysqli_stmt_insert_id() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs…\register.php on line 82
And these errors on the login.php:
Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs…\login.php on line 18
Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs…\login.php on line 19
Warning: mysqli_stmt_get_result() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs…\login.php on line 20
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:\xampp\htdocs…\login.php on line 22
reg.php:
Line 78:
mysqli_stmt_bind_param($stmt, 'sssssssi', $username, $hashed_pass, $email2, $forename, $surname, $gender, $member_registration_random_numbers, $activation);
Line 79:
mysqli_stmt_execute($stmt);
Here’s the full context of line 78 & 79:
// insert query
$stmt = mysqli_prepare($conn, "INSERT INTO users(usernames, passwords, emails, forenames, surnames, genders, account_activation_codes, account_activations) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
mysqli_stmt_bind_param($stmt, 'sssssssi', $username, $hashed_pass, $email2, $forename, $surname, $gender, $member_registration_random_numbers, $activation);
mysqli_stmt_execute($stmt);
Line 82:
if (mysqli_stmt_insert_id($stmt)) {
Here’s the context of line 82:
// check if query is inserted
if (mysqli_stmt_insert_id($stmt)) {
echo "<h3 style='text-align:center'>Thank you for your registration.<br /> Redirecting to login page ...</h3>";
login.php
Line 18:
mysqli_stmt_bind_param($stmt, 'ss', $username, $email);
Line 19:
mysqli_stmt_execute($stmt);
Line 20:
$result = mysqli_stmt_get_result($stmt);
Line 22:
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
Here’s the context from Lines 18-22.
$stmt = mysqli_prepare($conn, "SELECT usernames, passwords, emails, account_activation_codes, account_activations FROM users WHERE usernames = ? OR emails = ?");
mysqli_stmt_bind_param($stmt, 'ss', $username, $email);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
Here’s Lines 10-22:
if (isset($_POST["submit"]))
{
if (isset($_POST["username_or_email"]) && isset($_POST["password"])) {
$username = $_POST["username_or_email"];
$email = $_POST["username_or_email"];
$password = $_POST["password"];
$stmt = mysqli_prepare($conn, "SELECT usernames, passwords, emails, account_activation_codes, account_activations FROM users WHERE usernames = ? OR emails = ?");
mysqli_stmt_bind_param($stmt, 'ss', $username, $email);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
You know the silly errors keep complaining that parameter 1 should not be boolean but if you look carefully the parameter does not contain any boolean atall! Is this a bug in php 7 ?