Allright, I've been running vqregister for quite a while, and I've wanted to add a 'Secret Word' so users could re-request their email password. Obviously, the database functions should take care of that.
Not on my system :( I think what it all came down to was my version of MySQL. I think the db functions for MySQL were done on an older version than I have, and my version is just pickier. Anyways, I attached a full patch that does everything but link db_mysql.* -> db_*. I don't know what parts or even if you want it, but the biggest issue was the MySQL insert. Apparently my versions (I've upgraded since first trying), require the column names before the values. So I added that to db_mysql.c, and that's reflected in the first part of the patch. Have Fun! Rick
diff -u vqregister-2.6/db_mysql.c vqregister-2.61/db_mysql.c --- vqregister-2.6/db_mysql.c Thu Mar 8 06:11:54 2001 +++ vqregister-2.61/db_mysql.c Tue Feb 18 10:46:25 2003 @@ -44,7 +44,7 @@ { int ret = 0, n = 0; char *query = NULL; - + char *printme; /* Gather up combined length of fields, and number of fields. @@ -62,14 +62,27 @@ ret += strlen(db_name); ret += 23; /* "INSERT INTO " " VALUES (" ")" */ - + /* Needs to be "INSERT INTO " " (col1, col2) VALUES (" ")" */ query = (char *)malloc(ret); if (query == NULL) return DB_E_MEM; memset((char *)query, 0, ret); - snprintf(query, ret, "INSERT INTO %s VALUES (", tname); + snprintf(query, ret, "INSERT INTO %s (", tname); + + for (n = 0; nfields[n]; n++) { +// strncat(query, "", ret); + strncat(query, nfields[n], ret); + + if (!fields[n + 1]) + strncat(query, ")", ret); + else + strncat(query, ",", ret); + } + + strncat(query, " VALUES (",ret); + for (n = 0; fields[n]; n++) { strncat(query, "'", ret); @@ -81,13 +94,15 @@ strncat(query, "',", ret); } + +// global_error(query,0,0); ret = mysql_real_query(&mysql, query, strlen(query)); free(query); if (ret) { - global_error("Database query failed", 0, 0); - exit(1); + global_error("Database query failed", 0, 0); + exit(1); } return DB_E_SUCCESS; Common subdirectories: vqregister-2.6/html and vqregister-2.61/html diff -u vqregister-2.6/register.c vqregister-2.61/register.c --- vqregister-2.6/register.c Fri Mar 16 07:19:39 2001 +++ vqregister-2.61/register.c Tue Feb 18 10:46:30 2003 @@ -10,7 +10,7 @@ extern int password_len; extern char verify, *redirect, *password, allowpassword, advertise; char *dom = NULL, *user = NULL, *fname = NULL, *cemail = NULL, *pass = NULL, - *vpass = NULL; + *vpass = NULL, *sword=NULL; void go_register(void) { @@ -21,20 +21,21 @@ fname = cgi_is_var("fname"); user = cgi_is_var("user"); cemail = cgi_is_var("cemail"); + sword = cgi_is_var("secretword"); if ((!dom) || (!user) || (!fname)) - global_error("Misconfigured templates.", 0, 0); + global_error("Misconfigured templates Error 1.", 0, 0); if (!allowpassword) { if (!cemail) - global_error("Misconfigured templates.", 0, 0); + global_error("Misconfigured templates Error 2.", 0, 0); } else { pass = cgi_is_var("pass"); vpass = cgi_is_var("vpass"); if ((!pass) || (!vpass)) - global_error("Misconfigured templates.", 0, 0); + global_error("Missing 1st password or Verify Password.", 0, 0); } if (!allowpassword) { @@ -67,13 +68,15 @@ if (*fname) global_par("RN", fname); + if (*sword) + global_par("RS", sword); /* Always do this, because cemail can be optional. */ if (cemail) global_par("CE", cemail); - if ((!(*dom)) || (!(*user)) || (!(*fname))) { + if ((!(*dom)) || (!(*user)) || (!(*fname)) || (!(*sword))) { global_warning("Please fill in all fields."); if (allowpassword)diff -u vqregister-2.6/vqregister.conf vqregister-2.61/vqregister.conf --- vqregister-2.6/vqregister.conf Fri Mar 16 07:22:44 2001 +++ vqregister-2.61/vqregister.conf Tue Feb 18 10:46:54 2003 @@ -185,7 +185,7 @@ # Syntax: DB_Fields <table> <field>[,<field>[,<etc>]] # -DB_Fields user_info user,dom,pass,cemail,fname +DB_Fields user_info user,dom,pass,cemail,fname,secretword # ADVERTISE # diff -u vqregister-2.6/vqregister.email vqregister-2.61/vqregister.email --- vqregister-2.6/vqregister.email Mon Mar 5 07:48:16 2001 +++ vqregister-2.61/vqregister.email Tue Feb 18 10:47:16 2003 @@ -11,4 +11,6 @@ Please do not respond to this message, as it has been generated by an unattended mail box. +Your Secret Recovery Word is: $-RS. + Send all email inquiries to the administrator at $-CA.