Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

pr_member_create.h

Go to the documentation of this file.
00001 /*
00002  * $Id: pr_member_create.h,v 1.2 2002/12/10 13:38:12 dsamersoff Exp $
00003  *
00004  */
00005 
00006 #ifndef pr_member_create_h 
00007 #define pr_member_create_h 
00008  
00009 #include <dsSPWrapper.h>
00010 #include <pw_generate.h>
00011 
00012            
00013 class pr_member_create : public dsSPWrapper
00014 {
00015 
00016  public:
00017        SQLOUT long member_id;
00018        SQLIN  char first_name[71];
00019        SQLIN  char last_name[71];
00020        SQLIN  char e_mail[130];
00021        SQLIN  char phone[65];
00022        SQLIN  char member_login[31];
00023        SQLIN  char member_password[31];   
00024        SQLIN  char country_tag[5];
00025        SQLIN  char zip_code[31];
00026        SQLIN  char address[257];          
00027        SQLIN  char city[71];          
00028        SQLIN  char state_tag[5];
00029 
00030        SQLIN char signup_key[64];
00031 
00032 
00033     virtual void Dump(ostream& os)
00034     {
00035       os <<  "memeber_id:         '"  << member_id          << "'\n";
00036       os <<  "first_name:         '"  << first_name         << "'\n";
00037       os <<  "last_name:          '"  << last_name          << "'\n";
00038       os <<  "e_mail:             '"  << e_mail             << "'\n";
00039       os <<  "phone:              '"  << phone              << "'\n";
00040       os <<  "member_login:       '"  << member_login       << "'\n";
00041       os <<  "member_password:    '"  << member_password    << "'\n";
00042       os <<  "country_tag:        '"  << country_tag        << "'\n";
00043       os <<  "zip_code:           '"  << zip_code           << "'\n";
00044       os <<  "address:            '"  << address            << "'\n";
00045       os <<  "city:               '"  << city               << "'\n";
00046       os <<  "state_tag:          '"  << state_tag          << "'\n";
00047 
00048       os <<  "signup_key:         '"  << signup_key   << "'\n";
00049     }
00050 
00051     
00052     virtual void Execute(dsOCI *pg)
00053     {
00054         _fl->log(0xFF, "PR_MEMBER_CREATE (%s)", member_login);
00055 
00056         const char *query = "BEGIN PK_SIGNUP.PR_MEMBER_CREATE(:member_id,"\
00057                               ":first_name,:last_name,:e_mail,:phone,"\
00058                               ":member_login,:member_password,:country_tag,:zip_code,"\
00059                               ":address,:city,:state_tag,"\
00060                               ":signup_key); END" );
00061 
00062 
00063          OCIStmt *stmt = pg->PrepareCall(query);
00064 
00065            pg->BindParam(stmt, "member_id",          SQLT_INT, &member_id,          sizeof(member_id)         );
00066            pg->BindParam(stmt, "first_name",         SQLT_STR, first_name,          sizeof(first_name)        );
00067            pg->BindParam(stmt, "last_name",          SQLT_STR, last_name,           sizeof(last_name)         );
00068            pg->BindParam(stmt, "e_mail",             SQLT_STR, e_mail,              sizeof(e_mail)            );
00069            pg->BindParam(stmt, "phone",              SQLT_STR, phone,               sizeof(phone)             );
00070            pg->BindParam(stmt, "member_login",       SQLT_STR, member_login,        sizeof(member_login)      );
00071            pg->BindParam(stmt, "member_password",    SQLT_STR, member_password,     sizeof(member_password)   );
00072            pg->BindParam(stmt, "country_tag",        SQLT_STR, country_tag,         sizeof(country_tag)       );
00073            pg->BindParam(stmt, "zip_code",           SQLT_STR, zip_code,            sizeof(zip_code)          );
00074            pg->BindParam(stmt, "address",            SQLT_STR, address,             sizeof(address)           );
00075            pg->BindParam(stmt, "city",               SQLT_STR, city,                sizeof(city)              );
00076            pg->BindParam(stmt, "state_tag",          SQLT_STR, state_tag,           sizeof(state_tag)         );
00077 
00078            pg->BindParam(stmt, "signup_key",         SQLT_STR,  signup_key,         sizeof(signup_key)        );
00079 
00080 
00081          pg->Execute( stmt, 1, COMMIT_ON_SUCCESS );
00082 
00083          pg->ReleaseCall(stmt);
00084          delete query;
00085     }
00086 
00087     pr_member_create(dsCGI *cgi)
00088     {
00089         website_id         = cgi->geti("website_id");
00090 
00091         size_strcpy(first_name,      cgi->gete("first_name"),      sizeof(first_name)      );
00092         size_strcpy(last_name,       cgi->gete("last_name"),       sizeof(last_name)       );
00093         size_strcpy(e_mail,          cgi->gete("e_mail"),          sizeof(e_mail)          );
00094         size_strcpy(phone,           cgi->get("phone", "N/A"),      sizeof(phone)           );
00095         size_strcpy(member_login,    cgi->gete("member_login"),    sizeof(member_login)    );
00096         
00097         // Password should not be passed throuph cgi: 
00098         //      size_strcpy(member_password, cgi->gete("member_password"), sizeof(member_password) );
00099          size_strcpy(member_password, raw_generate_passwd(), sizeof(member_password) );
00100 
00101         size_strcpy(country_tag,     cgi->gete("country_tag"),    sizeof(country_tag) );
00102         size_strcpy(zip_code,        cgi->get("zip_code","N/A"),   sizeof(zip_code)    );
00103         size_strcpy(address,         cgi->get("address","N/A"),    sizeof(address)     );          
00104         size_strcpy(city,            cgi->get("city","N/A"),       sizeof(city)        );          
00105         size_strcpy(state_tag,       cgi->get("state_tag","N/A"),  sizeof(state_tag)   );
00106 
00107         size_strcpy(signup_key, cgi->gete("key"),        sizeof(signup_key)); 
00108     }
00109 
00110 
00111 };
00112 
00113 #endif

Generated on Mon May 16 18:26:58 2005 for libdms4 by doxygen1.3-rc2