Thread: User authentication

  1. #1
    Registered User
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    80

    User authentication

    There is an executable file on my Windows machine which I want to protect from unauthorized access. To achieve this, I'd like to write a program/script in C++ that prompts the user for username/password when the exe file is double-clicked; the actual username/passwod is stored on a separate machine with PostgreSQL running. So I want my program to communicate in PHP with the Postgre database...

    Now, the problem is that I don't have a clue how to 1) implement the window that asks for user/pass and 2) how to make the program communicate with the database.

    Bearing in mind that I have some knowledge of PHP, Postgre, and C++, can somebody possibly offer a solution/code? Also if you think there's an easier way of approaching this, then please advise. Appreciations in advance.

    P.S> By the way I haven't dealt with GUI's in C++.

  2. #2
    ^ Read Backwards^
    Join Date
    Sep 2005
    Location
    Earth
    Posts
    282
    How about just using windows built in function and only allow specific users to access that file?

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    you can register the file extension in HKEY_CLASS_ROOT which will contain the name of the program to execute when the file is double-clicked in Windows Explorer. But there are other ways to open the file too, so just catching double-clicks is not fullproof. For example I would right click on the file then select Send To-->Notepad shortcut or some other text editor.

  4. #4
    Registered User
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    80
    Thanks for your reply. I need to do it by using the Postgre database, for a reason that there is no necessity to explain it.

    I came up also with another sol'n (which is not C++ related)... to use a batch file in order to, upon execution of the file, redirect the user to a specific html page, asking for username/password. this page uses PHP to connect to Postgre and do the reset... However, in that case I don't know how to make it such that the user will not be allowed to access the file unless the correct username/pass combination is entered.

    EDIT: Thanks Ancient Dragon for your reply too. By "double-clicking" I meant trying to execute the file and not necessarily the literal meaning of the term. Sorry for the confusion.
    Last edited by Opel_Corsa; 11-03-2005 at 05:03 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 04-03-2008, 09:07 PM
  2. Add/Delete Remotely a user
    By Scarvenger in forum Windows Programming
    Replies: 5
    Last Post: 03-24-2008, 08:36 AM
  3. Replies: 4
    Last Post: 04-21-2004, 04:18 PM
  4. ~ User Input script help~
    By indy in forum C Programming
    Replies: 4
    Last Post: 12-02-2003, 06:01 AM
  5. Stopping a user from typeing.
    By knave in forum C++ Programming
    Replies: 4
    Last Post: 09-10-2001, 12:21 PM