CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Authentication in web server with PIC18F67J60

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Max



Joined: 15 Dec 2003
Posts: 51
Location: Italy

View user's profile Send private message

Authentication in web server with PIC18F67J60
PostPosted: Fri Aug 30, 2019 12:37 pm     Reply with quote

Dear all,
I built a small card with PIC18F67J60 with some I/O, I built a TCP/IP wizard project with the 5.076 version.
I modified the index.html and index.xml page by adding some buttons. Using makempfsimg.bat to create the mpfsimg.bin file.
Everything works, but now I don't understand two things:
The first is how to create an authenticated page, that is, having to enter user and password to log in, I have read that it must be enabled in ccs_http2.h
Code:
HTTP_USE_AUTHENTICATION TRUE
that I did.
But now I can't figure out how to protect a page (even the index for example) so that it asks for user and password.
I read about htaccess. txt but I did not understand how to use it.
Second question:
In my card I have planned a SPI flash memory in which I would like
insert web pages and not put them in ROM so without having to reprogram the chip, this too should be possible, but
I don't understand the steps, what to enable/ disable and above all if to read/write the SPI flash the code is already included in the CCS library or if it is to be added.
Sorry for the length, and I thank in advance who will help me.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Aug 30, 2019 1:56 pm     Reply with quote

Look at the post at the end of this thread (this is a 2 page thread):

Create User Authentication page and password ENC28J60+PIC18f
http://www.ccsinfo.com/forum/viewtopic.php?t=53623

Also do a web search for this:
Quote:
Development Kit for the Embedded Ethernet Exercise Book pdf

Read about http authentification, starting at the bottom of page 54.
Max



Joined: 15 Dec 2003
Posts: 51
Location: Italy

View user's profile Send private message

PostPosted: Mon Sep 02, 2019 4:34 am     Reply with quote

Thanks for reply,
I tried, the post of the link I had read, but I can't get it to work.
I have inserted

Code:
int1 http_check_authentication(char *fileName, char *user, char *pwd)
{
   static char goodUser[]="admin";
   static char goodPwd[]="admin";
   unsigned int1 a;
   a= 0;
   
   a=((stricmp(goodUser,user)==0) && (stricmp(goodPwd,pwd)==0));
   return(a);
}


But it is never called.
my htaccess.txt file is like this
Code:

admin|admin|index.html

I put it where there is index.html and with makempfsimg.
I create the img file, recompile it all and run it in debug.
From a browser I call the webserver (192.168.xxx.xxx) and open the web page without asking user and password.
-Terppa-



Joined: 08 Jan 2018
Posts: 59
Location: Finland

View user's profile Send private message

PostPosted: Mon Nov 13, 2023 3:21 pm     Reply with quote

I am also try that and it doesen’t work.. I have one difference, i have folder called protect/test.htm and always it says ”internal server error” ccs_http2.c file i turned on debug files and in terminal i can see message, it cannot found my test.htm

What functions should i use to getting authentication works?
Everything else runs ok dynamic vars, index.htm, serial port etc but not authentication.

Somebody have basic guidelines for that?
Br
-Terppa-



Joined: 08 Jan 2018
Posts: 59
Location: Finland

View user's profile Send private message

PostPosted: Tue Nov 14, 2023 5:49 am     Reply with quote

A little digging i found some interesting failure. When i use MPFS (my bat file have: mpfs /b /r0 /ll /k ../pages mpfsimg.bin)

It only generates ”root” files in mpfsimg.bin
All files what includes /protect folder missing. (test.htm, htaccess.txt)

Should i use mpfs2 or use more parameters for my make.bat?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group