This is a tutorial, not a program.

Step 1 First, create a file for your website, and name it "admin.html".
Step 2 Now on it, say, "You must log in to view admin, blah,blah,blah. Click here to launch our client."
Step 3 Link "Click here" with the C++ .exe file we will create later.
Step 4 Now, create a new file with a bunch of random letters, then ".html". Make the file name AT LEAST 100 characters long. All your admin stuff will go here.
Step 5 Now Start a C++ program, and type the following:

#include <iostream>
#include <windows.h>
using namespace std;

int main(void){
    start:
    cout << "Welcome to EnergeticLeadershipParenting admin login" << endl;
    cout << "Login using your administrator password:" << endl;
    string login;
    getline (cin, login);
    if (login == "yourPassword"){
			ShellExecute(NULL, "open", "http://www.yourdomain.com/hundredCharacterFile.html",
			NULL, NULL, SW_SHOWNORMAL);
       return 0;
       }
    else { cout << "Login failed" << endl; goto start;}
    
    cin.get();
    return 0;
}

That's it! Sorry it is so brief, I have a lot of homework to do.

Any questions?

~arithehun

You're using "goto" in a tutorial? :icon_wink:

Yeah, I'm too lazy to use a loop.

And what keeps you from going to the site directly?

And what keeps you from going to the site directly?

Because, you name the file something like "secret.ghjghydfghdhd.secret.fjfgdfsgsfdgsfdgsfgds.password.ddjhdgshdgsh.secret.html"

Why is everyone marking my posts down?

>> Why is everyone marking my posts down?

Because they deserve it:

1. >> Because, you name the file something like "secret.ghjghydfghdhd.secret.fjfgdfsgsfdgsfdgsfgds.password.ddjhdgshdgsh.secret.html"
Yeah, that's real hard to ctrl-c ctrl-v. I think you should make them at least 500 chars :icon_wink:

2. >>Yeah, I'm too lazy to use a loop.

You're too lazy, or you don't understand how to use them? My guess is the latter. See this and then this

commented: Syntax Correction. +0

I do know how!

while(true){
    contents;
    if(whatever){
          whatever;
    }
    else{
         break;
    }
}

Or

int i=0;
for(i=0;i<50;i++){
     whatever;
}

But thanks for trying to help anyway.
:p

And as for your first statement, they could also just give away the password. The point is if you don't want to set-up a php page and shell, you could do this instead. It has almost the same functions unless you create a database.

And as for your first statement, they could also just give away the password. The point is if you don't want to set-up a php page and shell, you could do this instead. It has almost the same functions unless you create a database.

There is a big difference: the PHP page would be a secure way of doing it, while this is security by obscurity (that is, none at all).
Since the helper program knows both the password and the URL and the user has access to said program, the user also has access to the URL. Both password and URL can easily be retrieved by looking at the binary.

No offence but I literally started a week ago and even I know not to use a goto loop. I get this is 8 years old, but for the sake of people just finding this I'll say two things. 1: A goto loop is actually more difficult, ugly, and annoying in my opinions. Loops are so clean and neat. Second, don't use a global namespace. Apparently this is bad. Props for using ShellExecute instead of system("") though. Apparently you shouldn't use system(). I'll clean it up a little:

#include <iostream>
#include <windows.h>

int main(void)
{
    using namespace std;

    bool login_success = false;
    while (!login_success)
    {
        cout << "Welcome to EnergeticLeadershipParenting admin login" << endl;
        cout << "Login using your administrator password:" << endl;
        string login;
        cin >> login;
        if (login == "yourPassword")
        {
            ShellExecute(NULL, "open", "http://www.yourdomain.com/hundredCharacterFile.html",
            NULL, NULL, SW_SHOWNORMAL);
            login_success = true; //breaks out of while loop
        }
        else 
        { 
            cout << "Login failed" << endl;
        }
    }

    //continue program here if necassary
    return 0;
}

My spacing is probably way out as I typed i this is the comment box.... But eh

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.