Break my code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Break my code

Post by protokol »

Ok, I have this thing working great, so now I need people to try and break my code. Give it your best shot. I have a good feeling that it's break-proof :lol:

http://easypim.sourceforge.net/color/
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

did you know hex codes could be 3 chars too?
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

no, actually, i did not realize hex color codes could be 3 chars long .. explain
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

im pretty sure #000 would turn out black. #FFF white, #00F blue... etc..
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

Well, although some browsers may recognize those codes as being valid, it is definitely not standard.

According to http://www.w3schools.com/html/html_colorsfull.asp Hex color codes are 6-chars long.

Each Red, Green, and Blue is represented by a 2-char hex.

So with this RGB: 10 11 12 , the represented numbers in hex would be 0A 0B 0C which means #0A0B0C .. if the hex is only 1 char long, then it has to have a 0 followed by the character. This also applies to RGB: 0 1 2, which is #000102
User avatar
RandomEngy
Forum Contributor
Posts: 173
Joined: Wed Jun 26, 2002 3:24 pm
Contact:

Post by RandomEngy »

Just a note, clicking on the web-safe colors for me pops up a window that I have to resize in order to see all of the colors.
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

RandomEngy wrote:Just a note, clicking on the web-safe colors for me pops up a window that I have to resize in order to see all of the colors.
The way that the colorchart.php script works (web-safe color popup) is it dynamically generates an HTML table with the <td bgcolor=""> == to the corresponding web-safe color. I have tested the popup on many different browsers/platforms, and there is really no way for me to make the popup window the correct size.

Some browsers the window is sized perfectly, some browsers the window is too big, and in your case it is too small. Until I can figure out a better way to display the colors, this will have to be the way that is works.
User avatar
RandomEngy
Forum Contributor
Posts: 173
Joined: Wed Jun 26, 2002 3:24 pm
Contact:

Post by RandomEngy »

Well, if the table is the same all of the time, just make it a static table with no cellpadding and cellspacing, and each cell a set width and height. That should make the table size exactly x-pixels high and y-pixels wide.

Shouldn't it?
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

RandomEngy wrote:Well, if the table is the same all of the time, just make it a static table with no cellpadding and cellspacing, and each cell a set width and height. That should make the table size exactly x-pixels high and y-pixels wide.

Shouldn't it?
Well, I could do that, but then I run across another problem. The way that hyperlinks are created is that &nbsp; populates each cell with the link. Now I suppose I could use CSS or something to make the each <td> cell clickable. That way I could change the width of each of the cells and not worry about the whole cell not being clickable.
User avatar
RandomEngy
Forum Contributor
Posts: 173
Joined: Wed Jun 26, 2002 3:24 pm
Contact:

Post by RandomEngy »

Ahh, I see the problem now... Gotta have something to click on, and the width modifier doesn't constrain the cell when the spaces run more than the width.
User avatar
toro
Forum Newbie
Posts: 10
Joined: Wed Jul 03, 2002 8:03 am
Location: Iceland

Gif for fixed width?

Post by toro »

Perhaps you could use a tdot.gif (transparent dot) of a particular width and height as clickable.

This should be easier to constrain than &nbsp; -- just make sure that there are no extra spaces or new-lines inside the <td></td>.

However there are certainly some browser versions that mess this up - but, hey that's what html is like.

Toro
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

RandomEngy wrote:Ahh, I see the problem now... Gotta have something to click on, and the width modifier doesn't constrain the cell when the spaces run more than the width.
Yes, exactly. I just modified the code a bit and now it shouldn't be a problem though. Check it out and let me know if this is better.
http://easypim.sourceforge.net/color

Basically I did this:

Code: Select all

<td bgcolor="web_safe_code" onclick="choose_color" style="cursor: pointer">&nbsp;</td>
User avatar
RandomEngy
Forum Contributor
Posts: 173
Joined: Wed Jun 26, 2002 3:24 pm
Contact:

Post by RandomEngy »

The width is right, but it still left out the bottom row.
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

Ok, hehe, I promise it's fixed now:

http://easypim.sourceforge.net/color/
User avatar
RandomEngy
Forum Contributor
Posts: 173
Joined: Wed Jun 26, 2002 3:24 pm
Contact:

Post by RandomEngy »

Strange, bottom row is still not making it into the window.... maybe you can just make the window bigger and just have some white space for some people.
Post Reply