vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Userid not generated automatically (https://vborg.vbsupport.ru/showthread.php?t=61754)

TECK 02-22-2004 12:49 AM

Userid not generated automatically
 
Hi guys,
I'm trying to mod VB3 in a different way, I don't want to generate automatically an userid... instead I want to give the choice to the user to select his(her) userid.
Why? Is really simple, I want to replace the userid with an alphanumeric serial of numbers (employee number).
So, if I work for a company, I will have my unique employee number as userid, for example A50021, my username and my password.

Now, what type will become the "userid" field?
Changing the actual php code should be really easy, to let the user enter his(her) id:
Code:

print_input_row('<b>User ID</b>', 'userid', '');
$DB_site->query("
  INSERT INTO " . TABLE_PREFIX . "user
    (userid, username, ...
  VALUES
    ('" . intval($_POST['userid']) . "', '" . addslashes($_POST['username']) . "', ...
 
$userid = intval($_POST['userid']);

I tried the code above and if I look in the USER table, it defaults still the userid 1, instead of the alphanumeric value.
Let me know what I should change in the table... Thanks guys.

Scott MacVicar 02-22-2004 12:53 AM

Quote:

Originally Posted by TECK
Hi guys,
I'm trying to mod VB3 in a different way, I don't want to generate automatically an userid... instead I want to give the choice to the user to select his(her) userid.
Why? Is really simple, I want to replace the userid with an alphanumeric serial of numbers (employee number).
So, if I work for a company, I will have my unique employee number as userid, for example A50021, my username and my password.

Now, what type will become the "userid" field?
Changing the actual php code should be really easy, to let the user enter his(her) id:
Code:

print_input_row('<b>User ID</b>', 'userid', '');
$DB_site->query("
  INSERT INTO " . TABLE_PREFIX . "user
    (userid, username, ...
  VALUES
    ('" . intval($_POST['userid']) . "', '" . addslashes($_POST['username']) . "', ...
 
$userid = intval($_POST['userid']);

I tried the code above and if I look in the USER table, it defaults still the userid 1, instead of the alphanumeric value.
Let me know what I should change in the table... Thanks guys.

Its probably the intval thats doing it.

Personally I'd add another column like EmployeeID and reference it where appropriate rather than attempt to modify the userid since there are intvals done everywhere to sanatize the data.

TECK 02-22-2004 02:40 AM

Thanks Scott, is a good idea.
I will post here the results, once I test more in this direction...
What type of field should I use for alphanumeric chars? The text one?

Natch 02-22-2004 03:50 AM

I would suggest VARCHAR(length.of.Employeeid) ...

TECK 02-22-2004 10:19 PM

Thanks guys. ;)


All times are GMT. The time now is 12:35 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.01120 seconds
  • Memory Usage 1,721KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete