Insteed one by one, multiplie at once

I’ve tried to search how I could add multiplie queries insteed one by one.

But I failed.

I wanted to know how I could add multiplie URL’s to the database

Would appreciate any help!

<?php
require('myaccount.php');
?>

<div id="content-wrap">
<?php if (checkAdmin()) { ?> 
Input a PHP page extension of a shell below to insert it to the database: <br> <br>


Add a GET Shell: <form name="frmcontadd" action="" method="post">
<input class="entryfield" name="url" type="text" id="url">
<input class="button" type="submit" name="Submit" value="Add GET Shell"></td>

</form>



Add a POST Shell: <form name="frmcontadd" action="" method="post">
<input class="entryfield" name="url2" type="text" id="url2"></td>
<input class="button" type="submit" name="Submit2" value="Add POST Shell">

</form>

<?php
if (isset($_POST['Submit'])){
	$host = $_POST['url'];
	$query = "INSERT INTO getshells (url) VALUES ('$host')";
	$result = mysql_query($query);
echo '<hr>Successfully added GET Shell, ' . $host . ' to the shells database.';
}
?>

<?php
if (isset($_POST['Submit2'])){
	$host2 = $_POST['url2'];
	$query = "INSERT INTO postshells (url) VALUES ('$host2')";
	$result = mysql_query($query);
echo '<hr>Successfully added POST Shell, ' . $host2 . ' to the shells database.';
}
}
?>
</div>


<br>

<?php 
include 'footer.php';
?>

Add more url input fields to the form. Give them the name “url”. Loop through $_POST[‘url’] with a foreach loop to contruct the INSERT query. Execute the query.

Thanks for your reply, but what you just said made me go :shifty::shifty:

Could you maybe help me a bit more?:x

Still need help with this, anyone that could be of help?

Since the script will be executed from the start when the form is sent, it’s no use putting the validation at the end.


<?php
// first the check of a submitted form
if (isset($_POST['Submit'])) {
  $hosts = $_POST['url'];
  // let's create the INSERT query
  $values = array();
  foreach ($hosts as $host) {
    $values[] .= "('" . mysql_real_escape_string($host) . "')";
  }
  $query = "INSERT INTO getshells (url) VALUES " . implode(',', $values);
  $result = mysql_query($query) or die("mysql error " . mysql_error() . " in query $query");
  echo '<hr>Successfully added GET Shells to the shells database.';
}

// then the form itself
?>
Add GET Shells:
<form name="frmcontadd" action="" method="post">
  <input class="entryfield" name="url[]" type="text">
  <input class="entryfield" name="url[]" type="text">
  <input class="entryfield" name="url[]" type="text">
  <input class="button" type="submit" name="Submit" value="Add POST Shell">
</form>

Thanks Guido for your reply,

Only what I’ve ment is a big box, where I could for example add a notepad full of stuff
Into that box and then run so it adds all of them
Like I’ve got this box :

| url 1
| url 2
| url 3
| url 4

url 5
Add shell button

Could anyone help?


<?php
// first the check of a submitted form
if (isset($_POST['Submit'])) {
  $hosts = explode("\\r\
", $_POST['url']);
  // let's create the INSERT query
  $values = array();
  foreach ($hosts as $host) {
    $values[] .= "('" . mysql_real_escape_string($host) . "')";
  }
  $query = "INSERT INTO getshells (url) VALUES " . implode(',', $values);
  $result = mysql_query($query) or die("mysql error " . mysql_error() . " in query $query");
  echo '<hr>Successfully added GET Shells to the shells database.';
}
 
// then the form itself
?>
Add GET Shells:
<form name="frmcontadd" action="" method="post">
  <input class="entryfield" name="url" type="text">
  <input class="button" type="submit" name="Submit" value="Add GET Shell">
</form>

That just makes it enter one url.

That makes me start at 0 again :stuck_out_tongue:

Wanted a big text bog where I could add multiplie rows like :
http://1/
http://2/
http://3/
http://4/
http://5/

Send

Insteed

http://1/

Send

Oh yeah, you need a text area :smiley:


<?php
// first the check of a submitted form
if (isset($_POST['Submit'])) {
  $hosts = explode("\\r\
", $_POST['url']);
  // let's create the INSERT query
  $values = array();
  foreach ($hosts as $host) {
    $values[] .= "('" . mysql_real_escape_string($host) . "')";
  }
  $query = "INSERT INTO getshells (url) VALUES " . implode(',', $values);
  $result = mysql_query($query) or die("mysql error " . mysql_error() . " in query $query");
  echo '<hr>Successfully added GET Shells to the shells database.';
}
 
// then the form itself
?>
Add GET Shells:
<form name="frmcontadd" action="" method="post">
  <textarea class="entryfield" name="url"></texarea>
  <input class="button" type="submit" name="Submit" value="Add GET Shell">
</form>