Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

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

Posts: 189
Trades: 0
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 11:00 PM..
simster is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-01-2008, 10:33 PM Re: having truble with code
Extreme Talker

Posts: 189
Trades: 0
anyone
simster is offline
Reply With Quote
View Public Profile
 
Old 05-01-2008, 11:02 PM Re: having trouble with webpage code (print)
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
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, 11:27 PM Re: having truble with code
Novice Talker

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

Posts: 189
Trades: 0
thank you
simster is offline
Reply With Quote
View Public Profile
 
Old 05-02-2008, 11:31 AM Re: having truble with code
Plugin-Developer's Avatar
Weightlifting CS Student

Posts: 504
Name: Nick Ohrn
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE
- Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
Plugin-Developer is offline
Reply With Quote
View Public Profile Visit Plugin-Developer's homepage!
 
Old 05-02-2008, 08:56 PM Re: having truble with code
Extreme Talker

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

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

__________________

Please login or register to view this content. Registration is FREE
- Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
Plugin-Developer is offline
Reply With Quote
View Public Profile Visit Plugin-Developer's homepage!
 
Old 05-03-2008, 12:58 AM Re: having truble with code
Extreme Talker

Posts: 189
Trades: 0
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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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.82674 seconds with 12 queries