Reply
having truble with code
Old 05-01-2008, 08:26 PM having trouble with webpage code (print)
Extreme Talker

Posts: 164
here is my code for blog.php

PHP Code:
<?php 
$filename 
$_REQUEST['blog'];

print 
"<?php include(' http://mysite.com/blog/ " $filename " .txt '); ?>";
?>
the url in the address bar is http://mysite.com/beta/blog.php?blog=1

can someone tell me whats wrong in the code.

Last edited by simster : 05-01-2008 at 10:00 PM.
simster is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 05-01-2008, 09:33 PM Re: having truble with code
Extreme Talker

Posts: 164
anyone
simster is offline
Reply With Quote
View Public Profile
 
Old 05-01-2008, 10:02 PM Re: having trouble with webpage code (print)
VirtuosiMedia's Avatar
Webmaster Talker

Posts: 604
Quote:
Originally Posted by simster View Post
here is my code for blog.php

PHP Code:
<?php 
$filename 
$_REQUEST['blog'];

print 
"<?php include(' http://mysite.com/blog/ " $filename " .txt '); ?>";
?>
the url in the address bar is http://mysite.com/beta/blog.php?blog=1

can someone tell me whats wrong in the code.
Why are you printing it? Try this instead:

PHP Code:
<?php 
$filename 
'http://mysite.com/blog/'.$_REQUEST['blog'].'.txt';
include(
$filename);
?>
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 05-01-2008, 10:27 PM Re: having truble with code
Novice Talker

Posts: 5
Great tip VM! I was going to post something similar.
psalzmann is offline
Reply With Quote
View Public Profile
 
Old 05-01-2008, 10:37 PM Re: having truble with code
Extreme Talker

Posts: 164
thank you
simster is offline
Reply With Quote
View Public Profile
 
Old 05-02-2008, 10:31 AM Re: having truble with code
nickohrn's Avatar
Weightlifting CS Student

Posts: 505
Name: Nick Ohrn
simster, this is quite possibly one of the least secure things I've ever encountered. You want your users to be able to include whatever text file from your server that they want to?

You need to do some type of authentication against allowed values in a database or pre-written array or something. I can't stress enough that this method is dangerous. Plus, posting here that you can arbitrarily include files from your server is not helping your cause.
__________________
Plugin-Developer.com - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
nickohrn is offline
Reply With Quote
View Public Profile Visit nickohrn's homepage!
 
Old 05-02-2008, 07:56 PM Re: having truble with code
Extreme Talker

Posts: 164
only from that folder (nothing else is in there)
simster is offline
Reply With Quote
View Public Profile
 
Old 05-02-2008, 08:29 PM Re: having truble with code
nickohrn's Avatar
Weightlifting CS Student

Posts: 505
Name: Nick Ohrn
simster - Think about relative paths. What if you went to the following? What would the URL point at?

__________________
Plugin-Developer.com - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
nickohrn is offline
Reply With Quote
View Public Profile Visit nickohrn's homepage!
 
Old 05-02-2008, 11:58 PM Re: having truble with code
Extreme Talker

Posts: 164
its only a personal web site and that wont work with VMs code
simster is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to having truble with code
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13877 seconds with 13 queries