wrote this file. * As long as you retain this notice you can do whatever you want with this * software. If we meet some day, and you think this stuff is worth it, you can * buy me a beer in return. * Sandino Araico Sánchez * --END LICENSE--------------------------------------------------------------- * --LICENCIA EN ESPAÑOL MEXICANO---------------------------------------------- * "LA LICENCIA BEER-WARE" (traducción al español de la revisión 42-sandino-3): * Sandino Araico Sánchez escribió éste archivo. * Siempre y cuando usted retenga éste aviso (en español y en inglés) usted * puede hacer cualquier cosa con éste software. Si algún día nos encontramos y * usted piensa que éste software vale la pena, usted puede invitarme una * cerveza en recompensa. * Sandino Araico Sánchez * --FIN DE LICENCIA----------------------------------------------------------- */ # Changelog: # 2002-01-05 Sandino Araico Sánchez - Unique user authentication if(!defined("__HOPP_UNIQUE_AUTH")) { define ("__HOPP_UNIQUE_AUTH",1); #--------------------------------------------------------------------- include __HOPP_INCLUDE_PATH.'auth/basic-auth.inc'; #--------------------------------------------------------------------- function auth_unique($defid=0) { return auth_basic($defid, 'auth_unique_query'); } function auth_unique_headers() { return auth_basic_headers(); } function auth_unique_headers_send() { return auth_basic_headers_send(); } function auth_unique_retry($defid=0) { return auth_basic_retry($defid, 'auth_unique'); } function auth_unique_query($user, $pw, $defid=0) { $id=hopp_db_connected($defid); $sql="select count(*) from h_auth_unique_user where h_auth_usr_name = '$user' and h_auth_usr_pw = '".md5($pw)."'"; s_log("sql: $sql"); return hopp_db_get_single_field_result($id, $sql); } function auth_unique_query_user($user, $defid=0) { $id=hopp_db_connected($defid); $sql="select count(*) from h_auth_unique_user where h_auth_usr_name = '$user'"; s_log("sql: $sql"); return hopp_db_get_single_field_result($id, $sql); } function auth_unique_insert_user($user, $pw, $defid=0) { $id=hopp_db_connected($defid); $md5pw=md5($pw); $sql="insert into h_auth_unique_user (h_auth_usr_name, h_auth_usr_pw) values ('$user','$md5pw')"; return hopp_db_exec($id, $sql); } function auth_unique_insert_user_data($user, $name, $mail, $title='', $phone='', $defid=0) { $user=rawurlencode(str_replace("'","\'",$user)); $name=rawurlencode(str_replace("'","\'",$name)); $mail=rawurlencode(str_replace("'","\'",$mail)); $title=rawurlencode(str_replace("'","\'",$title)); $title=hopp_db_get_null_value($title); $phone=rawurlencode(str_replace("'","\'",$phone)); $phone=hopp_db_get_null_value($phone); $id=hopp_db_connected($defid); $sql="insert into h_auth_user_data (h_auth_user_data_user,h_auth_user_data_name,h_auth_user_data_mail,h_auth_user_data_title,h_auth_user_data_phone) values ('$user','$name','$mail',$title,$phone)"; return hopp_db_exec($id, $sql); } #--------------------------------------------------------------------- } //__HOPP_UNIQUE_AUTH ?>