/    Sign up×
Community /Pin to ProfileBookmark

Start Batch file and exe files from php and html

Hello everyone,

i am in need of some desperate help after about 3 hours of trying to figure this out on my own.

Im currently developing a beta game server panel all from a batch file but would like to have something called login.php with 3 buttons for clients. STOP START and RESTART

Basically i want this login.php to be able to call either a batch file or a .exe file depending on the game. Some games run a server using .bat and some use a .exe for server files.

The login.php file would be run on the same server as the batch file but for a user they would have to go to [url]http://ip/login.php[/url] to run the commands.

I want to be able to have 3 buttons on the middle of the page once logged in that says START | STOP | RESTART

Most likely images not php buttons but if someone can give me the code both ways that would help for my opion of which to use.

Now at the top once logged in i want there to be the option to | Change Login Information | Logout

these 2 options at the top left logged in.

Im not using a remote database php authentication for the user logins as i want them to manually change their passwords and usernames from the .php file.

here is my code for that

<?php

// Define your username and password

$username = “someuser”;

$password = “somepassword”;

if ($_POST[‘txtUsername’] != $username || $_POST[‘txtPassword’] != $password) {

?>

<h1>Login</h1>

<form name=”form” method=”post” action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>”>

<p><label for=”txtUsername”>Username:</label>

<br /><input type=”text” title=”Enter your Username” name=”txtUsername” /></p>

<p><label for=”txtpassword”>Password:</label>

<br /><input type=”password” title=”Enter your password” name=”txtPassword” /></p>

<p><input type=”submit” name=”Submit” value=”Login” /></p>

</form>

<?php

}

else {

?>

<p>This is the protected page. Your private content goes here.</p>

<?php

}

?>

This is the code for the login screen. As well as help with my login.php if someone could make it so that once logged in you can edit this username and password from Edit Account Information section.

Here is all i have for the login.php to call a batch file or exe file and i have had 0% suscess.

<html>
<body>
<h1>example</h1>

<?php
if(isset($_POST[‘submit’]))
{
exec(“cmd.exe /c test.bat”)
echo “Done!”;
} else {
// display the form
?>
<form action=”” method=”post”>
<input type=”submit” name=”submit” value=”DO IT!”>
</form>
<?php
}
?>

</body>
</html>

HELP IS GREATLY APPREICATED!

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @webmasterx2011 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...