|
AbleDesign
|
| View previous topic :: View next topic |
| Author |
Message |
gracebarreiros Lurker

Joined: 04 Dec 2009 Posts: 8
|
Posted: Mon Dec 07, 2009 11:55 pm Post subject: additional fields and confirmation email stopped working |
|
|
Hi Dan,
I came a long way but still need your precious help.
1) I added two fields: "Occupation" and "Social Security Number" to the database, config.php, and language files. So, the form now, shows my two additional fields, but after that, when I tested it, it is not really working. The user is not added to the database, and does not get the confirmation email. I tried several times.
It was working before.
Although there was a little problem: after clicking on the confirmation link, the redirect page showed an error message saying that something was "missing".
2) I need to insert those additional fields to the admin email notification too. How can I do that?
3) I need to validate the social security number (In Brazil it is called CNPJ) I have a function for that:
function ValidarCNPJ(cnpj: int[14]) -> bool
var v: int[2]
//Nota: Calcula o primeiro d |
|
| Back to top |
|
 |
Dan Admin / Developer

Joined: 19 Feb 2001 Posts: 2039
|
Posted: Tue Dec 08, 2009 1:19 am Post subject: |
|
|
1) Is there any error message? Did you update the defined constants (i.e. USERNAME_ROW) below the $db_users array in config.php to match your new order?
2) Which email are you putting them in, the account signup or download notification? One is in create_account.php (routes through lib.php), while the other is in download.php.
3) I would put it in lib.php near the username/password/email validation routines, down toward the bottom. Call it with an if(true) type check.
4) The easiest way would probably be to simply turn off the user authorizations. Make sure you require admin approval of new accounts, then.
Cheers,
Dan |
|
| Back to top |
|
 |
gracebarreiros Lurker

Joined: 04 Dec 2009 Posts: 8
|
Posted: Tue Dec 08, 2009 2:16 pm Post subject: |
|
|
| Dan wrote: | | 1) Is there any error message? Did you update the defined constants (i.e. USERNAME_ROW) below the $db_users array in config.php to match your new order? |
Yes, Dan, I did, here it is the code in config.php
$db_users = array (
"0" => array ("ID", $LANG['id'], init("id"), "35", "15", "id", "", "", "=", "1", ""),
"1" => array ("Full_Name", $LANG['full_name'], init("name"), "35", "55", "name", "", "", "LIKE", "", ""),
"2" => array ("Atividade_principal", $LANG['atividade_principal'], $atividade, "50", "75", "atividade_principal", "", "", "LIKE", "", ""),
"3" => array ("CPF_CNPJ", $LANG['cpf_cnpj'], $cnpj, "14", "14", "cnpj", "", "", "LIKE", "", ""),
"4" => array ("Email", $LANG['email'], init("email"), "35", "75", "email", "", "", "LIKE", "", ""),
"5" => array ("Username", $LANG['username'], init("username"), "35", "55", "username", "", "", "LIKE", "", ""),
"6" => array ("Password", $LANG['password'], init("password"), "35", "32", "password", "", "", "md5", "", ""),
"7" => array ("Pswd_Hint_ID", "Security Question *", init("pswd_hint_id"), "select", "1", "pswd_hint_id", "", "", "", "", ""),
"8" => array ("Pswd_Hint", "Security Answer *", init("pswd_hint"), "35", "75", "pswd_hint", "", "", "", "", ""),
"9" => array ("Date_Added", $LANG['date_added'], init("dateadded"), "DATE", "15", "dateadded", "", "", "=", "1", ""),
"10" => array ("Credits", $LANG['credits'], init("credits"), "35", "15", "credits", "0", "", "=", "1", "3"),
"11" => array ("confirm_hash", $LANG['confirm_hash'], init("confirm_hash"), "35", "55", "confirm_hash", "", "", "=", "1", ""),
"12" => array ("is_confirmed", $LANG['confirmed'], init("is_confirmed"), "select", "1", "is_confirmed", "1", "", "=", "1", "")
);
define ("FULLNAME_ROW", 1);
define ("ATIVIDADE_PRINCIPAL", 2);
define ("CPF_CNPJ", 3);
define ("EMAIL_ROW", 4);
define ("USERNAME_ROW", 5);
define ("PASSWORD_ROW", 6);
define ("PSWD_HINT_ID_ROW", 7);
define ("PSWD_HINT_ROW", ;
define ("DATE_ROW", 9);
define ("CREDITS_ROW", 10);
define ("HASH_ROW", 11);
define ("CONFIRM_ROW", 12);
| Dan wrote: | | 2) Which email are you putting them in, the account signup or download notification? One is in create_account.php (routes through lib.php), while the other is in download.php. |
I added to the download.php
(start in line 59)
// comment out the following lines if you DO NOT care for the Full Name/Email to show up in download notifications
$user_query = "SELECT ". $db_users[FULLNAME_ROW][0] .", ". $db_users[EMAIL_ROW][0] .", ". $db_users[ATIVIDADE_PRINCIPAL_ROW][0] .", ". $db_users[CPF_CNPJ_ROW][0] ." FROM ". $TBL['users'] ." WHERE ID = '$user_id'";
$user_result = mysql_query($user_query);
if (!$user_result) {
echo "<p>". $LANG['db_error_msg'] .": ". mysql_error() ."</p>";
} else {
while ($user_row = mysql_fetch_array($user_result)) {
$full_name = $user_row[$db_users[FULLNAME_ROW][0]];
$atividade = $user_row[$db_users[ATIVIDADE_PRINCIPAL_ROW][0]];
$cnpj = $user_row[$db_users[CPF_CNPJ_ROW][0]];
$email = $user_row[$db_users[EMAIL_ROW][0]];
}
}
and then on line 272
$ip = get_IP();
if ($CFG['download_notification'] == "on") {
// format time/date as: 'Thursday, January 21, 2000, 12:34:48 PM'
$current_time = strftime("%A, %B %d, %Y %I:%M:%S %p",time() + $tz_adjust);
$message = "$filename was downloaded by:\n";
$message .= $LANG['user'] .": $username (user #$user_id)\n";
$message .= $LANG['full_name'] .": $full_name\n";
$message .= $LANG['email'] .": $email\n\n";
$message .= $LANG['atividade_principal'] .": $atividade_principal\n";
$message .= $LANG['cpf_cnpj'] .": $cpf_cnpj\n";
$message .= "$current_time\n";
$message .= "from IP Address: $ip\n\n";
$message .= "$dir_url";
mail($CFG['admin_email'], "$filename Downloaded by $username", "$message", "From: <". $CFG['admin_email'] .">");
}
The fields were added to the notification email but not the user data.
| Dan wrote: | | 3) I would put it in lib.php near the username/password/email validation routines, down toward the bottom. Call it with an if(true) type check. |
I tried but I got an error (something to do with special characters and utf-
| Dan wrote: | | 4) The easiest way would probably be to simply turn off the user authorizations. Make sure you require admin approval of new accounts, then. |
Can I do that via your script interface or do I have to do that via code?
Thanks again. |
|
| Back to top |
|
 |
Dan Admin / Developer

Joined: 19 Feb 2001 Posts: 2039
|
Posted: Tue Dec 08, 2009 10:54 pm Post subject: |
|
|
1) I don't see anything wrong... My only suggestion at that point would be trial and error testing to see where the data is going at each stage of the submission, but since it's on your local server, there isn't much I can do to help there.
2) "The fields were added to the notification email but not the user data."
I'm not sure I follow what you mean there. Are you saying: a) it's working fine, b) the fields were added to the notification email but not to the user data, or c) the fields were added to the notification email but the user data wasn't? Too many ways to read that...
3) I haven't worked with that character set, so your guess is better than mine. If you entered stuff exactly as it appears above in the first forum post, then you don't have proper PHP syntax. The variables/arrays all need to begin with a dollar sign, for starters.
4) Yes, you can set that in the online settable variables in the admin footer dropdown.
Cheers,
Dan |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|