Jump to content
xisto Community
coolcat50

Html Code Tester. Online Script

Recommended Posts

Yes, yes. I have another script that I have written and I am distributing. I am not entirely sure if this works. I have not tested it yet, but I will later and post back with a demo and fix it up. Current script:

<?php//Save this as something like htmltest.phpfunction CheckForm(){$html_unsafe=$_POST['code'];//Gives us our user input$html_safe=str_replace("<?php","<php>",$html_unsafe);//Starts security measures$html_safe=str_replace("?>","</php>",$html_safe);//User input now secure server side//Still security issues client sideecho $html_safe;//echos our statement}//End function//Main scriptif ($_GET['test']=='true'){//Check submitif (isset($_POST['submit'])){//echo out pageCheckForm();}else{die("Sorry,you shouldn't be viewing this page. Please go back.");}else{//Start form?><form action="htmltest.php?test=true" method="post"><textarea cols=XX rows=XX name="code"><html><head><title></title></head><body></body></html></textarea><input type="submit" name="submit" value="Submit" /><?php} //End script//Made by coolcat50//Please give me credit if you use?>

Demo:
HTML tester

There you go peeps. So what do you guys think?
Edited by coolcat50 (see edit history)

Share this post


Link to post
Share on other sites

This will be really helpful for me once you fix it. Since I've began using notepad exclusively, if I wan't to see my changes, I have to actually open the file as an internet page... so this will most definately help.

Share this post


Link to post
Share on other sites

You DO realize that you cant execute php code with echo right? There is no reason to parse that out...
much simpler:

<?phpif(isset($_POST['code'])) echo $_POST['code'];else{?><form method="post"><textarea cols=XX rows=XX name="code"><html><head><title></title></head><body></body></html></textarea><input type="submit" /></form><?php } ?>

Edited by alex7h3pr0gr4m3r (see edit history)

Share this post


Link to post
Share on other sites

It basically echos out whatever you type into the text box. Not really that complex. I guess its good if you are working on an html site and want instant results to what it will look like.

Share this post


Link to post
Share on other sites

My script does the same thing but it is more simple and runs faster, and is not missing any brackets... If you really have a use for this I suggest you use mine unless you like unnessisarily long code...

Share this post


Link to post
Share on other sites

Well Alex, your code is more compact, but it wouldn't produce the same results. Mine has a security feature in it to destroy all attempts to execute PHP code. Therefore my code is more secure and probably easier read and more efficient.EDIT: Well, the way mine works is that it creates the variable and it actually parses PHP. I tested a PHP script on mine myself.

Edited by coolcat50 (see edit history)

Share this post


Link to post
Share on other sites

Yes but did you pay attention to the first line in my post?

You DO realize that you cant execute php code with echo right? There is no reason to parse that out...

So yours is no more secure in any way.

Share this post


Link to post
Share on other sites

thats pretty cool, alot like the code tester on w3 schools website. but not as secure or with a single page. but thats a good start if you plan to advance it further :)

Share this post


Link to post
Share on other sites

I think you should add two frames to your window and design one as an IE. Give it a title bar. Use a status bar. Just use text boxes for this. Then when some body clicks submit then the second IE emulated window will refresh. This is just a suggestion. I'm working on your script to help it improve. By the way thanks for making such a great script online & open source.****Thanx****Dave

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.