vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Quick Registration Form on a non-vB page (https://vborg.vbsupport.ru/showthread.php?t=53070)

Gary King 05-17-2003 10:00 PM

Quick Registration Form on a non-vB page
 
Requested Here: https://vborg.vbsupport.ru/showthrea...954#post394954

What does this hack do?
  • It allows people to register at your website (to your vBulletin board) on a non-vBulletin page
  • It provides a much quick method of registration, compared to the usual way
  • only Guests can see this registration form. If the user is already registered, then he/she will see a message instead, such as Welcome back Gary!

Bugs
Found a bug? Please reply back and let me know!

Instructions
Be sure to place the attached code wherever you want the quick registration form to show up.

Enjoy!

Gary King 05-18-2003 01:21 PM

Hack is now complete, enjoy!

Chris M 05-18-2003 02:49 PM

Hmm...

Nice idea, but I'm not too keen on this:

PHP Code:

mysql_query

idea...

IMO:
PHP Code:

$DB_site->query

is better;)

and:

PHP Code:

if ($redirect=="yes") { 

should be
PHP Code:

if ($_GET['redirect']=="yes") { 

:)

Satan

Franki 05-18-2003 03:33 PM

It seems to work fine Gary! I tested it.
Very useful hack.

Gary King 05-18-2003 03:46 PM

Quote:

Today at 11:49 AM hellsatan said this in Post #3
Hmm...

Nice idea, but I'm not too keen on this:

PHP Code:

mysql_query

idea...

IMO:
PHP Code:

$DB_site->query

is better;)

and:

PHP Code:

if ($redirect=="yes") { 

should be
PHP Code:

if ($_GET['redirect']=="yes") { 

:)

Satan

For
PHP Code:

$DB_site->query(); 

, I'd either have to define the class and create the object for it, or include /forum/global.php

The way I've done it is good enough, in my opinion.

Chris M 05-18-2003 04:15 PM

Ok;)

To me it made more sense, but each to his own;)

Satan

Nebby 06-02-2003 01:16 AM

I'll be installing this now :D

Perfect for what i want ^^

Nebby 06-02-2003 01:19 AM

EDIT: NM, i tested it, it just goes back to quickreg.php

WEForums 06-02-2003 02:28 AM

Just curious. Is it possible to do this without it being on the same domain? I know you can do logins this way so I was curious if it's possible to do this as well.

Gary King 06-02-2003 07:04 PM

Quote:

Yesterday at 11:28 PM WEForums said this in Post #9
Just curious. Is it possible to do this without it being on the same domain? I know you can do logins this way so I was curious if it's possible to do this as well.
Yes, it is. Some minor modifications would have to be made to the file, though. For example, the config.php variables would not be accessible, so you would have to add those manually.

Gary King 06-02-2003 07:05 PM

Quote:

Yesterday at 10:19 PM Nebby said this in Post #8
EDIT: NM, i tested it, it just goes back to quickreg.php
Where would you want it to go?

WEForums 06-02-2003 11:20 PM

Quote:

Yesterday at 09:04 PM Gary W said this in Post #10
Yes, it is. Some minor modifications would have to be made to the file, though. For example, the config.php variables would not be accessible, so you would have to add those manually.
To be clear, PHP files would be necessary for this hack to work? Or could it be done via HTML only? The website uses .shtml extensions is why I ask, and there isn't any PHP files on it. Don't really want to add any. ;)

Gary King 06-02-2003 11:29 PM

The PHP file that processes the registration could be located somewhere else, just as long as the HTML file has access to it.

WEForums 06-02-2003 11:36 PM

Could you give me an example? Sorry to bug you but I don't exactly have the greatest of knowledge of this stuff, and it seems you know a LOT about this. (Been viewing a lot of your posts/threads.) ;)

Gary King 06-02-2003 11:41 PM

Maybe the PHP file is accessible via FTP, or on the same server.

P.S.
Why not simply place the PHP file that processes the script, in the same directory as the HTML file, if you don't want to use a PHP file for the quick registration page?

WEForums 06-02-2003 11:50 PM

Quote:

Today at 01:41 AM Gary W said this in Post #15
Maybe the PHP file is accessible via FTP, or on the same server.
I am sure they're on the same server but just a separate domain. (I do not 'own' the site, I just run the forums.)

Quote:

Today at 01:41 AM Gary W said this in Post #15
P.S.
Why not simply place the PHP file that processes the script, in the same directory as the HTML file, if you don't want to use a PHP file for the quick registration page?

Wouldn't you still have to click onto another page? I simply would like the quick registration to be on the page rather than it having its very own page. You know, having the form on the HTML page?

The only reason for this is the site receives about 15,000-25,000 unqiue hits per day. The forums have 22,000-some odd members, but we're really looking to expand even more.

Gary King 06-02-2003 11:57 PM

Yes, you can have the form on the HTML page. So, you do not wish to have the form on a .PHP page? That is not at all possible? (May I ask why not?)

You can simply have the PHP file process the actual registration, while the HTML only "tells" the PHP page to register the user.

WEForums 06-03-2003 12:04 AM

So you could use HTML to "call" for the script's form, correct? And the script could be on a separate domain as well, right?

If so, would you find giving an example of the HTML? I have no experience working with forms... : (

Gary King 06-03-2003 12:21 AM

As long as the PHP script is accessible by the HTML file.

Example that you could use:

HTML file

PHP Code:

<form action='quickreg.php' method='post'>
Username: <input type='text' name='username'>
<
br>Password: <input type='password' name='password'>
<
br>Email: <input type='text' name='email'>
<
br><input type='submit' name='submit' value='Submit' accesskey='s'
<
input type='reset' name='reset' value='Reset' accesskey='r'>
</
form

PHP file (name it quickreg.php, otherwise you must change the action='' in the HTML file to whatever this file is called)

PHP Code:

<?php

////////////////////////////////////////////////////////////////////////////////////////////
// VARIABLES
// $config = relative path to your vBulletin's /admin/config.php (must be on same server)
// $groupid = user group ID for people who register using this form
// $redirect = leave it as "yes" if you want to redirect the user to the vBulletin after he/she registers
////////////////////////////////////////////////////////////////////////////////////////////

// board information
$config="forum/admin/config.php";
$groupid="2";
$redirect="yes";

///////////////////////////////////////////////////////////////////////////
// DO NOT MODIFY ANYTHING BELOW HERE 
// UNLESS YOU KNOW WHAT YOU ARE DOING
///////////////////////////////////////////////////////////////////////////

$config=strtolower($config);
require(
$config);

$connect=mysql_connect($servername,$dbusername,$dbpassword);
mysql_select_db($dbname);

if (
$submit) {
    
$unique=mysql_query("SELECT username FROM user WHERE username='$username'");
        
$user=mysql_query("INSERT INTO user (usergroupid, username, password, email, joindate, 
        lastvisit, lastactivity) VALUES ('"
.$groupid."', '".htmlspecialchars(addslashes($username)).
        
"', '".addslashes(md5($password))."', 
        '"
.addslashes(htmlspecialchars($email))."', '".time()."', '".time()."', '".time()."')",$connect);
        
$userid=mysql_insert_id();
        
$userfields=mysql_query("INSERT INTO userfield (userid) VALUES ($userid)");
        if ((
$user==TRUE) and ($userid==TRUE) and ($userfields==TRUE)) {
            
header("Location: index.html");
        }
        if (
$redirect=="yes") {
            
$board=str_replace("admin/config.php","index.php",$config);
            print 
"<meta http-equiv='refresh' content='0;URL=".$board."'>";
        }
    
mysql_close($connect);
    }
}

?>

Try that, tell me if it works. I simply modified some things from the original code.

WEForums 06-03-2003 12:29 AM

I got a parse error.

http://www.weforums.com/quickreg3.php

Only thing I changed was...

forum/admin/config.php

to

forums/admin/config.php

Gary King 06-03-2003 12:34 AM

Try the attached file.

WEForums 06-03-2003 12:40 AM

http://www.weforums.com/quickreg2.php

http://www.weforums.com/quickreg3.php (blank...?)

Strange, the attached file is 3, but 2 is the original file (first post in the thread).

WEForums 06-03-2003 12:44 AM

I got it to work. Thanks a lot! :)

Gary King 06-03-2003 12:47 AM

<a href="http://www.weforums.com/quickreg3.php" target="_blank">http://www.weforums.com/quickreg3.php</a> is blank because it doesn't output anything, it only processes the registration.

And no problem, glad you got it working. Also, please click on the Install button if you are keeping this hack, thanks!

WEForums 06-03-2003 12:49 AM

Quote:

Today at 02:47 AM Gary W said this in Post #24
And no problem, glad you got it working. Also, please click on the Install button if you are keeping this hack, thanks!
Oops, I try to remember to click them all, but sometimes I forget. Thanks for reminding me, and done. :)

Nebby 06-03-2003 07:38 PM

Quote:

Yesterday at 09:05 PM Gary W said this in Post #11
Where would you want it to go?


i wanted it to go to my site index page, but i'd edited it so it does that now.

Gary King 06-03-2003 07:40 PM

Alright.

Elvis 06-08-2003 12:12 AM

Any idea how to set the new user to require email confirmation, and also set them to be put in the moderated group once they validate the email address?

M4g!k 06-20-2003 06:35 AM

Warning: main(forum/admin/config.php) [function.main]: failed to create stream: No such file or directory in /home/indeathw/public_html/regester.php on line 21

Fatal error: main() [function.main]: Failed opening required 'forum/admin/config.php' (include_path='.:/usr/local/lib/php') in /home/indeathw/public_html/regester.php on line 21

-that's what i get. All i dont was installed it and link to it. is there more i must do?

Gary King 06-20-2003 12:30 PM

Quote:

Today at 03:35 AM M4g!k said this in Post #29
Warning: main(forum/admin/config.php) [function.main]: failed to create stream: No such file or directory in /home/indeathw/public_html/regester.php on line 21

Fatal error: main() [function.main]: Failed opening required 'forum/admin/config.php' (include_path='.:/usr/local/lib/php') in /home/indeathw/public_html/regester.php on line 21

-that's what i get. All i dont was installed it and link to it. is there more i must do?

You must place the correct path for $config - you have an incorrect path.

gmarik 06-20-2003 02:56 PM

Nice, nice. Does it
works on 2.3 now?

Gary King 06-20-2003 04:24 PM

Quote:

Today at 11:56 AM gmarik said this in Post #31
Nice, nice. Does it
works on 2.3 now?

It always did :)

evildj 07-01-2003 05:08 AM

Its a decent hack.
How about the cookie though, so when they go the forum page they don't have to login?

Thanks, DJ

themonarch 08-30-2003 08:16 AM

Beauty hack! I changed the redirection to go to a webpage that will link to a credit card processing thing, to enable registration with payment.

Bobbo 11-20-2003 12:49 AM

Great hack. Many thanks!

This one has great potential for my site. One thing that I've been trying to figure out is how to have my form populate a custom userfield on Submit in addition to the basic registration.

Could someone please give me some direction on the code for the proper insert to add data to for example my field6 custom field? Ideally, I would add a radio check box on the form for different divisions of a company, so when a user enters their name, pass, and e-mail, they would also pick a division which would add the info to the custom field.

Any help is greatly appreciated.

Bob

BlackxRam 12-17-2003 02:42 AM

This is a nice addition very simple, but it should atleast try to prevent automated registrations, or check to see if the user already has an account... i can goto this page if im registered and just keep registering new names.. need to prevent AUTOMATED registrations and the loss of registration checks. Can this be implemented?

Gary King 12-17-2003 11:20 AM

Thanks for bringing this to my attention, I've fixed it so that only Guests can see this registration form now, instead of everyone. If the user is already registered, then he/she will see a message instead, such as Welcome back Gary! :)

bandit022 12-19-2003 08:04 PM

so does the form have to be placed on a php page in order for it to only show up to gets, and the welcome text show up to members???

i have tested it on my index.html and the form shows up to everyone. the form iteself works great, i just don't want it showing up to everyone.

-jeff

Gary King 12-19-2003 08:27 PM

Yeah, it will only work on a PHP page because it uses PHP functions.

9baller 02-11-2004 12:31 PM

Will this work for vB3?


All times are GMT. The time now is 06:08 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01593 seconds
  • Memory Usage 1,854KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (11)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete