Error 403 - Forbidden

username: joske
password: tralala

authenticate.php is missing

When I check it is there alright.
This website has been running on the server for several months and has been working fine. (see zhv21.epizy.com). After I made several improvements it stopped working and I don’t know why…

Try re-uploading the authenticate.php file back? Hope you have a backup!

It should work now.
You were previously using \Includes\authenticate.php

2 Likes

tried to put back my backup but the same error came back

In the meantime I have made some improvements to the logonscript (see below) but I keep getting the same error.

    <?php
if (isset($_POST['submit'])){
	require 'dbconn.php';

	$username = $_POST['username'];
	$password = $_POST['password'];

	if (empty($username) || empty($password)){
		header("Location: ..index.php?error=emptyfields");
		exit();
	} else {
		$sql = "SELECT * FROM users WHERE username = ?";
		$stmt = mysqli_stmt_init($con);
		if (!mysqli_stmt_prepare($stmt, $sql)){
				header("Location: ../index.php?error=sqlerror");
				exit();
		}else {
			mysqli_stmt_bind_param($stmt, "s", $username);
			mysqli_stmt_execute($stmt);
			$result = mysqli_stmt_get_result($stmt);

			if($row = mysqli_fetch_assoc($result)){
				$passCheck = password_verify($password, $row['password']);
				if($passCheck == false){
					header("Location: ../index.php?error=wrongpass");
					exit();
				} elseif ($passCheck == true) {
					session_start();
					$_SESSION['id'] = $row['id'];
					$_SESSION['username'] = $row['username'];
					header("Location: ../teampagina.php?succes=loggedin");
					exit();

				} else{
				header("Location: ../index.php?error=wrongpass");
				exit();
			}
			}else {
				header("Location: ../index.php?error=nosuser");
				exit();
			}
		}
	}
} else {
	header("Location: ../index.php?error=accessforbidden");
}
?>

A few things with your code.

  1. dbconn.php does not exist.

  2. PHP require statements must be at the beginning on the file.

Also, a 404 error is shown on the file “/Includes/authenticate.php“, so make sure you have it uploaded in the correct spot.

3 Likes

Thank you for your reply, I moved up the require statements and checked the location of files dbconn.php and authenticate.php wich is in the Includes folder.
However I still get the same error message. Any help is more then welcome. I would like to emphasise this code works fine on my local server, I have following php configuration:

Can you show proof that you uploaded those files, because they are still not on the server.

3 Likes

Take note your local server is using PHP 8.1.1
IF is using 7.4 (if I am not wrong)

No they are not

3 Likes

What am I missing here??? All the files are where they are supposed to be

Are you sure you have the correct htdocs folder? Please screenshot the entire homepage of the client area, and make sure the “Account Info” and “Account Domains” sections are viewable in the screenshot.

Thanks

1 Like

serverview is on the right

Root cause likely found

Rename “Includes” directory to other name

2 Likes

Something weird is going on, because I cannot even open the “test” “camel” or “contactform” folder.

@KangJL may have the correct answer for the includes folder, but something odd seams to be going on for the rest of your site.

1 Like

I agree. Localhost is using Windows Server, IF is linux server. PHP also different between IF and localhost. Compatibility issue perhaps?

1 Like

problem solved, renamed the Includes folder and everything works!
Thks!

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.