Changeset 1188

Show
Ignore:
Timestamp:
02/16/10 13:29:26 (2 years ago)
Author:
Hugo
Message:

ispClient: save commit

Location:
trunk/unxsISP/interfaces/customer
Files:
5 modified

Legend:

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

    r1186 r1188  
    690690 
    691691                        printf("\n<!-- Start htmlCustomerPage(%s) -->\n",cTemplateName);  
    692 //                      fpTemplate(stdout,cTemplateName,&template); 
    693692                        Template(field[0], &template, stdout); 
    694693                        printf("\n<!-- End htmlCustomerPage(%s) -->\n",cTemplateName);  
     
    13091308}//void funcSelectCardType(FILE *fp) 
    13101309 
    1311  
    13121310void funcSelectExpMonth(FILE *fp) 
    13131311{ 
     1312        sysfuncSelectExpMonth(fp,cuExpMonthStyle,uExpMonth,1); 
     1313} 
     1314 
     1315void sysfuncSelectExpMonth(FILE *fp,char *cStyle,unsigned uSelector,unsigned uUseStatus) 
     1316{ 
    13141317        fprintf(fp,"<!-- funcSelectExpMonth(fp) start -->\n"); 
    1315  
    1316         fprintf(fp,"<select class=%s name=uExpMonth %s>\n",cuExpMonthStyle,gcInputStatus); 
     1318         
     1319        if(uUseStatus) 
     1320                fprintf(fp,"<select class=%s name=uExpMonth %s>\n",cStyle,gcInputStatus); 
     1321        else 
     1322                fprintf(fp,"<select class=%s name=uExpMonth>\n",cStyle); 
    13171323         
    13181324        fprintf(fp,"<option value=0 "); 
    1319         if(uExpMonth==0) 
     1325        if(uSelector==0) 
    13201326                fprintf(fp,"selected"); 
    13211327        fprintf(fp,">---</option>\n"); 
    13221328 
    13231329        fprintf(fp,"<option value=1 "); 
    1324         if(uExpMonth==1) 
     1330        if(uSelector==1) 
    13251331                fprintf(fp,"selected"); 
    13261332        fprintf(fp,">January</option>\n"); 
    13271333 
    13281334        fprintf(fp,"<option value=2 "); 
    1329         if(uExpMonth==2) 
     1335        if(uSelector==2) 
    13301336                fprintf(fp,"selected"); 
    13311337        fprintf(fp,">February</option>\n"); 
    13321338 
    13331339        fprintf(fp,"<option value=3 "); 
    1334         if(uExpMonth==3) 
     1340        if(uSelector==3) 
    13351341                fprintf(fp,"selected"); 
    13361342        fprintf(fp,">March</option>\n"); 
    13371343 
    13381344        fprintf(fp,"<option value=4 "); 
    1339         if(uExpMonth==4) 
     1345        if(uSelector==4) 
    13401346                fprintf(fp,"selected"); 
    13411347        fprintf(fp,">April</option>\n"); 
    13421348 
    13431349        fprintf(fp,"<option value=5 "); 
    1344         if(uExpMonth==5) 
     1350        if(uSelector==5) 
    13451351                fprintf(fp,"selected"); 
    13461352        fprintf(fp,">May</option>\n"); 
    13471353 
    13481354        fprintf(fp,"<option value=6 "); 
    1349         if(uExpMonth==6) 
     1355        if(uSelector==6) 
    13501356                fprintf(fp,"selected"); 
    13511357        fprintf(fp,">June</option>\n"); 
    13521358 
    13531359        fprintf(fp,"<option value=7 "); 
    1354         if(uExpMonth==7) 
     1360        if(uSelector==7) 
    13551361                fprintf(fp,"selected"); 
    13561362        fprintf(fp,">July</option>\n"); 
    13571363 
    13581364        fprintf(fp,"<option value=8 "); 
    1359         if(uExpMonth==8) 
     1365        if(uSelector==8) 
    13601366                fprintf(fp,"selected"); 
    13611367        fprintf(fp,">August</option>\n"); 
    13621368 
    13631369        fprintf(fp,"<option value=9 "); 
    1364         if(uExpMonth==9) 
     1370        if(uSelector==9) 
    13651371                fprintf(fp,"selected"); 
    13661372        fprintf(fp,">September</option>\n"); 
    13671373 
    13681374        fprintf(fp,"<option value=10 "); 
    1369         if(uExpMonth==10) 
     1375        if(uSelector==10) 
    13701376                fprintf(fp,"selected"); 
    13711377        fprintf(fp,">October</option>\n"); 
    13721378 
    13731379        fprintf(fp,"<option value=11 "); 
    1374         if(uExpMonth==11) 
     1380        if(uSelector==11) 
    13751381                fprintf(fp,"selected"); 
    13761382        fprintf(fp,">November</option>\n"); 
    13771383 
    13781384        fprintf(fp,"<option value=12 "); 
    1379         if(uExpMonth==12) 
     1385        if(uSelector==12) 
    13801386                fprintf(fp,"selected"); 
    13811387        fprintf(fp,">December</option>\n"); 
     
    13901396void funcSelectExpYear(FILE *fp) 
    13911397{ 
     1398        sysfuncSelectExpYear(fp,cuExpYearStyle,uExpYear,1); 
     1399 
     1400}//void funcSelectExpYear(FILE *fp) 
     1401 
     1402 
     1403void sysfuncSelectExpYear(FILE *fp,char *cStyle,unsigned uSelector,unsigned uUseStatus) 
     1404{ 
    13921405        fprintf(fp,"<!-- funcSelectExpYear(fp) start -->\n"); 
    13931406         
    1394         fprintf(fp,"<select class=%s name=uExpYear %s>\n",cuExpYearStyle,gcInputStatus); 
     1407        if(uUseStatus) 
     1408                fprintf(fp,"<select class=%s name=uExpYear %s>\n",cStyle,gcInputStatus); 
     1409        else 
     1410                fprintf(fp,"<select class=%s name=uExpYear %s>\n",cStyle); 
    13951411         
    13961412        fprintf(fp,"<option value=0 "); 
     
    13991415        fprintf(fp,">---</option>\n"); 
    14001416 
    1401         fprintf(fp,"<option value=2009 "); 
    1402         if(uExpYear==2009) 
    1403                 fprintf(fp,"selected"); 
    1404         fprintf(fp,">2009</option>\n"); 
    1405  
    14061417        fprintf(fp,"<option value=2010 "); 
    1407         if(uExpYear==2010) 
     1418        if(uSelector==2010) 
    14081419                fprintf(fp,"selected"); 
    14091420        fprintf(fp,">2010</option>\n"); 
    14101421 
    14111422        fprintf(fp,"<option value=2011 "); 
    1412         if(uExpYear==2011) 
     1423        if(uSelector==2011) 
    14131424                fprintf(fp,"selected"); 
    14141425        fprintf(fp,">2011</option>\n"); 
    14151426 
    14161427        fprintf(fp,"<option value=2012 "); 
    1417         if(uExpYear==2012) 
     1428        if(uSelector==2012) 
    14181429                fprintf(fp,"selected"); 
    14191430        fprintf(fp,">2012</option>\n"); 
  • trunk/unxsISP/interfaces/customer/interface.h

    r1184 r1188  
    8989unsigned uGetAdminCompany(void); 
    9090void GetClientOwner(unsigned uClient, unsigned *uOwner); 
     91void Logout(void); 
    9192 
    9293//Global vars all declared in main.c 
     
    138139void ShowPurchaseRadiusPage(void); 
    139140unsigned IsFirstTimeLogin(void); 
     141void sysfuncSelectExpMonth(FILE *fp,char *cStyle,unsigned uSelector,unsigned uUseStatus); 
     142void sysfuncSelectExpYear(FILE *fp,char *cStyle,unsigned uSelector,unsigned uUseStatus); 
    140143 
    141144typedef struct { 
     
    217220void RegistrationCommands(pentry entries[], int x); 
    218221 
     222//purchase.c 
     223void PurchaseCommands(pentry entries[], int x); 
     224 
  • trunk/unxsISP/interfaces/customer/main.c

    r1185 r1188  
    114114 
    115115                SSLCookieLogin(); 
     116                 
    116117                if(gcPage[0]) 
    117118                { 
     119                        if(IsFirstTimeLogin()) ShowPurchaseRadiusPage(); 
     120                         
    118121                        if(!strcmp(gcPage,"Customer")) 
    119122                                CustomerGetHook(gentries,i); 
     
    153156        if(gcFunction[0]) 
    154157        { 
    155                 if(!strncmp(gcFunction,"Logout",5)) 
    156                 { 
    157                 printf("Set-Cookie: ispClientLogin=; expires=\"Mon, 01-Jan-1971 00:10:10 GMT\"\n"); 
    158                 printf("Set-Cookie: ispClientPasswd=; expires=\"Mon, 01-Jan-1971 00:10:10 GMT\"\n"); 
    159                 sprintf(gcQuery,"INSERT INTO tLog SET cLabel='logout %.99s',uLogType=7,uPermLevel=%u,uLoginClient=%u,cLogin='%.99s',cHost='%.99s',cServer='%.99s',uOwner=%u,uCreatedBy=1,uCreatedDate=UNIX_TIMESTAMP(NOW())",gcLogin,guPermLevel,guLoginClient,gcLogin,gcHost,gcHostname,guOrg); 
    160                         mysql_query(&gMysql,gcQuery); 
    161                         guPermLevel=0; 
    162                         gcUser[0]=0; 
    163                         guLoginClient=0; 
    164                         htmlLogin(); 
    165                 } 
     158                if(!strncmp(gcFunction,"Logout",5)) Logout(); 
    166159        } 
    167160        RegistrationCommands(entries,i); 
     
    180173 
    181174        //Per page command tree 
     175        PurchaseCommands(entries,i); 
    182176        CustomerCommands(entries,i); 
    183177        ProductCommands(entries,i); 
    184178        InvoiceCommands(entries,i); 
    185  
     179         
    186180        //default logged in page 
    187181        if(IsFirstTimeLogin()) ShowPurchaseRadiusPage(); 
     
    190184 
    191185}//end of main() 
     186 
     187void Logout(void) 
     188{ 
     189        printf("Set-Cookie: ispClientLogin=; expires=\"Mon, 01-Jan-1971 00:10:10 GMT\"\n"); 
     190        printf("Set-Cookie: ispClientPasswd=; expires=\"Mon, 01-Jan-1971 00:10:10 GMT\"\n"); 
     191        sprintf(gcQuery,"INSERT INTO tLog SET cLabel='logout %.99s',uLogType=7,uPermLevel=%u," 
     192                        "uLoginClient=%u,cLogin='%.99s',cHost='%.99s',cServer='%.99s',uOwner=%u," 
     193                        "uCreatedBy=1,uCreatedDate=UNIX_TIMESTAMP(NOW())" 
     194                        ,gcLogin,guPermLevel,guLoginClient,gcLogin,gcHost,gcHostname,guOrg); 
     195        mysql_query(&gMysql,gcQuery); 
     196        guPermLevel=0; 
     197        gcUser[0]=0; 
     198        guLoginClient=0; 
     199        htmlLogin(); 
     200 
     201}//void Logout(void) 
    192202 
    193203 
  • trunk/unxsISP/interfaces/customer/purchase.c

    r1186 r1188  
    99*/ 
    1010#include "interface.h" 
     11 
     12void ShowConfirmPurchasePage(void); 
     13void htmlPurchasePage(char *cTitle,char *cTemplateName); 
     14 
    1115 
    1216void ProcessPurchaseVars(pentry entries[], int x) 
     
    2933                ProcessPurchaseVars(entries,x); 
    3034 
     35                if(!strcmp(gcFunction,"Skip")) 
     36                { 
     37                        sprintf(gcNewStep,"Confirm "); 
     38                } 
     39                else if(!strcmp(gcFunction,"Confirm Skip")) 
     40                { 
     41                        Logout(); 
     42                } 
     43                else if(!strcmp(gcFunction,"Proceed")) 
     44                { 
     45                        sprintf(gcModStep,"Confirm "); 
     46                } 
     47                else if(!strcmp(gcFunction,"Confirm Proceed")) 
     48                { 
     49                        ShowConfirmPurchasePage(); 
     50                } 
     51 
     52 
    3153        } 
    3254}//void PurchaseCommands(pentry entries[], int x) 
     
    3658{ 
    3759        htmlHeader("unxsISP Client Interface","Header"); 
    38         htmlCustomerPage("","FirstTime.Body"); 
     60        htmlPurchasePage("","FirstTime.Body"); 
    3961        htmlFooter("Footer"); 
     62 
    4063}//void ShowPurchaseRadiusPage(void) 
     64 
     65 
     66void ShowConfirmPurchasePage(void) 
     67{ 
     68        htmlHeader("unxsISP Client Interface","Header"); 
     69        htmlPurchasePage("","Purchase.Body"); 
     70        htmlFooter("Footer"); 
     71 
     72}//void ShowConfirmPurchasePage(void) 
     73 
     74 
     75void htmlPurchasePage(char *cTitle,char *cTemplateName) 
     76{ 
     77        if(cTemplateName[0]) 
     78        { 
     79                MYSQL_RES *res; 
     80                MYSQL_ROW field; 
     81 
     82                TemplateSelect(cTemplateName,guTemplateSet); 
     83                res=mysql_store_result(&gMysql); 
     84                if((field=mysql_fetch_row(res))) 
     85                { 
     86                        struct t_template template; 
     87                         
     88                        template.cpName[0]="cTitle"; 
     89                        template.cpValue[0]=cTitle; 
     90                         
     91                        template.cpName[1]="cCGI"; 
     92                        template.cpValue[1]="ispClient.cgi"; 
     93                         
     94                        template.cpName[2]="gcLogin"; 
     95                        template.cpValue[2]=gcLogin; 
     96 
     97                        template.cpName[3]="gcName"; 
     98                        template.cpValue[3]=gcName; 
     99 
     100                        template.cpName[4]="gcOrgName"; 
     101                        template.cpValue[4]=gcOrgName; 
     102 
     103                        template.cpName[5]="cUserLevel"; 
     104                        template.cpValue[5]=(char *)cUserLevel(guPermLevel); 
     105 
     106                        template.cpName[6]="gcHost"; 
     107                        template.cpValue[6]=gcHost; 
     108 
     109                        template.cpName[7]="gcMessage"; 
     110                        template.cpValue[7]=gcMessage; 
     111 
     112                        template.cpName[8]="gcInputStatus"; 
     113                        template.cpValue[8]=gcInputStatus; 
     114                                 
     115                        template.cpName[9]="gcNewStep"; 
     116                        template.cpValue[9]=gcNewStep; 
     117                         
     118                        template.cpName[10]="gcModStep"; 
     119                        template.cpValue[10]=gcModStep; 
     120 
     121                        template.cpName[11]="cISPName"; 
     122                        template.cpValue[11]="AstraQom"; 
     123 
     124                        template.cpName[12]="mProductPrice"; 
     125                        template.cpValue[12]="15.95"; 
     126 
     127                        template.cpName[13]=""; 
     128                         
     129                        printf("\n<!-- Start htmlPurchasePage(%s) -->\n",cTemplateName);  
     130                        Template(field[0], &template, stdout); 
     131                        printf("\n<!-- End htmlPurchasePage(%s) -->\n",cTemplateName);  
     132                } 
     133                else 
     134                { 
     135                        printf("<hr>"); 
     136                        printf("<center><font size=1>%s</font>\n",cTemplateName); 
     137                } 
     138                mysql_free_result(res); 
     139        } 
     140 
     141}//void htmlPurchasePage(char *cTemplateName) 
    41142 
    42143 
  • trunk/unxsISP/interfaces/customer/templates-english/FirstTime.Body

    r1186 r1188  
    9292<tr> 
    9393<td align=center><input class=largeButton type=submit name=gcFunction value="{{gcNewStep}}Skip"></td> 
    94 <td align=center><input class=largeButton type=submit name=gcFunction value="{{gcModStep}}Confirm"></td> 
     94<td align=center><input class=largeButton type=submit name=gcFunction value="{{gcModStep}}Proceed"></td> 
    9595</tr> 
    9696</table>