NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

#1 08-25-2007 13:10:14

acwitness
Member

need help with a code

Hi,

I would like to add a shout box that only allows use to oekaki members. I'm using ShoutMix and directions for integration are:


Integration Setup

If you have website with existing userbase, you can easily setup your shoutbox to use data from your userbase. With integration, only members logged in at your site can view and use your shoutbox.

PHP Function

If you're using PHP, you can add the following function to your script for quick integration. The function will produce correct parameters to be appended at the end of your shoutbox URL.



function shoutmix($name = '') { return htmlspecialchars( '&name='.rawurlencode($name) .'&code='.md5($name.'xxxxx6cf3')); }


Then alter your shoutbox HTML codes by adding the following codes (after your shoutbox URL):

Example

    ...mix.com/?acwitness<?=shoutmix($name);?>" width="...


Replace $name with the variable that holds the name of your member, as retrieved from the database.



Sorry to be so clueless, but I can't seem to make this work. Could someone please help?

Thanks!

Offline

#2 08-25-2007 20:50:36

Waccoon
Administrator

Re: need help with a code

Looks easy enough.

First, let's take care of the function. It should go into "hacks.php" to make sure if you update Wax Poteto, you won't have to re-install all the ShoutMix stuff.  Open up "hacks.php" in a text editor, and sandwich it someplace, like so:

Code:

    $wactest     = FALSE; // Beta testers only!
}

// ShoutMix
function shoutmix($name = '') {
    return htmlspecialchars( '&name='.rawurlencode($name) .'&code='.md5($name.'xxxxx6cf3'));
}

//
// General
//

Once that's done, you need to add the ShoutMix box in your notice so it will only show up for members and not guests.  To do this, you need to test if the "$OekakiU" variable is empty or not.  It will always be empty for guests or invalid members.  For members, $OekakiU contains the name of that member.

Since I can't see all the ShoutMix box code, make sure you replace all references to "$name" with "$OekakiU".  I presume there is only one instance to change.

EDIT:  Capitalization of "$OekakiU" is important, of course.

Code:

<? if (!empty ($OekakiU)) { ?>
    ...mix.com/?acwitness<?=shoutmix($OekakiU);?>" width="...
<? } ?>

Last edited by Waccoon (08-25-2007 20:52:08)

Offline

#3 08-25-2007 21:24:25

acwitness
Member

Re: need help with a code

Hey, thanks for the help!!

I added the code into the hacks file.

The code in the notice section is here:

code

Not sure where I should put everything here. I really have to learn php one of these days!

Offline

#4 08-26-2007 01:41:55

Waccoon
Administrator

Re: need help with a code

OK, my interpretation is that ShoutMix will put a member's name into the "name" field of the box, but they will have to type in their password manually.  For the sake of compatibility, it would be best to send $OekakiU only if it is not empty.

This code will show the ShoutMix to everyone, but will only send the member's name to the ShoutMix server if they are registered.  Assuming that ShoutMix won't complain if it receives an oekaki member's name that is not also registered with ShoutMix, this is the code you should use:

Code:

    <!-- Begin ShoutMix - http://www.shoutmix.com -->
    <iframe title="acwitness" src="http://www2.shoutmix.com/?acwitness<? if (!empty ($OekakiU)) { shoutmix($OekakiU); } ?>" width="150" height="200" frameborder="0" scrolling="auto">
    <a href="http://www2.shoutmix.com/?acwitness">View shoutbox</a>
    </iframe>
    <!-- End ShoutMix -->

If there's a weird problem where ShoutMix is complaining that some people are not registered, then the current code you have now should be used.

Offline

Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB