Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Need some help with code to use Details »»
Need some help with code to use
Version: , by Parker Clack Parker Clack is offline
Developer Last Online: Nov 2013 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 05-29-2002 Last Update: Never Installs: 0
 
No support by the author.

In the register.php file it will check to see if a username is already taken and not allow a person to sign up if it is already in use.

Instead of just removing all the usernames that haven't posted on the forum for a long time or never posted I created another usergroup to move those members into that area.

What I want to be able to do though is not include those members in that usergroup with the username check that the script uses.

In register.php the script uses

if ($checkuser=$DB_site->query_first("SELECT username FROM user WHERE username='".addslashes(htmlspecialchars($username) )."' OR username='".addslashes(eregi_replace("[^A-Za-z0-9]","",$username))."'")) {
eval("standarderror(\"".gettemplate("error_usernam etaken")."\");");
exit;
}

How would I need to rewrite this so that if the usergroupid=14 (this is the number of the usergroupid that I have assigned to this new area) then it skips the error_usernametaken template?

Thanks in advance for any suggestions.

Parker

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 05-29-2002, 09:33 AM
Darren Lewis Darren Lewis is offline
 
Join Date: Mar 2002
Location: England
Posts: 144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Parker,

Will this work (I'm only in the learning stages of writing PHP)?

PHP Code:
  if ($checkuser=$DB_site->query_first("SELECT username, usergroupid FROM user WHERE username='".addslashes(htmlspecialchars($username))."' OR username='".addslashes(eregi_replace("[^A-Za-z0-9]","",$username))."'")) {
    while (
$newvariable1=$DB_site->fetch_array($checkuser))
    {
        
$newvariable2=$newvariable1['usergroupid'];
        if (
$newvariable2 == 14)
        {
            exit;
        }
        else
        {
            eval(
"standarderror(\"".gettemplate("error_usernametaken")."\");");
            exit;
        }
    }

Darren.
Reply With Quote
  #3  
Old 05-29-2002, 09:50 AM
Parker Clack Parker Clack is offline
 
Join Date: Oct 2001
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Darren:

I am not sure either as I do not know PHP code that well myself.

I will give it a shot and see.

Thanks,
Parker
Reply With Quote
  #4  
Old 05-29-2002, 10:09 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This will do the trick:
PHP Code:
if ($checkuser=$DB_site->query_first("SELECT username FROM user WHERE usergroupid<>14 AND (username='".addslashes(htmlspecialchars($username))."' OR username='".addslashes(eregi_replace("[^A-Za-z0-9]","",$username))."')")) { 
14 being that special usergroup's ID.
Reply With Quote
  #5  
Old 05-29-2002, 10:26 AM
Parker Clack Parker Clack is offline
 
Join Date: Oct 2001
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Chen and Darren:

Thanks for the help. I will try this out later today.

Parker
Reply With Quote
  #6  
Old 05-29-2002, 10:33 AM
Parker Clack Parker Clack is offline
 
Join Date: Oct 2001
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks guys. I went with Chen's suggestion as its less code. Less confusing for me that way.

Chen what does <> equal? Is that less than or great than?

Parker
Reply With Quote
  #7  
Old 05-29-2002, 11:14 AM
Darren Lewis Darren Lewis is offline
 
Join Date: Mar 2002
Location: England
Posts: 144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I agree, Chen's method is much simpler

<> means not equal and is the same as !=
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:32 PM.


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.04968 seconds
  • Memory Usage 2,260KB
  • Queries Executed 20 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (6)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete