Error: X-Content-Type-Options: nosniff , MIME („text/html”) after using hosting - hosting

Today for a first time I used hosting on infinityfree. All website works fine, but two elements from bootstrap (dropdown-menu). The error is due to MIME type ("text/html") mismatch X-Content-Type-Options: nosniff.
Can I do anything with it? I'm begginer and feeling a little lost. From what I have read I should add header in htaccess file, but on infinityfree this file is read only. Is there anything I can do or is it clearly server setting and I can't work around it?
<nav class="navbar navbar-dark navbar-expand-lg">
<a class="navbar-brand" href="index.php">Nova Art</a>
<button class="navbar-toggler " type="button" data-toggle="collapse" data-target="#menu" aria-controls="menu"
aria-expanded="false" aria-label="Navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="menu">
<ul class="navbar-nav mr-auto">
<li class="nav-item active"><a class="nav-link" href="index.php">Main Page</a></li>
<li class="nav-item dropdown"><a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button"
aria-expanded="false" id="submenu" aria-haspopup="true" href="#">Categories</a>
<div class="dropdown-menu" aria-labbeledby="submenu">
<form class="dropdown-item" method="POST" action="category.php">
<input class="category" type="submit" name="category" value="Photography" />
</form>
<form class="dropdown-item" method="POST" action="category.php">
<input class="category" type="submit" name="category" value="Digital" />
</form>
<form class="dropdown-item" method="POST" action="category.php">
<input class="category" type="submit" name="category" value="Drawings" />
</form>
<form class="dropdown-item" method="POST" action="category.php">
<input class="category" type="submit" name="category" value="Paintings" />
</form>
</div>
</li>
<li class="nav-item"><a class="nav-link" href="profile.php">My profile</a></li>
<?php
if(isset($_SESSION['logged']) && ($_SESSION['logged']==true)){
echo '<li class="nav-item" ><a href="loggout.php" class="nav-link " >Logout</a></li>';
}
else echo '<li class="nav-item" ><a class="nav-link " href="logWindow.php">Login</a></li>';
?>
</ul>
<form action="search.php" method="POST" class="form-inline">
<input type="text" class="form-control mr-1 mt-3 logWin" placeholder="Find user" name="search" />
</form>
</div>
</nav>
Thanks for all the help!

Related

In Laravel how can I make a side bar when pressed goes to the page content link but still is the current page

I want to have the same mechanism like this https://www.w3schools.com/html/default.asp but in laravel application
This is my code on routes/web.php
Route::get('tutorial', function(){
$tutorial = Tutorial::get();
return view('tutorial.index')->with('tutorial', $tutorial);
})->name('index-tutorial');
// Show one Tutorial by Id
Route::get('tutorial/{id}', function($id){
$tutorial = Tutorial::findOrFail($id);
return view('tutorial.show')->with('tutorial', $tutorial);
})->name('show-tutorial');
for my Blade template
tutorial/show.blade.php
<div class="container">
#foreach($tutorial as $tutorial)
<h1>{{$tutorial->title}}</h1>
<p>{{$tutorial->title_description}}</p>
<p>{{$tutorial->title_lesson}}</p>
<div class="btn-group btn-group-lg d-flex justify-content-end mb-3" role="group">
<form class="mx-3" action="{{route('delete-tutorial', $tutorial->id)}}" method="POST">
#csrf
#method('DELETE')
<button class="btn btn-danger" name="Delete">Delete</button>
</form>
<form action="{{route('edit-tutorial', $tutorial->id)}}" method="GET">
#csrf
<button class="btn btn-primary" name="Edit">Edit</button>
</form>
#endforeach
</div>
tutorial/index.blade.php
<main class="d-flex flex-nowrap">
<div class="d-flex flex-column flex-shrink-0 p-3 text-bg-dark"
style="width: 280px;">
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-
auto text-white text-decoration- none">
<svg class="bi pe-none me-2" width="40" height="32"><use
xlink:href="#bootstrap"></use></svg>
<span class="fs-4 text-white">MySql Lessons</span>
</a>
<hr>
<ul class="nav nav-pills flex-column mb-auto">
#forelse($tutorial as $link)
<li class="nav-item">
<a href="{{route('show-tutorial', $link->id)}}" class="nav-
link">
<p class="text-white bg-dark">{{$link->title}}</p>
</a>
</li>
#empty
<p class="text-white bg-dark">No available lesson</p>
#endforelse
</ul>
</div>
I been researching a lot about having this mechanism
This one is different from other questions because i don't use controllers for this
Have you tried using example tamplates from Bootstrap?
Check here https://getbootstrap.com/docs/5.3/examples/
it's quite easy actually, you just need to copy the html code from bootstrap tamplate and tweak here and there. use
#include to add your desired components, #yield for your desired content page. and use #extends and #section inside your content pages.
roughly like this.
your main blade view
<!doctype html>
<html lang="en">
<head>
</head>
<body>
#include('partials.adminNav')
<div class="row">
#include('partials.adminSideBar')
</div>
<div class="container">
#yield('container')
</div>
</body>
#include('partials.footer')
</html>
for your side bar you just need to put links for your desired page
<nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
<div class="position-sticky pt-3 sidebar-sticky">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link" aria-current="page" href="#">
<span data-feather="home" class="align-text-bottom"></span>
//Home
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="//your links/route for page content">
<span data-feather="file" class="align-text-bottom"></span>
//links name
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="//your links/route for page content">
<span data-feather="edit" class="align-text-bottom"></span>
//Links name
</a>
</li>
</ul>
</div>
</nav>
in like this in your content pages
#extends('layouts.adminMain')
#section('container')
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
<div class="py-4">
// your content here
</div>
</main>
#endsection
make use of the #include and #yield build in function. this way you'll have a consistent navbar/sidebar but can changes the content within.
Hope this works for you :)
Instead of using route closures, I manage to convert them to a TutorialController
Route::resource('tutorial', TutorialController::class);
for the aside bar routes/web
view()->composer('layout.sidebar', function($view){
$tutorial = Tutorial::all();
$view->with('links', $tutorial);
});
layout/sidebar.blade.php
<main class="d-flex flex-nowrap">
<div class="d-flex flex-column flex-shrink-0 p-3 text-bg-dark"
style="width: 280px;">
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto
text-white text-decoration-none">
<svg class="bi pe-none me-2" width="40" height="32"><use
xlink:href="#bootstrap"></use></svg>
<span class="fs-4 text-white">MySql Lessons</span>
</a>
<hr>
<ul class="nav nav-pills flex-column mb-auto">
#forelse($links as $link)
<li class="nav-item">
<a href="{{ route('tutorial.show', $link->id)}}" class="nav-link">
<p class="text-white bg-dark">{{$link->title}}</p>
</a>
</li>
#empty
<p class="text-white bg-dark">No available lesson</p>
#endforelse
</ul>
</div>
</main>
in my index.blade and show.blade you can add #include('layout.sidebar')
#extends('layout.app')
#section('title', "Show Tutorials")
#section('content')
#include('layout.sidebar')
<div class="container">
<h1>{{$tutorial->title}}</h1>
<p>{{$tutorial->title_description}}</p>
<p>{{$tutorial->title_lesson}}</p>
<div class="btn-group btn-group-lg d-flex justify-content-end mb-3"
role="group">
<form class="mx-3" action="{{route('tutorial.destroy', $tutorial-
>id)}}" method="POST">
#csrf
#method('DELETE')
<button class="btn btn-danger" name="Delete">Delete</button>
</form>
<form action="{{route('tutorial.edit', $tutorial->id)}}" method="GET">
#csrf
<button class="btn btn-primary" name="Edit">Edit</button>
</form>
</div>
#endsection

How to extend views with shared Layout in Laravel?

I have a collection of views that i want them to share a specific layout.
I created the layout master.blade.php ,in a folder i named it layouts.
From the docs , i found that i need to add the tag #extends and section('content') in my view so it fits under the layout :
#extends('layouts.master')
#section('content')
<div style="background-color:white;width:963px;height:100%">
<div style="padding-top:100px;padding-bottom:200px">
<h2 style="color:sandybrown; text-align:center"><b style="padding-right:40px">Contactez nous</b></h2>
<br />
<hr width="50%" color="gris" />
<div class="row">
<div class="col-md-6" style="padding:5%">
<form method="post" asp-controller="Home" asp-action="RegisterContact" style="padding-left:20px">
<label><span style="color:blue">Nom et prenom</span></label>
<br />
<input size=" 40" style="border-color:darkorange" asp-for="Name"/>
<br />
<label><span style="color:blue">E-mail</span></label>
<br />
<input size=" 40" asp-for="Email" style="border-color:darkorange" />
<br />
<label><span style="color:blue">Message</span></label>
<br />
<textarea rows="10" cols="40" style="border-color:darkorange" asp-for="Message"></textarea>
<br />
<button style="background-color:blue;"><span style="color:white">ENVOYER</span></button>
....
#endsection
but when i click in the link in the view's link in the navbar , this is what i get ?:
so is there a missing part in the logic ?
Update:
the view and the layout are both under the same folder :
C:\xampp\htdocs\laravel\resources\views\layouts
the view's name wasn't ending with .blade.php , but doing so now i get an exception :
InvalidArgumentException in FileViewFinder.php line 137: View [layouts.WhoWeAre] not found.
this is the body code of the layout :
</div>
<nav class="navbar navbar-expand-md bg-light navbar-light">
<div class="navbar-collapse collapse w-50">
<ul class="navbar-nav ml-auto">
<li class="nav-item navbar1 ">
<a class="nav-link" href="{{action('HomeController#WhoWeAre')}}"><span style="text-decoration: underline;"><B>Acceuil</B></span></a>
</li>
<li class="nav-item navbar1">
<a class="nav-link" ><span style="text-decoration: underline;"><B>Qui somme nous</B></span></a>
</li>
<li class="nav-item navbar1">
<a class="nav-link"><span style="text-decoration: underline;"><B>Specialités</B></span></a>
</li>
</ul>
</div>
<div>
<img src="images/decoupage/nawrass-logo.png " class="rounded-circle bg-light">
</div>
<div class="navbar-collapse collapse w-50 ">
<ul class="navbar-nav mr-auto">
<li class="nav-item navbar2">
<a class="nav-link" >
<span style="text-decoration: underline;"><B>Contactez-nous</B></span>
</a>
</li>
<li class="nav-item navbar2">
<img src="images/decoupage/location.png" style="padding-top: 7px">
<span style="padding-top: 15px">Djerba Houmet Souk</span>
</li>
<li class="nav-item navbar2">
<div class="row">
<div class="col-md-3" style="padding-top: 7px">
<img src="images/decoupage/phone.png">
</div>
<div class="col-md-8" style="font-size: 16px;">
<span>75 620 660 </span>
<br>
<span>98 816 962</span>
</div>
</div>
</li>
<li class="nav-item navbar2">
<img src="images/decoupage/fb.png" style="padding-top: 7px">
</li>
</ul>
</div>
</nav>
<div class="container " style="min-height:100%; padding-left:120px;flex:1;display:flex;flex-direction:column;">
<div style="flex:1;display:flex;flex-direction:column;">
#yield('content')
</div>
</div>
<div id="footer">
<div class="jumbotron " style="margin-top:0 ; background-color:blue">
<div class="container ">
<div class="row">
<div class="col-md-6">
<div class="card mb-3 " style="background-color: blue">
<div class="row no-gutters">
<div class="col-md-3 ">
<img src="images/decoupage/logo-white.png" class="card-img" alt="my card image">
</div>
<div class="col-md-9 ">
<div class="card-body ">
<p class=" card-text text-white " style="font-size: 14.45px">
Bienvenu a centre de formation ennawres: formation en coiffure hommes et dames Langues {francais, anglais...} ,photographie..et plusieurs d'autres..
</p>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-2"></div>
<div class="col-md-4 ">
<br/>
<img src="images/decoupage/phone.png">
<span class="text-white">
75620660-98815952
</span>
<br>
<br>
<img src="images/decoupage/location.png">
<span class="text-white">
Houmet Souk Djerba,1Km Ajim
</span>
</div>
</div>
<div class="row">
<div class="col-md-6 offset-md-4 text-white">
PROPULSE PAR MOSAIQUE WEB COPYRIGHT 2019
</div>
</div>
</div>
</div>
</div>
For information the click in the navbar "Qui sommes nous" link trigger this controller method:
public function WhoWeAre()
{
return view('layouts/WhoWeAre');
}
and this is routes.php :
Route::get('/', function () {
return view('welcome');
});
Route::get('/whoweare', 'HomeController#WhoWeAre');

Laravel crash after adding a raw

Im displaying a treeview data and everything works perfecly.
But when i add the fourth raw, Laravel crash.
I want to post my code but i don't even know which one and where that came from..
view :
<div class="list-group">
<div class="col-md-12">
<div class="col-md-2">Departement</div>
<div class=" float-right">
<button class=" btn-primary" type="button" data-toggle="collapse" data-target=".multi-collapse" aria-expanded="false" aria-controls="multiCollapseExample1" >
<span class="glyphicon glyphicon-eye-open"></span></button>
<button type="submit" class="btn btn-warning " data-toggle="modal" data-target="#exampleModalposition"><span class="glyphicon glyphicon-plus-sign"></span></button> </div>
</div>
<div class="list-group-item" name="state">
#foreach($treeViewPosition as $departement)
<div class=" collapse multi-collapse collapse in " id="8" >
<div class="col-md-2"> {{ $departement->departement_name}}</div>
<div class=" float-right"><button class="btn btn-success" data-toggle="collapse" data-target="#{{ $departement->id}}8" aria-expanded="false" aria-controls="{{ $departement->id}}8">
<span class="glyphicon glyphicon-eye-open"></span></button></div>
<div class="list-group">
#if(count($departement->position))
#include('treeposition2',['position'=>$departement->position])
#endif
</div>
#endforeach
</div>
</div>
</div>

Why does image has that padding?

I'm trying out to squeeze the columns into two while the page is xs size. I did the necessary logic, and also tried to implement the same with an using img. However while using an image, I'm unable to force the image to take the full size of the block. I've tried all necessary css editing and stuff, maybe I'm missing something please help.
Take help of the jsfiddle link to understand it better. I've included the css in fiddle file
Js Link!
<html>
<style>
</style>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid ">
<div class="navbar-header ">
<button type="button" class="navbar-toggle pull-left " data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<form class="navbar-form pull-left my-searchmain" role="search">
<div class="input-group ">
<input type="text" class="form-control " placeholder="Search">
<div class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
</div>
</div>
</form>
</div>
<div class="collapse navbar-collapse " id="myNavbar">
<ul class="nav navbar-nav navbar-right col-lg-12 col-md-12 col-sm-12">
<li class="active col-lg-1 col-xs-6 col-md-1 col-sm-1"><img id="imgnew" src="http://www.affordable-templates123.com/wp-content/uploads/2015/05/fancy-label-templates-nh8tgtgq.jpg" ></li>
<li class="dropdown col-lg-1 col-xs-6 col-md-1 col-sm-1">
<a class="dropdown-toggle " data-toggle="dropdown" href="#">Page 2 </a>
<ul class="dropdown-menu">
<li>Page 1-1</li>
<li>Page 1-2</li>
<li>Page 1-3</li>
</ul>
</li>
<li class=" col-lg-1 col-xs-6 col-md-1 col-sm-1">Page 3</li>
<li class=" col-lg-1 col-xs-6 col-md-1 col-sm-1">Page 4</li>
<li class=" col-lg-1 col-xs-6 col-md-1 col-sm-1">Page 5</li>
<li class=" col-lg-1 col-xs-6 col-md-1 col-sm-1">Page 6</li>
<li class=" col-lg-1 col-xs-6 col-md-1 col-sm-1">Page 7</li>
<li class=" col-lg-1 col-xs-6 col-md-1 col-sm-1">Page 8</li>
<li class="col-xs-push-1">
<form class="navbar-form my-search " role="search">
<div class="input-group ">
<input type="text" class="form-control " placeholder="Search">
<div class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
</div>
</div>
</form>
</li>
</ul>
</div>
</div>
</nav>
</body>
</html>
Afsan Abdulali Gujarati, I think for what I understand here, you want the xs view menu text to all stay on the right in one vertical line.
To stop the text wrapping around below the image. The image being responsive is full width of the col-xs-6. But it looks like you are trying or meaning to have the image the same height of the text links on the right.
Hopefully the way it lines up now is ok.
Have a look at this Fiddle.
All I did here was to add padding-bottom:200px; to the litht holds the image.
See if this does what you want.
.keepclear{
padding-bottom:200px;
}
Added
To remove any padding around a image in a navbar add this to your custom css to override Bootstrap css classes.
.navbar-nav > li > a {
padding-top: 0;
padding-bottom: 0;
padding-left:0;
padding-right:0;
}

Font-awesome <i> tags auto-generated in JSP

I'm trying to include SB-Admin2 theme using a Spring Roo generated project (using bootstrap, tiles and JSP) but something is going wrong. I have icons corresponding to fa-search font-awesome tags that are displayed on the page.
It seems, that they have been generated when JSP tiles have been processed because they do not appear in my code.
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<li class="sidebar-search">
<div class="input-group custom-search-form">
<input type="text" class="form-control" placeholder="Search..."></input>
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<i class="fa fa-search"></i>
</button>
</span>
</div>
<!-- /input-group -->
</li>
<tiles:insertAttribute name="menu" ignore="true" />
</ul>
</div>
<!-- /.sidebar-collapse -->
</div>
File "menu.tagx" is :
<c:if test="${empty render or render}">
<li>
<jsp:doBody />
</li>
</c:if>
And file "items.tagx" is:
<c:if test="${empty label}">
<spring:message code="menu_item_${fn:toLowerCase(fn:substringAfter(id,'_'))}_label" var="label" htmlEscape="false" />
</c:if>
<c:if test="${not empty messageCode}">
<spring:message code="${messageCode}" var="label" arguments="${label}" htmlEscape="false" />
</c:if>
<li>
<spring:url value="${url}" var="menu_item_url"/>
<a href="${menu_item_url}" title="${fn:escapeXml(label)}">
<c:out value="${label}"/>
</a>
</li>
Generated code in Chrome inspector is:
<div role="navigation" class="navbar-default sidebar">
<div class="sidebar-nav navbar-collapse">
<ul id="side-menu" class="nav">
<li class="sidebar-search">
<div class="input-group custom-search-form">
<input placeholder="Search..." class="form-control" type="text">
<span class="input-group-btn">
<button type="button" class="btn btn-default">
<i class="fa fa-search"></i></button>
</span>
</div>
</li>
<div version="2.0" id="menu">
<li><h2><i class="fa fa-search">Party</i></h2>
<ul>
<li><i class="fa fa-search"><a title="Create new Party" href="/demo/partys?form">Create new Party</a></i></li>
<li><i class="fa fa-search"><a title="List all Partys" href="/demo/partys?page=1&size=10">List all Partys</a></i></li>
<li><i class="fa fa-search"><a title="Find by Last Name" href="/demo/partys?find=ByLastName&form&page=1&size=10">Find by Last Name</a></i></li>
</ul>
</li>
</div>
</ul>
</div>
</div>
Where do the <i class="fa fa-search"> elements come from? How to remove them?
Thank you very much for your help. Denis
Thank you for your tips ! I have finally found where it comes from...
If you don't put content (for instance a comment) between opening and closing tags processed by font-awesome CSS, parser will generate icons in front of all text areas displayed.
To avoid this, you must properly declare tags in your JSP like this:
<i class="fa fa-search"><!-- Some content --></i>
And not:
<i class="fa fa-search"></i>
Hope this help.

Resources