PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
danharibo
Forum Commoner
Posts: 76 Joined: Thu Aug 17, 2006 8:56 am
Post
by danharibo » Sun Sep 10, 2006 7:27 am
sorry for Bumping, But i got the script working
Here it is:
Code: Select all
if(isset($_GET['page']))
{
$page = $_GET['page'];
$page2 = str_replace('..', '', $page);
print($page2);
$fp = fopen($page2, 'r'); // Open Page .txt for reading from beginning
$read = fread($fp, '1000'); // Read from the file pointer
print($read);
}
else{
$fp = fopen('index.txt', 'r'); // Open Page .txt for reading from beginning
$read = fread($fp, '1000'); // Read from the file pointer
print($read);
}
Now i have to 'automaticaly' add .txt to the end of it
danharibo
Forum Commoner
Posts: 76 Joined: Thu Aug 17, 2006 8:56 am
Post
by danharibo » Sun Sep 10, 2006 7:44 am
Uh oh:
Warning: fopen(0): failed to open stream: No such file or directory in c:\program files\easyphp1-8\www\sufsite\index.php on line 22
Warning: fread(): supplied argument is not a valid stream resource in c:\program files\easyphp1-8\www\sufsite\index.php on line 23
Code: Select all
$temp= $page2 + '.txt';
$page2 = $temp;
danharibo
Forum Commoner
Posts: 76 Joined: Thu Aug 17, 2006 8:56 am
Post
by danharibo » Sun Sep 10, 2006 7:54 am
Nevermind, Fixed