Jump to content

Recommended Posts

Hey,

 

Please can you help me, I dont know why this script doesnt work....

 

index.html (form)

<html>
<body>

<form action="insert.php" method="post">
<br>Username: <input type="text" name="username" />
<br>Domain Name: <input type="text" name="domain" />
<br>Password: <input type="password" name="pass" />
<br><input type="submit" />
</form>

</body>
</html>

 

 

insert.php

<?php
$output = shell_exec('create_hosting '.$_POST['username']' '.$_POST['domain']''.$_POST['password']');
?>

 

 

When i run this i get the below error

 

The website encountered an error while retrieving /insert.php. It may be down for maintenance or configured incorrectly

Link to comment
https://forums.phpfreaks.com/topic/265980-shell_exec/
Share on other sites

  • 2 weeks later...

Your code is full of syntax errors. It should be:

 

$output = shell_exec('create_hosting ' . $_POST['username'] . ' ' . $_POST['domain'] . ' ' . $_POST['password']);

 

On top of that. There are some major security concerns here. Anyone could execute any command they like as the apache server user.

Link to comment
https://forums.phpfreaks.com/topic/265980-shell_exec/#findComment-1365378
Share on other sites

Do not ever use shell_exec() unless you're positive you know what you're doing.  I could easily delete your whole website with this form.  Basic syntax errors in this code means you're not ready for the security concerns around command line execution.

Link to comment
https://forums.phpfreaks.com/topic/265980-shell_exec/#findComment-1365404
Share on other sites

Though it is bad form to repeat what's been said already, I must add my voice to this as well simply because of the enormous security risk associated with this.

 

As ManiacDan said: Never ever use shell_exec () or similar functions, unless you have a complete understanding of all the security questions surrounding it. This includes how to properly safeguard yourself against attacks, and what byte sequences are harmful.

Since you don't even understand basic PHP syntax, you are not ready to delve into this realm quite yet. If you need this, and need it relatively soon, then I recommend hiring someone who knows what they're doing instead.

Link to comment
https://forums.phpfreaks.com/topic/265980-shell_exec/#findComment-1365410
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.