Is it possible?

This is a discussion on Is it possible? within the C Programming forums, part of the General Programming Boards category; Hi ppl. A challenge appeared to me, and i'm not really sure how to to complete it. It goes like ...

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    18

    Is it possible?

    Hi ppl. A challenge appeared to me, and i'm not really sure how to to complete it. It goes like this:
    I need to do a database, more or less like the ones made with Microsoft access, but i need one made from root, and i dont need the pretty graphics, just a database. But this is simple. The problem comes next. I need to do another program to access the database, with 2 kinds of user: Normal user, which can view all data in the database, and OP user, which can EASILY edit the database, without having to know a single bit of programming.

    So I need the database program, and another program to read/edit the database depending on kind of user, being the OP locked with password. I need both made from raw, because I need to do it so that the database can only be edited by an OP user with the other program(or me with the source code, of course).

    I have lots of time to complete this, but i need help because i dont really know where to start, and which parts of C language i need to learn to do this....

    I really appreciate your help, as i'm lost with this stuff.....

    Thanks

  2. #2
    Registered User
    Join Date
    Jul 2003
    Posts
    18
    >Will this database be a single table, or multiple tables with relationships between them?
    I think it would be multiple tables, because it is lots of info that i want to put there.

    >What sort of operations are you planning for, apart from read/edit
    I think search would be good, and maybe find/replace for OP's. No need printing, and i canīt remember anything else useful..

    >Is there just one of each, or are there many people in each user class?
    Just one of each. Probably 3 kind of user, the other one being a "limited" user, with access to only some certain parts of the data.

    >So are you looking at having two programs, working in a client/server relationship?
    Two programs, yes. One containing the database itself and the second one just used to read/access, etc the database(the 1st program).

    >will the database be accessed by normal and OP users at the same time? Multiple access creates its own set of problems.
    Nope, just one user at a time. This will be a program for a single computer use, not network/internet. The user turns on the PC in which lies the program, and uses it depending on kind of access he has.

    >It seems to me that you would need to encrypt the database in some way.
    Nope, no need to do that. As I said, the only one with minimal computer knowledge is me, none of the other user knows a bit about it. As the database won't be a program itself, no one will access it, not even dream where it is, or even if there are 2 programs...

    >Then you need some user-level authentication to determine whether the user has the rights to commit changes to the database
    Yes, that would be the very beginning of the second program, prompting user and pass for OP, user and pass for normal user, and no user/pass prompt for limited users... and then depending on access level it would give more or less options to the user.

    I have already a "kind of" database ready, if you want i can send it to you with the source code included. But i'm afraid it won't do as base for the next one. That one is only editable by hex editors or by source code owners...if you want to see it just "ring".
    I think i gave a better explain of what i want in this post, so if you have any further help please say...

    Thanks

  3. #3
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,156

    Re: Is it possible?

    Originally posted by Slaught
    So I need the database program, and another program to read/edit the database depending on kind of user, being the OP locked with password. I need both made from raw, because I need to do it so that the database can only be edited by an OP user with the other program(or me with the source code, of course).

    I have lots of time to complete this, but i need help because i dont really know where to start, and which parts of C language i need to learn to do this....

    I really appreciate your help, as i'm lost with this stuff.....

    Thanks
    1) i dont really know where to start:
    Code:
    #include <stdio.h>
    char *dbname = "C:\\DataBase.fil";
    int main()
    {
    
        return(0);
    };)
    2)which parts of C language i need to learn to do this....
    File IO (fopen, fread, fwrite, fclose, fgets, ... )
    Screen IO (puts, printf, fgets, ... )
    Strings (string.h: strcmp, strcpy, strcat, ...)
    Pointers to parse strings

    Assuming this is homework:
    Design your database using the tables you need (data table, security table, etc). Each can be a separate file.

    Design the code so that all functions work, but without a security level (read as the program starts), the edit functions are locked out. A simple IF statement solves that
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  4. #4
    Registered User
    Join Date
    Jul 2003
    Posts
    18
    >Design your database using the tables you need .
    You mean, create the database and the program to read/edit it?

    I just need a starting, the rest i will learn with time.

    that code you put there creates the file database.fil right? The problem is, i'm afraid of creating badly the database and make it like almost impossible to read/edit with the other program. The database is going to be written in C, but it won't be an executable file, will it? I use Dev-CPP for creating/compiling. Shall i start making the database as a conslole file or an empty file/project?

  5. #5
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,156
    Originally posted by Slaught
    >Design your database using the tables you need .
    You mean, create the database and the program to read/edit it? No, design your database -- decide what tables you need, decide what data goes into each record of each table. Then write the program to create or initialize the database (DB), as well as read & edit

    I just need a starting, the rest i will learn with time.

    that code you put there creates the file database.fil right? No, the smily didn't display. It was somewhat of a joke. All programs start like that

    The problem is, i'm afraid of creating badly the database and make it like almost impossible to read/edit with the other program. The DB table design is the key here. Maybe post the design here for comments

    The database is going to be written in C, but it won't be an executable file, will it? No, the DB will be a data file, just data with binary and/or text information. The program will be the only thing created in C

    I use Dev-CPP for creating/compiling. Shall i start making the database as a conslole file or an empty file/project? As above, write the program to create (initialize) the files in the DB. Design the program to access and create the data as you've designed it in the DB design
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  6. #6
    Registered User
    Join Date
    Jul 2003
    Posts
    18
    >No, the smily didn't display. It was somewhat of a joke. All programs start like that
    Yeah, know the smiley was a joke, and all programs start like that, but i never used that "char *dbname...." part, but i guess it shows where the database file is, right?

    What are the functions that allow access to a data file, like a text file or so, and allow the user that uses the program to read and/or edit the text as it is?

  7. #7
    Registered User
    Join Date
    Jun 2003
    Posts
    124
    When you say database you just mean a file which will contain some data, like names and numbers?
    Loading.....
    ( Trying to be a good C Programmer )

  8. #8
    Registered User
    Join Date
    Jul 2003
    Posts
    18
    Yeah, something alike. A text file could be an example of that.

  9. #9
    Registered User
    Join Date
    Jun 2003
    Posts
    124
    File IO (fopen, fread, fwrite, fclose, fgets, ... )
    Loading.....
    ( Trying to be a good C Programmer )

  10. #10
    Registered User
    Join Date
    Jun 2003
    Posts
    124

    Oops, sorry for the previous enter..

    >What are the functions that allow access to a data file, like a text file or so, and allow the user that uses the program to read and/or edit the text as it is?

    >>File IO (fopen, fread, fwrite, fclose, fgets, ... ) ( Waltp )
    Loading.....
    ( Trying to be a good C Programmer )

  11. #11
    eh ya hoser, got a beer? stumon's Avatar
    Join Date
    Feb 2003
    Posts
    323
    Hey money. There is a little edit button on the bottom right of each post. You have access to edit your posts. No need to double post.
    The keyboard is the standard device used to cause computer errors!

  12. #12
    Registered User
    Join Date
    Jul 2003
    Posts
    18
    Hmm lets say, for example, that i have a txt file in C:\windows called system.db . It was created as .txt but is masked as .db.
    So it would be as well C:\Windows\system.txt or.db .

    Lets say that the text had this on:

    Code:
    Name: Some name
    
    Phone: Some phone number
    
    Likes: What someone likes
    etc, etc and this for an "n" number of people, for example 20.

    What program could I make for, at first, prompting user and pass, and after that(after checking permissions) give the user permission to just read or read & edit the data in the file, as it is and easily, as its permission lets?

  13. #13
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Originally posted by Slaught
    What program could I make for, at first, prompting user and pass, and after that(after checking permissions) give the user permission to just read or read & edit the data in the file, as it is and easily, as its permission lets?
    You mean faking it? The program just saying they can't edit it? Or do you mean actually not letting them edit it?

    If the former, simply do a comparison, and if it fails, tell them they can't.

    If the latter, you're looking at OS specific API to prevent access to a file.

    Either that, or you encrypt the file so it is no longer plain text, with checksums, to prevent tampering/confirm valid data.

    The latter doesn't actually prevent editing outside the application, it just makes it unreadable.

    Quzah.
    Hope is the first step on the road to disappointment.

  14. #14
    Registered User
    Join Date
    Jul 2003
    Posts
    18
    It's just needed to tell them thay cant edit it, as they won't know about the real existance of the file. they will only access the file through the program, so if the program won't let them it is enough.
    No need to encrypt anything, i just need an example of a program that could do that.

    Can you put an example of the source code here? of the program to read and edit/read the file. Txt or any other type.

    Thanks

  15. #15
    Registered User
    Join Date
    Jul 2003
    Posts
    18

    Unhappy

    yeah, but:
    >Can you put an example of the source code here? of the program to read and edit/read the file.

    My C books aren't very good at example functions, so i don't really know how to call the file, tell the program to open it, etc.
    If you put an example here it would be a great help.
    I've already tried some but none worked .

    I just need an example on how to make the program.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21