Custom register form

Started by AoD990, December 16, 2010, 03:15:50 PM

Previous topic - Next topic

AoD990

Hey all,

I just want to know is there any goo code so I can implement it in my website so I can register on my forum from my website...

I searched and I couldn't find it anywhere :(

Baby Daisy

While it may not be the solution you want, you can require a function that lets users login/logout as well as click a link to register from an exterior page using functions from the SSI file.

<?php
require_once('/location/to/SSI.php');

echo
'html of your page and whatever';

ssi_login();

?>


For more information see the following documents regarding SSI and PHP integration:

How do I integrate SMF into my PHP coded website?
SSI Readme
あなたは私のお尻にキスするとき、私はそれを愛する

AoD990

I want to make my own validation of input text and then send it to script which will process that data and put it into DB...

Baby Daisy

Well just look at the HTML source of your register page and recreate it in a PHP document, and clean/process all the variables on a $_GET and $_POST level before it is sent to the ?action=register2 page.

あなたは私のお尻にキスするとき、私はそれを愛する

AoD990

Yeah but in what format should I send it?

Examples would be very nice :)

Baby Daisy

Here's an example (note it's just an example, I haven't looked at the exact form names).

New file called new-register.php, contains:

<?php
require_once('SSI.php');

if (empty(
$context['user']['is_logged']))
{
     
// Display the form
     
register_user_form();

     
// If we're going... then go
   
if (isset($_GET['goto']) && !empty($_POST))
       
register_user();
}
else
     
ssi_login();

funtion register_user_form()
{
     global
$context, $scripturl;

     
// Partial pieces of the form. You need to continue this etc
     
echo '<form action=";goto" method="post" accept-charset="UTF-8" name="registration" id="registration" onsubmit="return verifyAgree(true);">
          Username: <input name="user" type="text" value="" />
     </form>'
;
}

function
register_user()
{
    global
$context, $scripturl;

   
$username = ''; // empty by default

    // Here you can manipulate the things through $_POST such as the username;
   
if (!empty($_POST['user']))
     
$username = htmlspecialchars($_POST['user']);

 
// And then at the end send it all to the register form,
 
redirectexit($scripturl . '?action=register2');
}

?>


In theory at least, I'm not sure if redirectexit() will drop $_POST (pretty sure it won't), so play around with it.
あなたは私のお尻にキスするとき、私はそれを愛する

Kindred

Сл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."

AoD990


Advertisement: