you like my new code button?

updated
- old comments are deleted because i have improved my script. so far i haven’t seen any errors. feel free to test more

check out my new code button in the comments field.. it actually replaces my other “better handle <code>” hack - test it out in the comments area by click on the “code” button :) and let me know how you like it. if it’s worthwhile to release it as a hack.


16 Comments Leave a Comment

dodo [ Quote ]
&lt;?php
function add&#95;magic&#95;quotes(&#36;array) {
	foreach (&#36;array as &#36;k =&gt; &#36;v) {
		if (is&#95;array(&#36;v)) {
			&#36;array[&#36;k] = add&#95;magic&#95;quotes(&#36;v);
		} else {
			&#36;array[&#36;k] = addslashes(&#36;v);
		}
	}
	return &#36;array;
}
?&gt;
August 18th, 2004 at 7:50 pm
dodo [ Quote ]
&lt;!DOCTYPE HTML PUBLIC "-&#47;&#47;W3C&#47;&#47;DTD HTML 4.0 Transitional&#47;&#47;EN"&gt;
&lt;HTML&gt;
&lt;HEAD&gt;
&lt;TITLE&gt; New Document &lt;&#47;TITLE&gt;
&lt;META NAME="Generator" CONTENT="EditPlus"&gt;
&lt;META NAME="Author" CONTENT=""&gt;
&lt;META NAME="Keywords" CONTENT=""&gt;
&lt;META NAME="Description" CONTENT=""&gt;
&lt;&#47;HEAD&gt;
&lt;BODY&gt;
test
&lt;&#47;BODY&gt;
&lt;&#47;HTML&gt;
August 18th, 2004 at 7:50 pm
Lorie [ Quote ]
&lt;p&gt;testing the CODE: by LORIE.&lt;&#47;p&gt;
&lt;p&gt;leaving on a jet plane&lt;br&gt;
&lt;b&gt;don't know &lt;span style="font-weight: 400"&gt;when I'll be back again&lt;&#47;span&gt;&lt;&#47;b&gt;&lt;&#47;p&gt;
August 18th, 2004 at 7:56 pm
ecila [ Quote ]

let’s try some java :D

import javax.swing.JOptionPane; &#47;&#47; import class JOPtionPane
public class SimpleGame03
{
    public static void main (String args[])
    {
	int num1, num2, org, sum, addnum, compwin = 0, userwin = 0, tries = 0, start, cont = 0;
	String input&#95;addnum;
	Object[] options = {"START", "CANCEL"};
	start = JOptionPane.showOptionDialog (null, "Game: Twenty One\nPlayers: Computer & User\nOverview: The Computer will deal 2 random numbers between 2-11.\nIf the sum of the two numbers is between 12-21 User wins;\nIf the sum is not, then User can choose the computer to deal\n1 or 2 more numbers.\nIf the new total is between 12-21 User wins, if not, the Computer wins\n\n                                                Have Fun!", " INFORMATION",
		JOptionPane.DEFAULT&#95;OPTION, JOptionPane.WARNING&#95;MESSAGE, null, options, options [0]);
	while ((cont != 1) && (start == 0))
	{
	    num1 = (int) (Math.random () * 9) + 2;
	    num2 = (int) (Math.random () * 9) + 2;
	    sum = num1 + num2;
	    if ((sum &gt;= 18) && (sum &lt;= 21))
		userwin = userwin + 1;
	    else
	    {
		compwin = compwin + 1;
		org = sum;
		if (sum &lt; 18)
		{
		    input&#95;addnum = JOptionPane.showInputDialog (num1 + " + " + num2 + " = " + sum + "\nTo little, do you want to add 1, or 2 more numbers?");
		    addnum = Integer.parseInt (input&#95;addnum);
		    if (addnum == 1)
		    {
			num1 = (int) (Math.random () * 9) + 2;
			sum = sum + num1;
			if ((sum &gt;= 18) && (sum &lt;= 21))
			{
			    userwin = userwin + 1;
			    JOptionPane.showMessageDialog (null, org + " + " + num1 + " = " + sum + "\nYou WIN!");
			}
			else
			{
			    JOptionPane.showMessageDialog (null, org + " + " + num1 + " = " + sum + "\nYou LOSE!");
			}
		    }
		    else
		    {
			num1 = (int) (Math.random () * 9) + 2;
			num2 = (int) (Math.random () * 9) + 2;
			sum = sum + num1 + num2;
			if ((sum &gt;= 18) && (sum &lt;= 21))
			{
			    userwin = userwin + 1;
			    JOptionPane.showMessageDialog (null, org + " + " + num1 + " + " + num2 + " = " + sum + "\nYou WIN!");
			}
			else
			{
			    JOptionPane.showMessageDialog (null, org + " + " + num1 + " + " + num2 + " = " + sum + "\nYou LOSE!");
			}
		    }
		}
	    }
	    cont = JOptionPane.showConfirmDialog (null, "Do you want to continue?", " CONTINUE?", JOptionPane.YES&#95;NO&#95;OPTION);
	}
	if (start == 0)
	    JOptionPane.showMessageDialog (null, "User wins: " + userwin + "\nComputer wins: " + compwin);
	else
	    JOptionPane.showMessageDialog (null, "        END OF PROGRAM", "PROGRAM TERMINATED", JOptionPane.INFORMATION&#95;MESSAGE);  &#47;&#47; if program never ran
	System.exit (0);
    } &#47;&#47; ends main class
}
August 18th, 2004 at 8:01 pm
ecila [ Quote ]

err… my backslashes are missing :((
&lt;p&gt;\ single backslashes missing&lt;&#47;p&gt;

August 18th, 2004 at 8:02 pm
ecila [ Quote ]

had to double them in order for one to show up

August 18th, 2004 at 8:02 pm
Robyn [ Quote ]
&lt;?php 
include("blah.php"); 
?&gt;
&lt;div style="border:1pt solid black; font-weight:bold; color:#fff;"&gt;&lt;&#47;div&gt;
August 18th, 2004 at 8:03 pm
Jessica [ Quote ]
&lt;style&gt;
&lt;style type="text&#47;css"&gt;
body {
  background-color: #FFFFFF;
  scrollbar-arrow-color: #000000;
  scrollbar-track-color: white;
  scrollbar-shadow-color: #F1BEF9;
  scrollbar-face-color: #F1BEF9;
  scrollbar-highlight-color: #F1BEF9;
  scrollbar-darkshadow-color: #F1BEF9;
  scrollbar-3dlight-color: #F1BEF9;   
}
.left, .blogbody, table.footer, .standard, .leftmodulefontcolor, td, p {
  font: normal 9pt Tahoma;
  line-height: 10pt;
  color: #000000;
  letter-spacing: 0px;
  text-align: justify;
  }
&lt;&#47;style&gt;
August 19th, 2004 at 12:16 am
Bubs [ Quote ]
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;OMG&lt;&#47;title&gt;
&lt;&#47;head&gt;
&lt;body&gt;
&lt;font style="text-transform: uppercase"&gt;DODO LINKED ME!! XD&lt;&#47;font&gt;
&lt;&#47;body&gt;
&lt;&#47;html&gt;

You rock Dodo ;)

August 19th, 2004 at 1:19 am
Bubs [ Quote ]

Testing the threaded comments…

August 19th, 2004 at 1:28 am
dodo [ Quote ]

&#92;

August 19th, 2004 at 1:42 pm
dodo [ Quote ]

i attempted to fix it. try again will you?

August 19th, 2004 at 1:43 pm
ecila [ Quote ]

c.println("&#92;nLalalaal give me a space ");
ooOooo… converted the slash x)

August 20th, 2004 at 12:15 pm
ecila [ Quote ]

yes it worked :)

August 20th, 2004 at 12:15 pm
ecila [ Quote ]

i have a question dodo :) this new code hack… when you are posting code in an entry, will it too have a new textarea JUST to type in code? and will convert the slashes, and pointy brackets to the & - type code? :)

August 21st, 2004 at 7:52 pm
Joni [ Quote ]

What I want to know is how you were able to get the comment. gif as a link in the comment link. That has bedeviled me from Day One! Thanks!

Great site, BTW, surfed in here from Jenny’s “Adoption” link!

August 29th, 2004 at 5:13 pm

Leave a Comment Name, email and comment are required.
Email will never be displayed.

Leave a Comment
  1. :biggrin: :blank: :blush: :bored: :confused: :cool: :down: :evil: :frown: :grin: :grr: :laidback: :left: :mad: :right: :sad: :secret: :shock: :smile: :stress: :tongue: :up: :wink: :yawn: :cute: :dead: :film: :floppy: :glasses: :grumpy: :headphones: :heart: :lightbulb: :ouch: :tv: :upsidedown: :vodka: :yell: :yuck: :yummy: