Include PHP in HTML

galaxyAbstractor

Community Advocate
Community Support
Messages
5,508
Reaction score
35
Points
48
How to do it? I tried to include this in my overall_header.html file but it didn't work:

PHP:
require('security/munin.php');
munin('security/');

It is to a script that works like a firewall on my site and stops hacking attempts.
 
Last edited:

Thewinator

New Member
Messages
256
Reaction score
0
Points
0
overall_header.html is a template file.
A template has to be loaded by a php file.
Try to find that file and include the code there, becouse you cant put php code in a html file unless you told the php file that loads it to insert code there.
 

mattura

Member
Messages
570
Reaction score
2
Points
18
Also make sure you surround it with the tags:
<?php
/*code goes here*/
?>

You could rename overall_header.html to overall_header.php, include the php as above, then paste any html after it

Did you look in the script at all? Do you understand it?
Did you download it from somewhere that claimed it would prevent hackers? If so, that is not the way forward. If you are worried about hackers, learn to understand your site and what happens within it (especially with regard to dynamic content, if any). Probably if you just have static pages (ie html), you won't get hacked unless you give somebody your password/ftp or someone sniffs when you use unencrypted ftp. With dynamic content, such as php, learn how you protect your form inputs, GET, POST etc by taking a good read at:
http://docs.php.net/manual/en/security.php
Only when you understand the threats (if any) can you prevent hackers.
 

Slothie

New Member
Messages
1,429
Reaction score
0
Points
0
OR! you could put in it INDEX.PHP or w/e file that is always loaded :)
 

galaxyAbstractor

Community Advocate
Community Support
Messages
5,508
Reaction score
35
Points
48
I thought so too but if the bot/hacker is going to ex: viewtopic.php or memberlist.php that code will disappear and that will result in I need to insert that code in 200+ files of php. I know who did this script so I think it will work. Maybe not preventing all because that would be impossible but protecting somewhat.

If I rename overall_header.html to overall_header.php then I am in the same situation to edit 200+ files to the chang, aren't I?
 

conker87

New Member
Messages
65
Reaction score
0
Points
0
Afraid so. You could just make it so the server parses the html files as php.

Just add this into your .htaccess file:
Code:
AddType application/x-httpd-php .php .html
 

naim4u

New Member
Messages
51
Reaction score
0
Points
0
hi,
iam Naim.


i wanna tell you one thing ... it is immpossible to inclue php in a html.
you can put it in form of iframe as this:

// <iframe width=780 height=814 src="http://www.naimonline.net.ms" scrolling="auto" frameborder="0"></iframe> //

byeee
 

galaxyAbstractor

Community Advocate
Community Support
Messages
5,508
Reaction score
35
Points
48
but iframe is for showing things? Since it is a firewall to stop hackers I don't think I want to show it on my header...
 
Top