I have a php-script which will, if added correctly to an HTML page, display the users online at that moment on your site.
This comes in handy when you do not have MySql support.
This online.php uses also an online.txt to registers some things.
It’s a part of a forum which is also written in PHP and the maker has given me permission to use this online.php a part from his PHP-forum.
The question is this, how do I include this online.php in a HTML page?
If you not have guess already, I’m an absolute n00b to PHP.
If requested I can display or e-mail this script.
Including PHP in a HTML page
Moderator: General Moderators
<?
require("/absolute/path/to/online.php");
?>
Find the absolute path to the file (it won't be http://url.com/file or anything like that)...
Fill that path in and that should do it.
require("/absolute/path/to/online.php");
?>
Find the absolute path to the file (it won't be http://url.com/file or anything like that)...
Fill that path in and that should do it.
can't
you can't include a php page in an html page. Your html page will have to be saved as a php page otherwise the php you have included in that page will not be parsed at all.
Even if you just do
at the top of your page or where ever you want to include that file your page that is includeing tha file will have to be saved as a php page.
phpScott
Even if you just do
Code: Select all
<?php
require("/absolute/path/to/online.php");
?>phpScott
-
skyhawk133
- Forum Newbie
- Posts: 9
- Joined: Wed Nov 13, 2002 10:25 pm
- Location: Rio Rancho, NM
I use;
<div align="center"><iframe frameborder=0 src="http://www.i2paq.org/forum/online/online.php" width="130" height="400"></iframe></div>
but then I get these errors;
Warning: Unable to access online/online.txt in /home/sites/site30/web/i2paq/forum/online/online.php on line 20
Warning: fopen("online/online.txt", "r") - No such file or directory in /home/sites/site30/web/i2paq/forum/online/online.php on line 20
Warning: stat failed for online/online.txt (errno=2 - No such file or directory) in /home/sites/site30/web/i2paq/forum/online/online.php on line 21
Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site30/web/i2paq/forum/online/online.php on line 21
Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site30/web/i2paq/forum/online/online.php on line 22
Warning: fopen("online/online.txt", "w") - No such file or directory in /home/sites/site30/web/i2paq/forum/online/online.php on line 27
Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site30/web/i2paq/forum/online/online.php on line 28
Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site30/web/i2paq/forum/online/online.php on line 29
Warning: Unable to access online/online.txt in /home/sites/site30/web/i2paq/forum/online/online.php on line 57
Warning: fopen("online/online.txt", "r") - No such file or directory in /home/sites/site30/web/i2paq/forum/online/online.php on line 57
Warning: stat failed for online/online.txt (errno=2 - No such file or directory) in /home/sites/site30/web/i2paq/forum/online/online.php on line 58
Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site30/web/i2paq/forum/online/online.php on line 58
Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site30/web/i2paq/forum/online/online.php on line 59
It is the same file on the same location that I use in my Forum at http://www.i2paq.org/forum/index.php
Check the top where it say's "1 users online"
I also found in the header.php of this forum something that adresses to online.php.
include("online/online.php");
echo"<table cellspacing=1 cellpadding=4 border=0 width=100%>\n";
echo"<tr>\n";
echo"<td width=50% align=\"left\"><h2>$title</h2></td>\n";
echo"<td width=30% valign=\"top\">\n";
if($mode=='index'){
echo"<h6>$n_u_online $user_online<br>\n";
include("online/online_member.php");
If needed I can send anyone the files.
What am I missing or doing wrong?
Again, I'm not in writing PHP, but I do know how to change scripts.
<div align="center"><iframe frameborder=0 src="http://www.i2paq.org/forum/online/online.php" width="130" height="400"></iframe></div>
but then I get these errors;
Warning: Unable to access online/online.txt in /home/sites/site30/web/i2paq/forum/online/online.php on line 20
Warning: fopen("online/online.txt", "r") - No such file or directory in /home/sites/site30/web/i2paq/forum/online/online.php on line 20
Warning: stat failed for online/online.txt (errno=2 - No such file or directory) in /home/sites/site30/web/i2paq/forum/online/online.php on line 21
Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site30/web/i2paq/forum/online/online.php on line 21
Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site30/web/i2paq/forum/online/online.php on line 22
Warning: fopen("online/online.txt", "w") - No such file or directory in /home/sites/site30/web/i2paq/forum/online/online.php on line 27
Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site30/web/i2paq/forum/online/online.php on line 28
Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site30/web/i2paq/forum/online/online.php on line 29
Warning: Unable to access online/online.txt in /home/sites/site30/web/i2paq/forum/online/online.php on line 57
Warning: fopen("online/online.txt", "r") - No such file or directory in /home/sites/site30/web/i2paq/forum/online/online.php on line 57
Warning: stat failed for online/online.txt (errno=2 - No such file or directory) in /home/sites/site30/web/i2paq/forum/online/online.php on line 58
Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site30/web/i2paq/forum/online/online.php on line 58
Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site30/web/i2paq/forum/online/online.php on line 59
It is the same file on the same location that I use in my Forum at http://www.i2paq.org/forum/index.php
Check the top where it say's "1 users online"
I also found in the header.php of this forum something that adresses to online.php.
include("online/online.php");
echo"<table cellspacing=1 cellpadding=4 border=0 width=100%>\n";
echo"<tr>\n";
echo"<td width=50% align=\"left\"><h2>$title</h2></td>\n";
echo"<td width=30% valign=\"top\">\n";
if($mode=='index'){
echo"<h6>$n_u_online $user_online<br>\n";
include("online/online_member.php");
If needed I can send anyone the files.
What am I missing or doing wrong?
Again, I'm not in writing PHP, but I do know how to change scripts.