Nov 20, 2009
Pages: 1, 2

Html Code Tester. Online Script

free web hosting

Read Latest Entries..: (Post #15) by coolcat50 on Jun 27 2008, 06:19 PM.
No problem. It is very simple, and could probably be extended in many ways. I made this when i was a complete noob.
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion > MODERATED AREA > Computers > Programming Languages > PHP Programming

Html Code Tester. Online Script

coolcat50
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:
CODE
<?php
//Save this as something like htmltest.php
function CheckForm()
{
$html_unsafe=$_POST['code'];
//Gives us our user input

$html_safe=str_replace("<?php","&lt;php&gt;",$html_unsafe);
//Starts security measures
$html_safe=str_replace("?>","&lt;/php&gt;",$html_safe);
//User input now secure server side
//Still security issues client side

echo $html_safe;
//echos our statement
}
//End function
//Main script
if ($_GET['test']=='true')
{

//Check submit
if (isset($_POST['submit']))
{
//echo out page
CheckForm();
}
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?

 

 

 


Comment/Reply (w/o sign-up)

jlhaslip
Can you put up a Demo for us, please?

Comment/Reply (w/o sign-up)

Liam_CF
I still don't understand what to do.

Can you explain it a bit better please?

Comment/Reply (w/o sign-up)

mahirharoon
i excecuted this in www-sharp
this came
QUOTE
Parse error: parse error, unexpected T_ELSE in C:\Program Files\Common Files\wwwSharp.Runtime\Admin\htmltester.php on line 32

Comment/Reply (w/o sign-up)

coolcat50
My demo I have or had set up worked. It is probably missing a "{" or "}". I'll proofread it.

Comment/Reply (w/o sign-up)

KansukeKojima
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.

Comment/Reply (w/o sign-up)

alex7h3pr0gr4m3r
You DO realize that you cant execute php code with echo right? There is no reason to parse that out...
much simpler:
CODE
<?php
if(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 } ?>

Comment/Reply (w/o sign-up)

de4thpr00f
Can you guys tell me what this do? I can't get it.
The topic is not very clear.
You use this script in wich situations?

Greetz
~
João Lopes

Comment/Reply (w/o sign-up)

alex7h3pr0gr4m3r
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.

Comment/Reply (w/o sign-up)

gogoily
I think you just wrote a frame scripts, I don't know its usage now.
But you surely missed a "}" in line 32

Comment/Reply (w/o sign-up)

Latest Entries

coolcat50
No problem. It is very simple, and could probably be extended in many ways. I made this when i was a complete noob.

Comment/Reply (w/o sign-up)

dave2win
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


Comment/Reply (w/o sign-up)

anachro
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 wink.gif

Comment/Reply (w/o sign-up)

galexcd
Yes but did you pay attention to the first line in my post?
QUOTE(alex7h3pr0gr4m3r @ Dec 5 2007, 05:11 PM) *
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.

Comment/Reply (w/o sign-up)

coolcat50
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.

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Pages: 1, 2
Similar Topics

Keywords : html, code, tester, online, script

  1. Weird Formatting: Embedding Php Into Html
    (10)
  2. Php Code For Login Form With Validation In Php
    (7)
    I dont want to use javascript as a validation form i want to use Regular expression in PHP for Login
    or other page. please any one have a best code for validation in PHP. as i thinks that web site
    Validation on server site is faster then client site validation. Most welcome.....
  3. How To Make Php Newsletter Script
    (3)
    I have seen a post on here somewhere which shows how to make a simple newsletter php script. I
    cvant find it anywhere and I wanted to ask some questions of the author. Does anyone know the one I
    mean? Cheers ....
  4. Php Guest Online Script
    (3)
    make an index.php copy and paste this code CODE $db_host = "localhost"; $db_user = "root";
    $db_pass = ""; $db_name = "test"; $dbc = mysql_connect($db_host, $db_user, $db_pass); $dbs =
    mysql_select_db($db_name); $tm = time(); $timeout = $tm - (30*60); if($_SERVER ){$ip=$_SERVER ;}
    else{$ip=$_SERVER ;} $brws = explode("(",$_SERVER ); $browser = $brws ; mysql_query("DELETE FROM
    guest WHERE actvtime mysql_query("INSERT INTO guest SET  time='".$tm."',
    ip='".$ip."', browser='".$browser."'"); $count =
    mysql_fetch_array(mysql_query("SELECT COUNT(*)....
  5. How To Make A View New Post Script?
    (5)
    Ok so i'm still working on the forum software i posted about a while back, but I have no idea
    how to do this. I want to make a view new post script, as this is one of the main things that my
    forum software dose not have that all other forums have. so does any body have an idea on how i
    would do this? Thanks.....
  6. Guessing Php Script
    (2)
    I am looking for: freeware php quess the person in the photo game script....
  7. Create Table - Mysql Code - Help
    (1)
    I need your feedback about setting the database issues. Please, review them and correct some entries
    in the code if they got some mistakes. This is the code itself: SQL CREATE TABLE `news` (
    `id` int(250) NOT NULL auto_increment, `title` varchar(255) NOT NULL default '',
    `text` text NOT NULL, `author` varchar(255) NOT NULL default '', `valid` varchar(255)
    NOT NULL default '', `date` varchar(255) NOT NULL default '', PRIMARY KEY
    (`id`) ) ENGINE = MyISAM ; ....
  8. Php Source Code Unveiled In Browser?
    is that possible? (7)
    I am quite new to PHP and this concern came to my mind after playing around a bit with it... When
    PHP is not correctly configured on the web server the source code of a php file we try to access
    through a browser will be shown instead of the result of the code itself. This will normally not
    happen when PHP is working properly, but I was just wondering if it could still be possible to see
    that code if a user wanted to or if something on the server failed. This would for example expose
    sensitive information like mysql passwords and so on... Is anything like that possib....
  9. Html Form!
    Using MySQL?! (4)
    Hey, I need your help again! I need some good working tutorial how I can update my SQL through HTML
    form. I did use some tutorials online found with the help of google; but they do not work properly;
    I mean there are still small mistakes. I need to have a good tutorial to follow. It should be
    based on security and more things. It has to be done in proper way.......
  10. Malicious Code Injection
    (3)
    Hi everyone! This is my first post, so be kind! Basically, I'm trying to get a free host
    together so am writing some posts. Here's a little summin' summin' about malicious code
    injection with PHP applications. Basically, this security exploit is one of the oldest tricks in
    the books and all comes down to the fact that PHP allows execution of both local and remote scripts
    with the SAME function... dur. Anyway, this is how it works. Image you've just employed a young
    go getter, straight outta uni, who has found becoming a Jack of all trades a sinch. Y....
  11. Php And Mysql Programming
    anyone knows a code for mysql and php (2)
    hi everyone! I am making a program using php and mysql...I am a noob on this so i need your help
    guys...I want to make a simple program that will some values and then store them on a database and
    then retrieve them...uhmm let me give an example out put of what i need. This is the example say..:
    Enter First Name: Enter Last Name:
    Enter Age: Enter Address: ..those are the
    data needed for input values...my question now is how can I make a database whi....
  12. Need Help Installing Dolphin Community Script!
    (5)
    I'm not sure if this is the right place to post this but I really need help in installing the
    dolphin community script. I have absolutely no previous experience of scripts or programming. I
    would really appreciate if someone could walk me through it step-by-step, or even do it for me by
    logging into my cpanel. I have tried to install it my self but I'm a little confused. I'm
    sure it won't take very long at all for someone who has done this before.....
  13. Php Code?
    Mathematical Applications (12)
    Hello, everyone. The help is needed again. How can I make calculator in PHP language? That will act
    like that a user just type in the fields known values, then click the button, and it's going to
    be solved automatically. In other words, have can I write a formula in PHP, how to plug it inside
    that language. For example, the formula to find a peremeter of square is: P=4a. So, a user
    just can write the known value which is peremeter itself and it will find the side of a square; and
    vice versa. If you can write many things how to do such formulas, such as comp....
  14. Php Downloads Script
    (4)
    I've been looking all over the net for a PHP script which can provide an interface to browse a
    downloads database. The database could be powered by MySQL. If you know a script like this, please
    post it here. Thanks in advance, Ironchicken.....
  15. Very Simple Online Now Script
    This is a very simple online now script. (4)
    Hi all, Its Aldo. anyways, I wont be using the method of pagination, i will just tell you how to
    make a basic online now script. When someone logs in, now take into consideration that the name of
    the username input is username ( First ,create a table in your database saying online now and add 2
    fields to it. id and username CODE id type=integer(INT) , auto increment, length =255 and
    username = VARCHAR length=the limit a username should be in your site now from there we take off
    : CODE //logged.php //authentication script //connection script //if connectio....
  16. Display The Current Date/time
    With a simple PHP code (4)
    Use this code to display the current date and time. CODE   $date = date('l dS \of F Y
    h:i:s A');   echo "$date"; ?> "l" would display the current day of the week such as
    Sunday. d displays the day of the month... such as 1 and S adds the appropriate suffix(st). /of
    simply displays the word "of". F displays the current month with no abbreviations while Y displays
    the four digit year(2007). "h" displays the current hour with leading zeros if necessary(Ex. 06 for
    6 o'clock). "i" displays the minute of the hour with leading zeros if necessary. ....
  17. Free Auction Script
    Any Suggestions? (7)
    Any free auction script suggested? I want it to be as many practical functions as possible, yet
    easy to manage. And more importantly, it is free! Appreciate your kind suggestions!....
  18. Wap Source Code Viewer
    Mobile/wap source code viewer page (4)
    This is a source code viewer that will workl on wap/mobile sites but you can easily convert it to
    work on web im sure ;-) CODE header("Content-Type: text/vnd.wap.wml"); echo '
    ';   print " "; if ($url == "") {      echo " Enter url: »View source code ";   }
    if ($url == "$url") {    $udata=@file_get_contents("$url"); $udata = str_replace("$","$$",$udata);
    $udata = str_replace("&","&",$udata); $udata = str_replace("'","'",$udata); $udata =
    str_replace(" $udata = str_replace(">",">",$udata); $udata = str_replace("\"....
  19. Php And Disabling Html Tags
    how can i do this? (11)
    Hello everyone Im TRYING to make a forum and obviously for security i need to disable HTML tags
    being used in posts. i know how to use the str_replace() function but to be honest i think id have
    to do that for every single tag. I also trued using the html CODE stuff tag but i need to
    be able to use the new line tag to make a new line as all the posts are stored as HTML. if this isnt
    clear let me give an example: QUOTE NEW POST PAGE > user makes new post and posts it > PHP
    PROCCESSOR PAGE MAKES HTML FILE > NEW HTML FILE CONTAINING THE POST > user veiws ....
  20. Watermark Your Image With Simple Php Script
    found it on the net (39)
    This script was found on the net http://tips-scripts.com/?tip=watermark#tip B&T's Tips &
    Scripts site. Just in case the site may not show, I will include the code here: List of things
    needed: 1. your image in any format 2. watermark image--in gif format with transparent background 3.
    script below with name (i.e. watermark.php) CODE // this script creates a watermarked image
    from an image file - can be a .jpg .gif or .png file // where watermark.gif is a mostly transparent
    gif image with the watermark - goes in the same directory as this script // where this....
  21. Requesting Auto Generating Id Tag In Php Code
    Php Coding (3)
    Hello...I'm designing a website in PHP where ppl can submit their links for "cool sites".
    Anyway, when somebody submit's a link to a website for example "http://www.google.com" it
    creates an id such as "index.php?id=1134411593". I dont want the links to be converted into
    id's. I want it to remain as "http://www.google.com". I have the following coding on
    ( echo " ). I'm a novice. Please Help!!!! Thanks... Plus I
    also want to add the date on when the link was submitted. Please follow our forum rule by making....
  22. Transfer Variables To Another Php Script
    (11)
    Hello, I've one registration page where the users fills in their information, is it possible to
    trasnfer the things the fill in on the registration page to another script that does someting and
    returnes something to the first page like true/false and then the registration gives an error
    messange if the other php script returned false? Something like the script "activates" another
    script that does something and returnes the result back to the original script. Best Regards ....
  23. Parse: Error Unexpected T_lnumber
    php parse error when running script (4)
    Hi. I've just created a php script. The main object of the script is to delete some old files
    and replace it with a new file with some new content, effectively moving the contents from one file
    to another. These are the first 50 lines of the file: /* Calculate For The "A" Group - The
    Latest Games ID */ $a_B = 002; while(file_exists("a_" . $a_B . ".dat")) { $a_B++; }
    $new_page_contents = " " . $_POST . " " . $_POST . " include
    \"/home/cmatcme/public_html/footer.php\"; ?> "; $a_stream = fopen($a_B . ".cmat", "w+");
    fwri....
  24. Php News Script
    how to make news script that uses MySQL writen in PHP (20)
    How to make a News script with PHP + MySQL So..in this tutorial i will explain how to create PHP
    news script. first we have to create the table in My SQL.. with the code below you will do this (
    you have to enter it into SQL field ..in PHPmyADMIN) CODE CREATE TABLE news ( id int(10)
    unsigned NOT NULL auto_increment, postdate timestamp(14) NOT NULL, title varchar(50) NOT NULL
    default '', content text NOT NULL, PRIMARY KEY (id), KEY postdate (postdate), FULLTEXT KEY
    content (content) ) >>>> script files 1 file will show the news ,1 file will....
  25. Script: Php Jukebox
    A one file script! (6)
    This scripts is so simple, you dont need to edit ANY of it! All you have to do is make a folder
    called 'songs' and put some audio files in it. Here is the whole page, I named it index.php
    and put it in a folder called 'music': CODE PHP jukebox ©2005 Craig lloyd.
    All rights reserved. Visit cragllo.com for more scripts --> /** * ©2005 Craig lloyd. All rights
    reserved. * * Mod Title:           Simple PHP Jukebox * Author:              Craig Lloyd * Author
    Email:        cragllo@cragllo.com * Author Homepage:     http://www.cragllo.com/ * Des....
  26. I.p. Ping Online Or Offline
    (7)
    Does anyone know of a script that will tell people if an IP is online or offline? Like it will ping
    it like every fifteen minutes or so and will display an online or offline image accordingly. Or at
    least it supports images, text is fine I guess, but I'd rather it use images. Any help on this
    will be appreciated! Thanks!....
  27. Get Filename Of Referring Url
    php code to get filename of referring URL (9)
    Hey /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> I want to know how
    to get the filename of the referring URL. Look at the following example: Page A which has a URL of
    http://blah.trap17.com/blah/blah1.php redirects the user to Page B which has a URL of
    http://blah.trap17.com/blah/blah2.php . Is there a PHP code that I can put on blah2.php that will
    output blah1.php? I tried _SERVER ; (please note the code may not exactly be correct as I do not
    remember the code /laugh.gif' border='0' style='vertical-align:middle' alt='laugh.gif' />....
  28. Many Php Script Sites
    (18)
    Hi I find many sites has PHP scripts :: QUOTE http://www.proxy2.de/scripts.php
    http://www.free-php.net http://knubbe.t35.com/ http://www.ngcoders.com/
    http://www.oxyscripts.com/ http://www.phparena.net/ http://www.1phpstreet.com/
    http://px.sklar.com/ http://www.scoznet.com/ http://php.resourceindex.com/ /blink.gif"
    style="vertical-align:middle" emoid=":blink:" border="0" alt="blink.gif" />....
  29. Php Clock
    source Code (8)
    Hi Every one i find this code its very easy simple php clock i think you can use it /blink.gif'
    border='0' style='vertical-align:middle' alt='blink.gif' /> CODE // Binary Clock // script
    copyright© 2002 Andreas Tscharnuter // questions? contact: psychodad@psychodad.at ||
    http://www.psychodad.at/clock/ // free to use, copy and modify but leave comments untouched;) //
    just include this file where your binary clock should appear // version 1.2   03 September 2003 //
    below you can change different settings // and remember to drink m000re milk! $size =  "40";  ....
  30. How do you test your php code
    (97)
    We know that php is a server side scripting language. So we will need a server with the php parser
    to parse/test our code. How are you doing that. Do you upload it to a server for testing or did you
    instal php and the server (apache) on your computer (localhost)....

    1. Looking for html, code, tester, online, script

Searching Video's for html, code, tester, online, script
See Also,
advertisement


Html Code Tester. Online Script

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com