/
profile.c
134 lines (84 loc) · 3.04 KB
/
profile.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/********************************************************
Intranet version 2.0
Programmet hanterare information om användare
Program: profile.c
Version: 2.1.2.4
Date: 01/03/10
written by Casimir Artmann.
Copyright Casimir Artmann. 1996-1998.
*********************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define TRUE 1
#define FALSE 0
/* funktioner för hantering av cgi-anrop och felhantering */
#include "../cgi.h"
#include "../utils.h"
/* gemensamma funktioner för konferanssystemet */
#include "intra.h"
#include "db.h"
#include "html.h"
/* följande funktioner anropas */
/* huvudprogram about */
void printUserProfileHTML ( struct _user user ) ;
main ( int argc, char *argv[])
{
char path[255] ;
int method ; /* vad skall programmet utföra */
char *instring ; /* inläst teckensträng */
struct _CGI CGI ;
struct _CGIarg CGIarg ;
struct _user user ; /* information om användaren */
/* läs in CGI environment */
strcpy ( path, argv[0] ) ;
InitIntra ( path) ;
InitCGI () ;
GetCGI ( &instring, &CGI ) ;
bURLencode ( instring, &CGIarg ) ;
ExpandMethod ( &CGIarg, &method ) ;
/* konvertera värden från formulär */
findUser ( CGI.remote_user, &user ) ;
if ( method == SELECT )
{
catHTML ( HEADER ) ; /* skriv ut ett sidhuvud i HTML */
/* skriv ut meny för konferanssystem */
printUserProfileHTML ( user ) ;
catHTML ( FOOTER ) ; /* skriv ut ett sidhuvud i HTML */
}
if ( method == EDIT )
{
catHTML ( HEADER ) ; /* skriv ut ett sidhuvud i HTML */
/* skriv ut meny för konferanssystem */
if ( user.id == 0 )
errorHTML ("Method not implemented") ;
catHTML ( FOOTER ) ; /* skriv ut ett sidhuvud i HTML */
}
if ( method == INSERT )
{
catHTML ( HEADER ) ; /* skriv ut ett sidhuvud i HTML */
/* skriv ut meny för konferanssystem */
if ( user.id == 0 )
errorHTML ("Method not implemented") ;
catHTML ( FOOTER ) ; /* skriv ut ett sidhuvud i HTML */
}
if ( method == UPDATE )
{
catHTML ( HEADER ) ; /* skriv ut ett sidhuvud i HTML */
/* skriv ut meny för konferanssystem */
if ( user.id == 0 )
errorHTML ("Method not implemented") ;
catHTML ( FOOTER ) ; /* skriv ut ett sidhuvud i HTML */
}
return ( TRUE ) ;
} /* end of main () */
void printUserProfileHTML ( struct _user user )
{
printf("<H3>Användare</H3>\n") ;
printf ("Inloggningsnamn: %s, id: %d<br>\n", user.login, user.id ) ;
printf ("Användare: %s<br>", user.name ) ;
printf("Företag: %s<br>", user.company ) ;
printf ("E-post: %s<br>", user.epost ) ;
printf ("Hemsida: %s<br>", user.homepage ) ;
}