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
Need advise from a php guru
Old 10-05-2009, 09:16 PM Need advise from a php guru
bmcoll3278's Avatar
Super Talker

Posts: 118
Name: Brian Collins
Trades: 0
Hey guys. I am working on a basic php tutorial.
before you yell at me for doing this when I cant answer my own question remember I said Basic LOL

I created a script that lets the student create a php file in a textarea then when they submit it a file is written to a folder on my server and they are given a link to view it. when they view it at the top of the page before their code starts is a message saying they must click this link to close the window after they are done viewing.
They click the link and it deletes the file they just wrote.and closes the window.

This all works fine but here is my question. would I be crazy to let it go public. Could someone use the tutorial page to write a script that would trash my site? And is there any way I could make it secure so they dont?

Thanks in advance for any ideas
__________________
I hope to build a site with something for every one

Please login or register to view this content. Registration is FREE
bmcoll3278 is offline
Reply With Quote
View Public Profile Visit bmcoll3278's homepage!
 
 
Register now for full access!
Old 10-05-2009, 09:56 PM Re: Need advise from a php guru
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Yes, you'd be crazy. Parsing the PHP to let someone run only safe code is a gargantuan task. Why not stick with pure HTML?
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 10-05-2009, 10:44 PM Re: Need advise from a php guru
rednimaT's Avatar
Skilled Talker

Posts: 64
Name: Taminder B.
Location: San Jose, CA
Trades: 0
yes. I've written a PHP script that can view the contents of the entire directory and the source code for every PHP file in the directory (even directories before that directory in Windows-based servers).
__________________

Please login or register to view this content. Registration is FREE

(HTML/PHP/MySQL/JavaScript/AJAX/SEO)
rednimaT is offline
Reply With Quote
View Public Profile Visit rednimaT's homepage!
 
Old 10-05-2009, 11:04 PM Re: Need advise from a php guru
bmcoll3278's Avatar
Super Talker

Posts: 118
Name: Brian Collins
Trades: 0
Quote:
Originally Posted by JeremyMiller View Post
Yes, you'd be crazy. Parsing the PHP to let someone run only safe code is a gargantuan task. Why not stick with pure HTML?
I dont understand. How can I let them test the file they just wrote with pure html?

But I am glad I asked before letting it out to use.

I think I will package the script and give it away so they can upload it to there own site then just use my site for the tutorial part. Thanks for the help.
__________________
I hope to build a site with something for every one

Please login or register to view this content. Registration is FREE
bmcoll3278 is offline
Reply With Quote
View Public Profile Visit bmcoll3278's homepage!
 
Old 10-05-2009, 11:07 PM Re: Need advise from a php guru
911
911's Avatar
Novice Talker

Posts: 10
Name: Jesse
Trades: 0
Number #1 security rule...

Eliminate all chances of allowing outside code being executed on your server. This is why forums are the #1 target for malicious activity.

Wish you the best of luck on your task.
__________________
Free Web Hosting -- 250MB Disk / 100GB Bandwidth
No banners, No Ads -- Includes PHP/MySQL

Please login or register to view this content. Registration is FREE
911 is offline
Reply With Quote
View Public Profile
 
Old 10-05-2009, 11:46 PM Re: Need advise from a php guru
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Quote:
Originally Posted by bmcoll3278 View Post
I dont understand. How can I let them test the file they just wrote with pure html?
You can't except to view the file in a browser. You're writing a tutorial, though, so what does it matter which language you use.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 10-06-2009, 12:25 AM Re: Need advise from a php guru
bmcoll3278's Avatar
Super Talker

Posts: 118
Name: Brian Collins
Trades: 0
Ok I get what you ment. The tutorial is in html.
The php is to let them try the scripts they write But that idea is scraped after what you guys here said.
I will just do the tutorials in html and offer the script for them to use on there own server as a tool.
Thanks again
__________________
I hope to build a site with something for every one

Please login or register to view this content. Registration is FREE
bmcoll3278 is offline
Reply With Quote
View Public Profile Visit bmcoll3278's homepage!
 
Old 10-06-2009, 12:31 AM Re: Need advise from a php guru
911
911's Avatar
Novice Talker

Posts: 10
Name: Jesse
Trades: 0
Hey Brian be sure to post your final page I'd like to see what you end up doing and maybe give you any advice if you want.
__________________
Free Web Hosting -- 250MB Disk / 100GB Bandwidth
No banners, No Ads -- Includes PHP/MySQL

Please login or register to view this content. Registration is FREE
911 is offline
Reply With Quote
View Public Profile
 
Old 10-06-2009, 12:35 PM Re: Need advise from a php guru
rednimaT's Avatar
Skilled Talker

Posts: 64
Name: Taminder B.
Location: San Jose, CA
Trades: 0
well I think it's possible to write a script where they can write the PHP script, click submit and it will show on top of what they wrote the output of the script they just wrote. if their server doesn't support PHP, you can have them download a simple lightweight web server where they can view it on localhost. they can use QuickPHP. it's pretty much an application that you download, and just click start and the server will load (and its very lightweight, meant for testing out scripts on local server). hope that helped.
__________________

Please login or register to view this content. Registration is FREE

(HTML/PHP/MySQL/JavaScript/AJAX/SEO)
rednimaT is offline
Reply With Quote
View Public Profile Visit rednimaT's homepage!
 
Old 10-06-2009, 10:26 PM Re: Need advise from a php guru
bmcoll3278's Avatar
Super Talker

Posts: 118
Name: Brian Collins
Trades: 0
Quote:
Originally Posted by 911 View Post
Hey Brian be sure to post your final page I'd like to see what you end up doing and maybe give you any advice if you want.
Thanks. I think it may be above my skill level to make it interactive like I want without setting myself up for hacking.

But I may package my script with a simple self installer give it to the user then they can read my tutorial and run the script on there server.
But I am still going to look for a way to make it work on mine. I just dont want hacked so I will need advise I am grateful for the offer.
__________________
I hope to build a site with something for every one

Please login or register to view this content. Registration is FREE
bmcoll3278 is offline
Reply With Quote
View Public Profile Visit bmcoll3278's homepage!
 
Old 10-06-2009, 11:31 PM Re: Need advise from a php guru
bmcoll3278's Avatar
Super Talker

Posts: 118
Name: Brian Collins
Trades: 0
Quote:
Originally Posted by rednimaT View Post
well I think it's possible to write a script where they can write the PHP script, click submit and it will show on top of what they wrote the output of the script they just wrote. if their server doesn't support PHP, you can have them download a simple lightweight web server where they can view it on localhost. they can use QuickPHP. it's pretty much an application that you download, and just click start and the server will load (and its very lightweight, meant for testing out scripts on local server). hope that helped.
writing the script is easy I have it working fine. But I am afraid to let anyone use it for fear they could execute a script on my server that screws up my site.
__________________
I hope to build a site with something for every one

Please login or register to view this content. Registration is FREE
bmcoll3278 is offline
Reply With Quote
View Public Profile Visit bmcoll3278's homepage!
 
Old 10-07-2009, 12:11 AM Re: Need advise from a php guru
NullPointer's Avatar
Will Code for Food

Posts: 2,784
Name: Matt
Location: Irvine, CA
Trades: 0
Quote:
Originally Posted by bmcoll3278
I notice you answer a lot of php question and seem to know your stuff.

Would you look at this post and see if you could give any advise?
http://www.webmaster-talk.com/php-fo...-php-guru.html

I would like to make this idea work But dont want to get myself hacked.
Thanks
The problem with allowing users to upload and execute PHP code is that it would be far too difficult to restrict their access to possibly dangerous functions. Just off the top of my head:
exec
eval
unlink
rmdir
database functions
filesystem functions
.
.
.

by the time you eliminate anything that can be misused you won't have much of a language at all.

Even then someone determined enough could most likely still do something malicious. As far as I'm aware there is no way to accomplish what you are trying to do effectively.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 10-07-2009, 01:04 AM Re: Need advise from a php guru
bmcoll3278's Avatar
Super Talker

Posts: 118
Name: Brian Collins
Trades: 0
Quote:
Originally Posted by NullPointer View Post
The problem with allowing users to upload and execute PHP code is that it would be far too difficult to restrict their access to possibly dangerous functions. Just off the top of my head:
exec
eval
unlink
rmdir
database functions
filesystem functions
.
.
.

by the time you eliminate anything that can be misused you won't have much of a language at all.

Even then someone determined enough could most likely still do something malicious. As far as I'm aware there is no way to accomplish what you are trying to do effectively.
Thank you much I will try something else I just thought it would be cool to have the only tutorial that was interactive
__________________
I hope to build a site with something for every one

Please login or register to view this content. Registration is FREE
bmcoll3278 is offline
Reply With Quote
View Public Profile Visit bmcoll3278's homepage!
 
Reply     « Reply to Need advise from a php guru
 

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 1.02650 seconds with 12 queries