No way to open local htm file in php? - xampp

Need to open an htm page that is located on my local disk.
I'm running an application using php and xampp server.
I've tried in every way and not make it.
My application path is C:\xampp\htdocs\portal
My htm file path is C:\sistemas\test.htm
I can't move my test file and put it into portal folder.
when I click on the link just nothing happens.
here's my code
<li>
<a target="_new" href="file:///C:/SISTEMAS/test.htm">
<span class="ui-icon ui-icon-suitcase"> </span> Test
</a>
</li>
I've tried in Firefox 25 and IE10. Same result.

You cannot actually do like this but I guess your requirement is just including the content of test.htm. Using php your code can go something like this.
<li>
<a target="_new" href="test.php">
<span class="ui-icon ui-icon-suitcase"> </span> Test
</a>
</li>
and test.php would be including the content of test.htm
<?php require('../../sistemas/test.htm'); ?>

Related

How do I hide login link and show logout link in homepage navbar once user logs in and gets re-directed to homepage?

I'm working on a Spring boot based web application and the homepage contains a boostrap navbar with Login and Register link.
Once user logs in (by clicking login link from homepage), they will be re-directed to home page again (unless they visit any other link before spring security kicks in for A&A). On re-direct, I want to hide login and register links from the navbar and show logout link in their place. Becuase I want to insert the navbar in all the pages of application.
I want to know what is the best/standard way of doing this when the requirement is re-direction to same page.
One solution that I can think of is to check and obtain a user-principal object from spring security, pass it to thymeleaf template and check that if userprincipal object is present in the request attribute to the thymeleaf template, that means a user has logged in and I can then hide(not-render) login & register links and show(render) logout link. If not, show login & register links and hide logout link. I'm wondering, is this a correct way to do so? This feels like a hack to me and hence want to know if there is any standard way of doing this.
There is a Thymeleaf Spring Security extension that you can use:
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
Add the namespace
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
And then you can use it:
<li sec:authorize="!isAuthenticated()" class="nav-item">
<a class="btn btn-outline-light" th:href="#{/login}">Login</a>
</li>
<li sec:authorize="isAuthenticated()" class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false" sec:authentication="name">
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="pl-3" th:href="#{/password}">Passwort ändern</a>
<div class="dropdown-divider"></div>
<a class="pl-3" th:href="#{/logout}">Logout</a>
</div>
</li>
Please find the whole documentation here:
https://github.com/thymeleaf/thymeleaf-extras-springsecurity

ckeidtor - html values are not being saved in db on live server CI

I am working in CodeIgniter and I am stucked in an unusual problem. I have some text in ckeditor and everything is working just fine. but when I try to save list
<ul>
<li>item one</li>
<li>item two</li>
</ul>
after submitting it says
FORBIDDEN
You don't have permission to access
/myproject/folder/controler/method/id on this server.
kindly spread some light why is it happening

CKEditor : Code Snippet in Ckeditor not working with Laravel 5.3

Need to show saved Code Snippet on CKEditor for editing purpose.
I am using
Code Snippet along with Ckeditor at Laravel 5.3
Everything is OK. I can add Code and upload code in Database. Code also shown in the Target Page.
When I need to edit post, I get the previously uploaded data from the Database to the textarea. Inside the textarea Code Snippet does not show. Here's an Example...
I uploaded this code
<div class="col-md-5 flex-center mainheadright2">
<nav class="nav nav-inline">
<a class="nav-link" href="#">Get Full Access</a>
<a class="nav-link" href="#">Hire Me</a>
</nav>
</div>
While uploading this Code shows properly in the textarea. Also shows properly in Target Page. But while I get this Code again in the textarea to edit, it shows the following.
Get Full Access Hire Me
I want to get code as snippet every time I want to edit post.
What should I do?

How do I play videos in my website?r

The videos I want to play are in my computer. I have read the forums and guides and I only found guides that lets you play videos uploaded in a video hosting site like JW player and Kaltura. Is there a way to play videos coming directly from my computer? For example by using the path of the file not the link of the uploaded file in the video hosting site. Btw I'm making a youtube like website.
This is my view:
<body>
<div id="container">
<h1>Welcome</h1>
<div id="body">
<div id="div2">
<a href='<?php echo base_url()."main/search"; ?>'>Search!</a>
<br>
<a href='<?php echo base_url()."main/upload"; ?>'>Upload!</a>
<?php echo "<br>"; ?>
<a href='<?php echo base_url()."main/myAccount"; ?>'>Edit my Account!</a>
<?php echo "<br>"; ?>
<a href='<?php echo base_url()."main/logout" ?>'>Logout</a>
</div>
<div id ="searchBox">
<video width="320" height="240" controls >
<source src="videos\53e38a25e298a.mp4" type="video/mp4">
<source src="video\videos\53e38a25e298a.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
</div>
</div>
<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds</p>
</div>
</body>
I'm trying to play a video (specific location for now) from my computer. But it won't play and it just show the player and play button and progress bar.
Update: I'm currently using xampp and codeigniter as the framework.
I tried creating a single webpage placed in my Desktop using the code above and placed the video in my Desktop and it worked. But when I am using codeigniter it does not play. I've tried putting the video clips inside my view folder but still it won't work.
Have a look into HTML5 Video, you can play videos in a similar way to how you would usually add an image from your computer into a website.
http://www.w3schools.com/html/html5_video.asp
I've solved the problem, it seems that the path is indeed incorrect. The correct path is localhost/video/videos/53e38a25e298a.mp4

Why is parsing a tpl file in CodeIgniter giving me an error on a web server?

So, my friend that owns the domain that we are working on set up a live development server for me to upload my files to. I had previously been developing on WAMP. I uploaded the CodeIgniter files to the web server(along with the application) and updated the config files. When everything in the config was working, I refreshed the page and got an error.
Parse error: syntax error, unexpected T_STRING in /blah/blah/html/application/frontend/views/overall_header.tpl on line 1
This is the very first TPL file called in the script. I use the CI template parser library to parse TPL files. It worked absolutely fine on WAMP, but now is giving me this error. The TPL file is just pure HTML.
Any ideas?
PS: The web host is Media Temple.
Base Command
<div id="header">
<div id="toolbar">
<ul>
{TOOLBAR}
</ul>
<div id="search">
<form action="#" method="POST">
<input type="text" name="criteria" value="Enter search criteria, then press enter." class="text-input">
</form>
</div>
</div>
<div id="banner">
<div class="logo">
</div>
</div>
<div id="navigation">
<ul>
{MAIN_NAVIGATION}
</ul>
</div>
</div>
May be this is a problem with difference between new line characters on Windows and Linux systems. On local you use WAMP (Windows), so you use \r\n as new line characters. On hosting (I hope, Linux-like hosting?) it not working correctly, because Linux standard new line char is \n . To solve this you need to change all \r\n to \n before putting files on hosting.
For preventing this in future use editor/IDE which can work with linux-like line chars and may be change WAMP environment settings belongs to new line characters.
This is invisible symbols and you use it in any files what contain line breaks. Check this settings in your editor:

Resources