Hey I would like to include a php file into my larvel blog page using, ckeditor. I have 2 problems when I add in tags they are commented out and html tags are just filtered out in the database. When I just add the <?php code or script in the database directly to the body in database the code is still there but the <?php code still does not parse/execute but it will show up in the blog page.
I can execute php from my database as long as I am the using php eval() function, but the eval is not parsing in ckeditor source code. Any solution would be greatly appreciated. Im using larvel 5.7 and ckeditor 4+
Here are the images db image
blog post img ckeditor output
ck source img view ckeditor source code img
For reference here are pics of php eval() without using larvel ckeditor db img
output img output img
code to output/ reference for working example '''
$servername = "";
$username = "";
$password = "";
$dbname = "";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM e.g.";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$row1 = $row['middle_name']; //would be changed to row['body'] for larvel blog
eval($row1);
}
} else {
echo "0 results";
}
$conn->close();
?>
'''
nvm I found a bypass.
you can use an html onload="";
<div id="topBar"> <a href ="#" onload="load_home()"> HOME </a> </div>
<div id ="content"> </div>
<script>
function load_home() {
document.getElementById("content").innerHTML='<object type="text/html" data="sometthing.html" ></object>';
</script>
}
You can also use an <iframe src="" in the ckeditor or add directly to the database to add php code on that file
<iframe onload="function()" src="...eg page you want to load"></iframe>