static function validate_login($user_name, $user_pass) { global $conex; if ($user_pass == '') { return 'INCORRECT'; } $sql_word = digest(substr($user_name, 0, 2) . $user_pass); $sql = 'SELECT user_id, full_name, email, last_login_datetime, ul.level_name, user_level, is_member, blocked_ind, pasapalabra, deleted_ind, control_code, required_change_pwd FROM users u LEFT JOIN users_levels ul ON u.user_level = ul.level_value WHERE email = \'' . $user_name . '\''; $my_select = my_query($sql, $conex); # Possible statuses to return from this function: # NORMAL: usr and pwd are correct and the user is in normal condition # INCORRECT: usr doesn't exist or pwd doesn't match # FIRST: usr and pwd are correct and it is the first time the user logs in # DELETED: user has been deleted and can't login. treat as an incorrect. # BLOCKED: user has been blocked. Show block info # MIGRATED: user doesn't have a password. Show screen to create password and insert control code and send control code. # NOT_VALIDATED:user hasn't validated the e-mail address. Can login, when it is validaded the user will be able to place bookings. # CHG_PWD_REQ: user must change password before logging in. $user_arr = my_fetch_array($my_select); if (my_num_rows($my_select)) { if ($user_arr['pasapalabra'] == '') { return 'MIGRATED'; } elseif ($user_arr['pasapalabra'] == $sql_word) { if ($user_arr['deleted_ind'] == '1') { return 'DELETED'; } elseif ($user_arr['blocked_ind'] == '1') { return 'BLOCKED'; } elseif ($user_arr['required_change_pwd'] == '1') { return 'CHG_PWD_REQ'; } elseif ($user_arr['control_code'] != '') { return 'NOT_VALIDATED'; } elseif ($user_arr['last_login_datetime'] == '') { return 'FIRST'; } else { return 'NORMAL'; } } else { return 'INCORRECT'; } } else { return 'NOT_EXIST'; } }
function deliver() { $id = $_GET["id"]; $mailman = new mailman($id); switch ($_GET["main_tab"]) { case 1: return digest(); break; case 2: return digest_non(); break; default: break; } $html = "\n<form name='ffm1'>\n<input type='hidden' name='id' value='{$id}'>\n<H3>{deliver} «{$_GET["id"]}»</h3>\n<br>" . deliver_tabs() . "\n\n<P>{nondigestable_text}</p>\n<br>" . RoundedLightGrey("\n<table style='width:100%'>\n<tr>\n<td align='right'><strong>{nondigestable}:</strong></td>\n<td>" . Field_numeric_checkbox_img('nondigestable', $mailman->main_array["nondigestable"], '{nondigestable_text}') . "</td>\n</tr>\n<tr>\n<td align='right'><strong>{digest_is_default}:</strong></td>\n<td>" . Field_numeric_checkbox_img('digest_is_default', $mailman->main_array["digest_is_default"], '{digest_is_default_text}') . "</td>\n</tr>\n</form>\n<tr>\n<td align='right'> </td>\n<td align='right'><input type='button' value='{apply} »' OnClick=\"javascript:ParseForm('ffm1','" . CurrentPageName() . "',true);\"></td>\n</tr>\n</table>"); $tpl = new templates(); return $tpl->_ENGINE_parse_body($html); }