I have a problem with including a php file
PagePrevie.php :
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="Style/css/bootstrap.min.css" />
<script src="Style/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="Style/css/Header-Picture.css">
<link rel="stylesheet" href="Style/css/Footer-with-logo.css">
<title></title>
</head>
<body class="container lg-warning">
<?php
include 'include/LogoUMBB.php';
include 'include/Header.php';
?>
<div class="container bg-success text-primary" style="width:500px;padding: 20px;">
</div>
<br />
<?php
include 'include/Footer.php';
?>
</body>
</html>
The problem is that this file is located in a directory that contains other web page with the same code
And here is the structure of files:
PHP told you your path is incorrect, add "../" so you get correct include path.
include '../include/LogoUMBB.php';
include '../include/Header.php';
include '../include/Footer.php';
Related
I'm a student making a simple file upload page with PHP.
But it doesn't work when I upload the actual file on the form and submit it.
I need some help to find what is gone wrong.
uploadProfilePicture.php (I used some bootstrap components)
<?php
session_start();
header('Content-Type: text/html; charset=utf-8');
?>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Change profile picutre</title>
<link rel="stylesheet" href="../../../css/font.css">
<link rel="shortcut icon" href="../../../favicon/favicon.ico">
<link rel="stylesheet" href="./css/uploadProfilePicture.css">
</head>
<?php include('../../../common/resource.html'); ?>
<body>
<div id="content">
<h3 id="title">Change Profile Picutre</h3>
<form id="profileImageUploadForm" method="POST" action="processProfileImage.php" enctype="multipart/form-data">
<label for="formFile" class="form-label">Upload your image!</label>
<input type="file" class="form-control" id="formFile">
<input class="button-30" role="button" type="submit"></input>
</form>
</div>
</body>
</html>
processProfileImage.php
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Change profile picutre</title>
<link rel="stylesheet" href="../../../css/font.css">
<link rel="shortcut icon" href="../../../favicon/favicon.ico">
<link rel="stylesheet" href="./css/uploadProfilePicture.css">
</head>
<body>
</body>
</html>
<?php
session_start();
header('Content-Type: text/html; charset=utf-8');
var_dump($_FILES);
var_dump($_POST)
?>
When I tried to check $_FILES and $_POST, only void arrays returned and I couldn't find what was wrong. I think there's been a mistake in a small part, but I haven't dealt with PHP a lot, so I don't have a good sense of it.
If you have identified the problem with this code, please let me know. Thanks.
In my localhost the program runs well, but when I deploy it to heroku it doesn't show anything Like this and this is my folder This. Here my index code:
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="ina">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Lovanto Blog</title>
<link href="css/bootstrap-4.0.0.css" rel="stylesheet">
<link href="css/styles.css" rel="stylesheet">
<link href="css/modal.css" rel="stylesheet">
<script src="js/jquery.min.js"></script>
<link rel="icon" href="icon.ico" type="image/x-icon" />
</head>
<body>
<?php
require 'vendor/autoload.php';
require 'cloudinary/vendor/autoload.php';
require 'cloudinary/config.php';
include 'conn.php';
include 'code/clock.php';
include 'view/header.php';
include 'view/body.php';
include 'view/footer.php';
?>
</body>
</html>
And this is my Procfile
web: vendor/bin/heroku-php-apache2
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 4 years ago.
This form is my home page. After I log in I cant proceed to the home page
because of this error.
Parse error: syntax error, unexpected end of file in
C:\xampp\htdocs\kusina_online\home.php on line 28
<?php
include('session.php');
if(!isset($_SESSION['login_user'])) {
header("location: index.php");
?>
<DOCTYPE! html>
<html lang="en">
<head>
<title>Kusina Online</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial- scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="bootstrap/js/jquery-slim.min.js"></script>
<script type="text/javascript" src="bootstrap/js/popper.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
</head>
<body>
<br /><br />
<div class="container" style="width:500px;">
<h3 align="center">Kusina Online</h3>
<br />
<b id="welcome">Howdy, <i><?php echo $login_session; ?></i></b>
<div class="desc"><b id="logout">Log Out</b></div>
</div>
</body>
</html>
PHP is returning this error because you haven't properly ended your if statement. If you did your code would look like the following:
if(!isset($_SESSION['login_user'])) {
header("location: index.php");
}
Or if you only need to run one line of code you can format it like below
if(!isset($_SESSION['login_user']))
header("location: index.php");
you can refer it here.
<?php
include('session.php');
if(!isset($_SESSION['login_user'])) {
header("location: index.php");
} // you not closing this statement.
?>
<DOCTYPE! html>
<html lang="en">
<head>
<title>Kusina Online</title>
<meta charset="utf-8"> <!--- maybe a typo why would `/` be here.--->
<meta name="viewport" content="width=device-width, initial- scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="bootstrap/js/jquery-slim.min.js"></script>
<script type="text/javascript" src="bootstrap/js/popper.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
</head>
<body>
<br /><br />
<div class="container" style="width:500px;">
<h3 align="center">Kusina Online</h3>
<br />
<b id="welcome">Howdy, <i><?php echo $login_session; ?></i></b>
<div class="desc"><b id="logout">Log Out</b></div>
</div>
</body>
make sure to check every single line
you should put a closing bracket in line 6.
<?php
include('session.php');
if(!isset($_SESSION['login_user'])) {
header("location: index.php");
}
?>
You forgot closing the bracket in line 6 ...
<?php
include('session.php');
if(!isset($_SESSION['login_user'])) {
header("location: index.php");
?>
<DOCTYPE! html>
<html lang="en">
<head>
<title>Kusina Online</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial- scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="bootstrap/js/jquery-slim.min.js"></script>
<script type="text/javascript" src="bootstrap/js/popper.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
</head>
<body>
<br /><br />
<div class="container" style="width:500px;">
<h3 align="center">Kusina Online</h3>
<br />
<b id="welcome">Howdy, <i><?php echo $login_session; ?></i></b>
<div class="desc"><b id="logout">Log Out</b></div>
</div>
</body>
</html>
When I use pgp require it moves the head content on the included file into the body tags, I've explored questions somewhat related to my problem but none have solved my problem.
index.php:
<!DOCTYPE html>
<html>
<head></head>
<body></body>
</html>
<?php
require '/home/sethfreeman/public_html/subdomains/gwd/navigation/header/header.html';
?>
Included File:
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://sethjfreeman.com/subdomains/gwd/assets/css/header.css" type="text/css">
<link rel="stylesheet" href="http://sethjfreeman.com/subdomains/gwd/assets/libs/bootstrap/css/bootstrap.css" media="screen">
<link rel="stylesheet" href="http://sethjfreeman.com/subdomains/gwd/assets/libs/bootstrap/css/bootstrap-responsive.css" media="screen">
</head>
<body>
<div class="container"></div>
<script src="http://sethjfreeman.com/subdomains/gwd/assets/js/jquery-3.1.1.js"></script>
<script src="http://sethjfreeman.com/subdomains/gwd/assets/libs/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
Chrome Output:
<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://sethjfreeman.com/subdomains/gwd/assets/css/header.css" type="text/css">
<link rel="stylesheet" href="http://sethjfreeman.com/subdomains/gwd/assets/libs/bootstrap/css/bootstrap.css" media="screen">
<link rel="stylesheet" href="http://sethjfreeman.com/subdomains/gwd/assets/libs/bootstrap/css/bootstrap-responsive.css" media="screen">
<div class="container"></div>
<script src="http://sethjfreeman.com/subdomains/gwd/assets/js/jquery-3.1.1.js"></script>
<script src="http://sethjfreeman.com/subdomains/gwd/assets/libs/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
"Require isn't smart. It's simply going to dump the contents of the required file where it's invoked. If you want some code in the head portion, put that in a separate file and require it in the correct place." - Major Productions LLC
To close this question.
I'm learning PHP / HTML / CSS. Today I want use Bootsrap.
I use a basic HTML5 template called index.php In this file I want include a footer like this:
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="ressources/bootstrap/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="ressources/css/style.css">
<script type='text/javascript' src="ressources/script/jquery.js"></script>
<script type='text/javascript' src="ressources/bootstrap/js/bootstrap.js"></script>
<title>Index</title>
</head>
<body>
<div id="wrap">
<p>test</p>
</div>
<?php include('includes/footer.php'); ?>
</body>
</html>
But I dont see my footer in my page. I just put an "Hello World" in my footer.php