News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Changing register design

Started by rameleu, February 03, 2015, 12:22:45 PM

Previous topic - Next topic

rameleu

Hello everyone,

I'm actually trying to change my register design. I've already done it for the login page, using the ssi_login function, but when I'm trying to create the same function to register, it doesn't work...

Could someone help me ? My ssi_register looks like this :

// Show a form for guests to register.
function ssi_register($output_method = 'echo')
{
global $scripturl, $db_prefix, $txt, $settings, $modSettings, $context;

loadLanguage('Login');

// Generate a visual verification code to make sure the user is no bot.
$context['visual_verification'] = empty($modSettings['disable_visual_verification']) || $modSettings['disable_visual_verification'] != 1;
if ($context['visual_verification'])
{
$context['use_graphic_library'] = in_array('gd', get_loaded_extensions());
$context['verificiation_image_href'] = $scripturl . '?action=verificationcode;rand=' . md5(rand());

// Only generate a new code if one hasn't been set yet
if (!isset($_SESSION['visual_verification_code']))
{
// Skip I, J, L, O and Q.
$character_range = array_merge(range('A', 'H'), array('K', 'M', 'N', 'P'), range('R', 'Z'));

// Generate a new code.
$_SESSION['visual_verification_code'] = '';
for ($i = 0; $i < 5; $i++)
$_SESSION['visual_verification_code'] .= $character_range[array_rand($character_range)];
}
}

    // If we have GD, try the nice code.
    elseif (empty($_REQUEST['format']))
    {
        require_once($sourcedir . '/Subs-Graphics.php');

        if (in_array('gd', get_loaded_extensions()) && !showCodeImage($_SESSION['visual_verification_code'])) {
            header('HTTP/1.1 400 Bad Request');
die();
}
        // Otherwise just show a pre-defined letter.
        elseif (isset($_REQUEST['letter']))
        {
            $_REQUEST['letter'] = (int) $_REQUEST['letter'];
            if ($_REQUEST['letter'] > 0 && $_REQUEST['letter'] <= strlen($_SESSION['visual_verification_code']) && !showLetterImage(strtolower($_SESSION['visual_verification_code']{$_REQUEST['letter'] - 1}))) {
                header('HTTP/1.1 400 Bad Request');
die();
}
        }
        // You must be up to no good.
        else {
            header('HTTP/1.1 400 Bad Request');
die();
}
    }
    elseif ($_REQUEST['format'] === '.wav')
    {
        require_once($sourcedir . '/Subs-Sound.php');

        if (!createWaveFile($_SESSION['visual_verification_code'])) {
            header('HTTP/1.1 400 Bad Request');
die();
}
    }

if($output_method = 'echo' && $context['user']['is_guest']) {
echo '

<div class="login-card">           
<dl class="register_form">
<h1>Creation de compte</h1>
        <form action="', $scripturl, '?action=register2" method="post" accept-charset="', $context['character_set'], '">
                        <input type="text" name="user" size="10"  maxlength="30" placeholder="Pseudo" />
                        <input type="password" name="passwrd1" size="10" placeholder="Password" />
<input type="password" name="passwrd2" size="10" placeholder="Password" />
                        <input name="email" type="text" size="10" placeholder="E-mail" /><input name="regagree" type="hidden" value="checked" />
                    ';
    if ($context['visual_verification'])
    {
       echo '
                            ', $txt['visual_verification_label'], ':
                            <input type="text" name="visual_verification_code" size="10" />
    <tr>';
        if ($context['use_graphic_library'])
            echo '
                            <td colspan="2"><img src="', $context['verificiation_image_href'], '" alt="', $txt['visual_verification_description'], '" id="verificiation_image" /></td>';
        else
            echo '
                            <td colspan="2"><img src="', $context['verificiation_image_href'], ';letter=1" alt="', $txt['visual_verification_description'], '" id="verificiation_image_1" />
                            <img src="', $context['verificiation_image_href'], ';letter=2" alt="', $txt['visual_verification_description'], '" id="verificiation_image_2" />
                            <img src="', $context['verificiation_image_href'], ';letter=3" alt="', $txt['visual_verification_description'], '" id="verificiation_image_3" />
                            <img src="', $context['verificiation_image_href'], ';letter=4" alt="', $txt['visual_verification_description'], '" id="verificiation_image_4" />
                            <img src="', $context['verificiation_image_href'], ';letter=5" alt="', $txt['visual_verification_description'], '" id="verificiation_image_5" /></td>';
        echo '
</tr>
<tr>
                            <td class="smalltext" colspan="2">
<a href="', $context['verificiation_image_href'], ';sound" onclick="return reqWin(this.href, 400, 120);">', $txt['visual_verification_sound'], '</a>
</td>
</tr>';
    }
echo'
                    <tr>
                        <td colspan="2" align="center"><input type="submit" value="OK" /></td>
                    </tr>
                </table>
        </form>
    </div>';
}
else
return false;
}


Thank's a lot if someone can help me !

Kindred

well, you really need to provide more information....

"it doesn't work" is useless as a description of a problem.

WHAT doesn't work?
HOW does it not work?

What IS being displayed?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

rameleu

Hello,
So it displays me the register form, but won't let me register. I have no error or anything. When I try to register, I click the OK button, and it sends me back to my login page, but no account were created...

Kindred

Oh...  I just realized that ssi_register is not actually a function.  That is something you built...



given that I don't see any database calls in there at all -- how did you expect the information to get from the form into your smf database?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

rameleu

Well that's why I'm asking, I knew there was somewhere to put SQL requests or something, but I can't find them in the original files, so I can't go further :(

Kindred

which original files?   Are you taking this out of the TEMPLATE?   remember, functionality is separated from display in the forum.

also -- I am fairly certain that there is a specific reason that registration was never built as an SSI function
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

rameleu

Hmmm okay, I see what you mean, but I really need to create an external register page, or if you want, I need to change the design from one I've already created. Do you think it's possible ? I want people not to see what the forum looks like BEFORE having an account...

rameleu


Advertisement: