Forum Moderators: coopster

Message Too Old, No Replies

simple php help

newbie

         

Doood

3:31 pm on Apr 5, 2004 (gmt 0)

10+ Year Member



I just got a php shoutbox (tagboard) but the submit buttons are too big and wanted to make them smaller. I can't seem to figure out how.

The original submit and reset buttons are supposed look like "::Submit" and "::Reset" and the code for them looked like value="<?=_SHOUT?> so I just removed the underscore and it took away the :: and that shrunk them a little bit, but they're still too big.

Here's what the code for them looks like now...

<input type="submit" name="Submit" value="<?=shout?>" class="button" onSubmit="submitonce(this)">&nbsp;<input type="reset" name="Submit2" value="<?=reset?>" class="button">

I can't figure out how to make these buttons smaller.

jetboy_70

3:37 pm on Apr 5, 2004 (gmt 0)

10+ Year Member



Reducing the surrounding font size will shrink the buttons, but do a search on Google for 'CSS form styling' or similar to find out how to alter form buttons using CSS.

Doood

3:41 pm on Apr 5, 2004 (gmt 0)

10+ Year Member



Oh ok, I know a little bit about css but wasn't sure that the size was defined from there because there's no size specified for .buttons right now.

Doood

4:18 pm on Apr 5, 2004 (gmt 0)

10+ Year Member



Oh yeah, one more thing I forgot to ask.

In the tagboard where you put in your nickname, the box says "Your Nick/Name" until you type your nickname in there, I want to edit what it says but I can't find anywhere to change it and I've looked on all of the pages I believe.

Here's what it looks like...

<input type="text" name="nick" size="18" maxlength="30" <?=$onfocusnick?>value="<?=$nick?>" class="editbox" title="<?=_FORM_NAME?>">

can you tell just by looking at that where it's pulling that text from so it can be edited?

ergophobe

4:43 pm on Apr 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




so I just removed the underscore and it took away the ::

Not knowing what package you're using, I can only guess, but I'm pretty sure what's happening is this.

1. variables with names that begin with underscores (like $_SHOUT) are basic variable that the package uses. There is probably somewhere (admin interface, settings file) where you can set the value.

2. When you change $_SHOUT to $shout, all you are doing is changing from a defined variable to an undefined variable. PHP usually plays nice and tries to give some value to undefined variable, like a zero-length string or a 0. So what you are getting is the same as if you just left out the
<?=$shout?>

altogether. That is, the same as typing in

value=""

in just plain HTML, which is better than having undefined variables in your script. As it is, it's just defaulting to the value of a submit button with no value specified.

Tom

Doood

4:51 pm on Apr 5, 2004 (gmt 0)

10+ Year Member



I searched all the pages for "::" and "Your Nick/Name" and came up with nothing. So even though removing the underscore change the original value, it removed the :: and that's the only way I could figure out how to do it cause I really don't know this stuff.

ergophobe

6:12 pm on Apr 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just for kicks, I downloaded shoutbox 2.32 to check it out.

the _SHOUT and _FORM_NAME constants are defined in the language packs like

shoutbox_langpack_english.php

Grasshopper, when you learn to use grep, you can go.

The problem with the way you are doing it is that you are throwing in random variables that are, luckily, undefined, but which could crash you application. For example, perhaps $shout is only defined under some conditions. Your shoutobx will start crashing under those conditions becuase it's not expecting that value in the form field.

If you are going to replace it with a variable, make sure it has no chance of being a variable defined elsewhere like

$ergophobe_param = "";

Tom

Doood

6:29 pm on Apr 5, 2004 (gmt 0)

10+ Year Member



Doh, I didn't even think to look in the language files. I readded the underscore and removed the ::

Thanks for the help. I probably would have never figured it out.

Oh, don't use v2.32 as there are security flaws in it. Line 49 of shoutbox.php is commented out and allows for directory traversal which is not good. You do a search for it or go to the forum on their site and read all about it. I think there are some other changes as well.