Welcome Guest ( Log In | Register)



2 Pages V   1 2 >  
Reply to this topicStart new topic
> Html Code Tester. Online Script
coolcat50
post Nov 3 2007, 12:03 AM
Post #1


Super Member
*********

Group: Members
Posts: 290
Joined: 5-October 07
From: Random Places
Member No.: 51,171
Spam Patrol



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?

This post has been edited by coolcat50: Dec 5 2007, 08:41 PM
Go to the top of the page
 
+Quote Post
jlhaslip
post Nov 3 2007, 01:19 AM
Post #2


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 4,076
Joined: 24-July 05
From: Linix, DOS and Windows…the good, the bad and the ugly
Member No.: 9,787
Spam Patrol



Can you put up a Demo for us, please?
Go to the top of the page
 
+Quote Post
Liam_CF
post Nov 3 2007, 09:51 AM
Post #3


Super Member
*********

Group: Members
Posts: 403
Joined: 14-October 07
From: ERROR 404
Member No.: 51,575



I still don't understand what to do.

Can you explain it a bit better please?
Go to the top of the page
 
+Quote Post
mahirharoon
post Dec 5 2007, 02:47 PM
Post #4


Advanced Member
*******

Group: Members
Posts: 102
Joined: 25-November 07
Member No.: 53,695



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
Go to the top of the page
 
+Quote Post
coolcat50
post Dec 5 2007, 08:40 PM
Post #5


Super Member
*********

Group: Members
Posts: 290
Joined: 5-October 07
From: Random Places
Member No.: 51,171
Spam Patrol



My demo I have or had set up worked. It is probably missing a "{" or "}". I'll proofread it.
Go to the top of the page
 
+Quote Post
KansukeKojima
post Dec 5 2007, 09:06 PM
Post #6


Privileged Member
*********

Group: [HOSTED]
Posts: 528
Joined: 13-October 06
From: Alberta, Canada
Member No.: 31,584



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.
Go to the top of the page
 
+Quote Post
galexcd
post Dec 6 2007, 01:11 AM
Post #7


Define:EVIL PROGRAMMER (ē'vəl prō'grăm'ər)- n. An organism that converts caffeine into evil software.
***********

Group: [HOSTED]
Posts: 1,060
Joined: 25-September 05
From: L.A.
Member No.: 12,251



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 } ?>


This post has been edited by alex7h3pr0gr4m3r: Dec 6 2007, 01:18 AM
Go to the top of the page
 
+Quote Post
de4thpr00f
post Dec 6 2007, 02:45 AM
Post #8


Member [Level 2]
*****

Group: Members
Posts: 76
Joined: 21-November 07
Member No.: 53,412



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
Go to the top of the page
 
+Quote Post
galexcd
post Dec 6 2007, 03:02 AM
Post #9


Define:EVIL PROGRAMMER (ē'vəl prō'grăm'ər)- n. An organism that converts caffeine into evil software.
***********

Group: [HOSTED]
Posts: 1,060
Joined: 25-September 05
From: L.A.
Member No.: 12,251



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.