Menu

#1 HTTP 302 Found header & php

open
nobody
None
5
2003-05-18
2003-05-18
marco
No

Hi,
i want to know how i can manage the "HTTP 302
FOUND" header.
This header is very useful to manage php web interfaces
for redirect
users.

I've written an handler for *.php files:

void php( void )
{
char tmp[ PATH_MAX ];
char path[ PATH_MAX ];
FILE *fp;
int i=0;

/*if Location != "" there is a redirection */
if ( 0 != strlen( ClientInfo->Header("Location") ) )
{
web_client_HTTPdirective("HTTP/1.1 302 Found");
}

snprintf( tmp, PATH_MAX, "/%s/%s", htmlDir,
ClientInfo->request );
realpath( tmp, path );

if ( NULL == ( fp = fopen(path, "r") ) )
{
web_client_HTTPdirective("HTTP/1.1 404 Not
Found");
printf("Content-type: text/html\r\n\r\n");
...
...
return;
}
else
{
/*httpFilter = "php " */
snprintf( tmp, PATH_MAX, "%s %s",
httpFilter, path );
printf( "%s",system( tmp ) );
}
fclose(fp);
}

I tried this implementation but the
ClientInfo->Header("Location") doesn't return the
specified field. How can i resolve this problem?

Thank you.

Marco

Discussion


Log in to post a comment.