Changeset 1181

Show
Ignore:
Timestamp:
02/10/10 08:48:40 (2 years ago)
Author:
Hugo
Message:

ispClient: save commit

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/unxsISP/interfaces/customer/registration.c

    r1180 r1181  
    3535//Local only 
    3636unsigned ValidateRegistrationInput(void); 
    37 void EmailRegistration(char *cTemplateName); 
     37void EmailRegistration(char *cSubject,char *cTemplateName); 
    3838void CommitRegistration(void); 
    3939void CreateTempRegistration(void); 
    4040void GenerateLoginInfo(void); 
     41void CreatetTempClient(void); 
    4142 
    4243//main.c 
     
    9394                   !strcmp(gcFunction,"Envoyer")) 
    9495                { 
     96                        CreatetTempClient(); 
    9597                        if(ValidateRegistrationInput()) 
    9698                        { 
     
    338340 
    339341 
    340 void EmailRegistration(char *cTemplateName) 
     342void EmailRegistration(char *cSubject,char *cTemplateName) 
    341343{ 
    342344        FILE *fp; 
    343345        char cFrom[256]={"root"}; 
    344         char cSubject[256]={""}; 
    345346        struct t_template template; 
    346347        cSubject[255]=0; 
     
    417418 
    418419        LoadRegistration(); 
     420        printf("Content-type: text/plain\n\n"); 
    419421 
    420422        GetConfiguration("uRegistrationCompany",cuCompany); 
     
    431433                        ); 
    432434        mysql_query(&gMysql,gcQuery); 
     435        printf("%s\n",gcQuery); 
    433436        if(mysql_errno(&gMysql)) 
    434437                htmlPlainTextError(mysql_error(&gMysql)); 
    435438        guLoginClient=mysql_insert_id(&gMysql); 
    436439        SetLanguage(); 
     440        printf("guLoginClient=%u\n",guLoginClient); 
    437441 
    438442        GenerateLoginInfo();     
    439443         
    440         EmailRegistration("RegistrationMail1"); 
    441          
     444        EmailRegistration("Your Login Information","RegistrationMail1"); 
     445        printf("%s\n",gcQuery); 
    442446        sprintf(gcQuery,"DELETE FROM tTempClient WHERE cHash='%s'",TextAreaSave(cId)); 
    443447        mysql_query(&gMysql,gcQuery); 
    444         if(mysql_errno(&gMysql)) 
    445                 htmlPlainTextError(mysql_error(&gMysql)); 
    446  
     448        printf("%s\n",gcQuery); 
     449        if(mysql_errno(&gMysql)) 
     450                htmlPlainTextError(mysql_error(&gMysql)); 
    447451        htmlHeader("unxsISP Customer Interface","Header"); 
    448452        htmlRegistrationPage("","RegistrationCompleted.Body"); 
     
    484488        sprintf(cId,"%s",field[0]); 
    485489         
    486         EmailRegistration("RegistrationMail0"); 
     490        EmailRegistration("Please Confirm Your Registration","RegistrationMail0"); 
    487491 
    488492}//void EmailAfterRegistration(void) 
     
    497501        char *cLanguage=""; 
    498502 
    499         CreatetTempClient(); 
    500          
    501503        if(guTemplateSet==2) 
    502504                cLanguage="English"; 
     
    543545        char cGenPassword[100]={""}; 
    544546 
     547        (void)srand((int)time((time_t *)NULL)); 
    545548        to64(&cGenPassword[0],rand(),6); 
    546549        cGenPassword[6]=0; 
     
    551554        sprintf(cUser,"%s.%s",cFirstName,cLastName); 
    552555 
    553         sprintf(gcQuery,"INSERT INTO tAuthorize SET cLabel='%s.%s',cPasswd='%s',uPerm=1,uOwner=%u,uCreatedBy=1,uCreatedDate=UNIX_TIMESTAMP(NOW())", 
     556        sprintf(gcQuery,"INSERT INTO tAuthorize SET cLabel='%s.%s',cPasswd='%s',uPerm=1,uCertClient=%u,uOwner=%s,uCreatedBy=1,uCreatedDate=UNIX_TIMESTAMP(NOW())", 
    554557                        cFirstName 
    555558                        ,cLastName 
    556559                        ,cGenPassword 
    557560                        ,guLoginClient 
     561                        ,cuCompany 
    558562                        ); 
    559563        mysql_query(&gMysql,gcQuery); 
     
    587591 
    588592 
    589 //unxsISP radius integration code 
    590  
    591 void CreateProductInstace(void) 
    592 { 
    593         unsigned uInstance=0; 
    594          
    595         //Insert tInstance record 
    596         sprintf(gcQuery,"INSERT INTO tInstance SET uClient=%u,uProduct=1,cLabel='AstraTurbo',uCreatedBy=1,uOwner='%s',uCreatedDate=UNIX_TIMESTAMP(NOW())", 
    597                         guLoginClient 
    598                         ,cuCompany 
    599                         ); 
    600         mysql_query(&gMysql,gcQuery); 
    601         if(mysql_errno(&gMysql)) 
    602                 htmlPlainTextError(mysql_error(&gMysql)); 
    603  
    604         uInstance=mysql_insert_id(&gMysql);      
    605  
    606         //Insert tClientConfig records 
    607         //radius login 
    608         sprintf(gcQuery,"INSERT INTO tClientConfig SET uGroup=%u,uService=1,uParameter=1," 
    609                         "cValue='%s',uOwner=%u,uCreatedBy=1,uCreatedDate=UNIX_TIMESTAMP(NOW())", 
    610                         uInstance 
    611                         ,cUser 
    612                         ,guLoginClient 
    613                         ); 
    614         mysql_query(&gMysql,gcQuery); 
    615         if(mysql_errno(&gMysql)) 
    616                 htmlPlainTextError(mysql_error(&gMysql)); 
    617  
    618         //radius password 
    619         sprintf(gcQuery,"INSERT INTO tClientConfig SET uGroup=%u,uService=1,uParameter=2," 
    620                         "cValue='%s',uOwner=%u,uCreatedBy=1,uCreatedDate=UNIX_TIMESTAMP(NOW())", 
    621                         uInstance 
    622                         ,cPassword 
    623                         ,guLoginClient 
    624                         ); 
    625         mysql_query(&gMysql,gcQuery); 
    626         if(mysql_errno(&gMysql)) 
    627                 htmlPlainTextError(mysql_error(&gMysql)); 
    628          
    629         //radius profile 
    630         sprintf(gcQuery,"INSERT INTO tClientConfig SET uGroup=%u,uService=1,uParameter=3," 
    631                         "cValue='Unlimited',uOwner=%u,uCreatedBy=1,uCreatedDate=UNIX_TIMESTAMP(NOW())", 
    632                         uInstance 
    633                         ,guLoginClient 
    634                         ); 
    635         mysql_query(&gMysql,gcQuery); 
    636         if(mysql_errno(&gMysql)) 
    637                 htmlPlainTextError(mysql_error(&gMysql)); 
    638          
    639         //radius cleartext yes/no 
    640         sprintf(gcQuery,"INSERT INTO tClientConfig SET uGroup=%u,uService=1,uParameter=41," 
    641                         "cValue='Yes',uOwner=%u,uCreatedBy=1,uCreatedDate=UNIX_TIMESTAMP(NOW())", 
    642                         uInstance 
    643                         ,guLoginClient 
    644                         ); 
    645         mysql_query(&gMysql,gcQuery); 
    646         if(mysql_errno(&gMysql)) 
    647                 htmlPlainTextError(mysql_error(&gMysql)); 
    648  
    649 }//void CreateProductInstace(void) 
    650  
    651  
    652 void SubmitunxsISPJob(void) 
    653 { 
    654 }//void SubmitunxsISPJob(void) 
    655