Jump to content

Recommended Posts

Hello.

I have the script below that creates a list of random alphanumeric combinations.

include('db_connect.inc.php');
function md5this($length,$limit){
while ($length<$limit){
set_time_limit(0);
$charset = "abcdefghijklmnopqrstuvwxyz0123456789";
// Do not edit beyond this point!

for($i=0;$i<strlen($charset);$i++)
$x[]=$charset{$i};
for($i=0,$z="",$e="echo ";$i<$length;$i++){
    $z.="foreach(\$x as \$y[$i])"; 
	$e.="\$y[$i].";
	}
	$evalinsert = eval($z.$e."\"<br />\";");


$length++;
mysql_query("INSERT INTO `table`.`x1` (
`id` ,
`ancode`
)
VALUES (
NULL , '$evalinsert'
);");
}
}
md5this(1,3);

I know that it is connecting to the database and inserting data, but not the data I need. With how it is now it just inserts a blank space.

I am trying to input all of the data that the script displays.

Anyone know what to change.

 

Script output is Here

Link to comment
https://forums.phpfreaks.com/topic/124237-help-inserting-data-into-mysql/
Share on other sites

mysql_query("INSERT INTO `table`.`x1` (`id`, `ancode`) VALUES (NULL , '$evalinsert')");

 

I think you have an extra ';'.  $evalinsert is outputting data correct?  If this doesn't work check out this tutorial.

http://www.tizag.com/mysqlTutorial/mysqlinsert.php

 

I'm also unsure of

`table`.`x1`

  You're only inserting into 1 table correct?

mysql_query("INSERT INTO `table`.`x1` (`id`, `ancode`) VALUES (NULL , '$evalinsert')");

 

I think you have an extra ';'.  $evalinsert is outputting data correct?  If this doesn't work check out this tutorial.

http://www.tizag.com/mysqlTutorial/mysqlinsert.php

 

I'm also unsure of

`table`.`x1`

  You're only inserting into 1 table correct?

Yeah. To my knowledge the `table`.`x1` means that it will insert into the database named table, and the table named x1. Not sure, just got it from phpMyAdmin.

include('db_connect.inc.php');
function md5this($length,$limit){
$_GLOBALS[$evalinsert];
while ($length<$limit){
	set_time_limit(0);
	$charset = "abcd";
	// Do not edit beyond this point!

	for($i=0;$i<strlen($charset);$i++)
		$x[]=$charset[$i];
		for($i=0,$z="",$e="echo ";$i<$length;$i++){
 		   	$z.="foreach(\$x as \$y[$i])"; 
			$e.="\$y[$i].";

		}
		$evalinsert = eval($z.$e."\"<br />\";");
		mysql_query("INSERT INTO `md5Sums` (
		`id` ,
		`anValue`,
		`md5Sum`
		)
		VALUES (
		NULL , '$exits', '".md5($exits)."')") or die(mysql_error());


	$length++;
}
}
md5this(1, 3);

Here is what I have after the fix in the SQL and setting evalinsert to global.

Anything look wrong, as it still is just inserting a blank.

1 (blank) d41d8cd98f00b204e9800998ecf8427e

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.