Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Would this be useful?


  • Total voters
    15

purplelizzard

macrumors newbie
Original poster
Feb 8, 2007
28
0
Would anyone be interested in a site where you can test server-side code like PHP, Ruby or Perl? I have started making a site like this, but before I finish it, I want to see if there is any interest.
 
I don't think it would be secure for you. Anyone could run a script that could delete files from the server, send spam, etc.
 
I already considered that. I would make it so when someone put in something that would potentially cause harm, the code wouldn't be run and they would be warned, if they did it again, they would be removed. I would also disable mail.

Is there a way to make the script run as a user without permissions to modify files?

Security aside, would this be useful
 
Why would you want to provide something like that to the general public? I can't speak for anyone else, but I test my code on my own server before releasing it. Uploading it to someone else's is not only a waste of time, but could also open a can of worms that I wouldn't want to open.
 
I already considered that. I would make it so when someone put in something that would potentially cause harm, the code wouldn't be run and they would be warned, if they did it again, they would be removed. I would also disable mail.

Is there a way to make the script run as a user without permissions to modify files?

Security aside, would this be useful

It would be possible to stop specific functions such as file modification, but many PHP scripts use files so that wouldn't be desirable. Mail would be the same, people would need to test that.

However, you would have to give each user an individual account and only allow them to perform actions within the confines of that account. This would basically turn the service into a shared hosting account and so I'm not sure what it would offer over a normal, cheap, hosting account.

I think you would encounter all the problems that a hosting company would with spammers etc, but without an accounting trail it would be virtually impossible to trace the users and so provide no deterrent against malicious code.
 
Imagine that you just started out learning PHP or Ruby. You go online and see a really cool function, and want to test it out. (you don't have apache installed on your computer, because many windows users don't when they start out, obviously once you get better and more serious, you will install apache, but many beginners dont. Also, on a mac, PHP is disabled by default.) To test this function, you could upload it to your server and try it that way, or you could go to this website and type in the new code and easily change and test it until you get it correct. That way you don't have to upload your changes repeatedly.

What I want to do is this:
Have all of the website run with permission to modify files.
Have the files created with the test code run as users without permission to modify files

I will have a database or two that is open to everyone with phpMyAdmin installed.

I will upload a test soon.
 
Remember to check out the Terms of Service of your hosting provider. Some companies do not allow third parties to run their code in the server.

You could also have an app to preview/edit CSS. In one text area you write the CSS code, and in the other text area you write the HTML.
 
Here's a code snippet for you to consider:

PHP:
<?php

fn_hello_world ();

function fn_hello_world ()
{
   while (1)
   {
      return fn_hello_world ();
   }
}
?>

Okay, one call to this script is not really going to bring your server down to its knees, as the connection will be cut when the script does segmentation fault (which I tried just now on our local server out of curiosity).

But consider hundreds or thousands or however many billion calls to the script above at the same time, and you'll probably need to unplug your server to save it from burning.

I can see your point of having novice learners who want to try out a code snippet they found on the web. But when they find the code I posted above and they make your webhost ban your account, is it going to be worth it?


A better approach might be to create a forum (or a place) where people can discuss codes they found on the web, and maybe have a sub section where people can learn how to install their own server.

It's going to give them a lot of work, sure. But that's how they can learn.
Instead of giving you headache for what they want to learn (and probably use in the future), why not give them guidance instead? After all, the best way to learn is the hard way ....


To answer your question: Is it useful? It really depends.

For novice: Probably not much since they won't know what they are doing anyway. And if they find something doesn't work, how do they know if it's because of the mistake in their code or it's because of your PHP settings?

For intermediate / advanced / etc: Most likely not, since most of the people in this group would have working environment they can use already.

For people with bad intentions (spammers, etc): Most likely yes, since they can work their bad scripts without having to worry about providing their own server. You want to ban their email account? What's stopping them from signing up for a free email account and register on your site?

For you: Not sure - what do you think?


-stndn.
 
Imagine that you just started out learning PHP or Ruby. You go online and see a really cool function, and want to test it out. (you don't have apache installed on your computer, because many windows users don't when they start out, obviously once you get better and more serious, you will install apache, but many beginners dont. Also, on a mac, PHP is disabled by default.) To test this function, you could upload it to your server and try it that way, or you could go to this website and type in the new code and easily change and test it until you get it correct. That way you don't have to upload your changes repeatedly.

I'm still not really seeing any benefit to it to be honest. I can't envisage someone who is interested enough in a PHP function not having a method of testing it. Yes, they wouldn't have to upload the file each time they changed it, but they still would have to edit it on your system and/or upload it to your system, then make sure they took those changes and put it back into their copy correctly.

What might be more useful for beginners (but harder to write for you) would be a code validator. With that, you wouldn't necessarily have to run the code itself but instead check it for errors - missing semi-colon, misspelt function name etc.
 
I agree with the idea of writing a validator, are there any out there already? That would be more useful.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.