Post by sniffertje » Sat Oct 05, 2013 9:43 pm

I did a run of a php file to set a custom order number, but this is not working correct in 1.5.6.
Can somebody tell me what to do to reverse this script, so I have the old situation back.

Thanks

Code: Select all

<?php
include ("config.php");


$link = mysql_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
else { 
	mysql_select_db(DB_DATABASE);
}

$magic_table = DB_PREFIX . "order";

$magic = $_POST['magic'];

if ($magic!==""){
	$query="ALTER TABLE `$magic_table` AUTO_INCREMENT = $magic";
	mysql_query($query);
}


$query = "SELECT Auto_increment  FROM information_schema.tables  WHERE table_name='$magic_table' AND table_schema = DATABASE()";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$magic = $row[0];

?>
<html><head><title>HelderIM : OpenCart : (Re)set ordernumber</title></head><body>
<h1>(Re)set Ordernumber (by HelderIM)</h1>
<p>
This tool reads the next ordernumber that will be generated. You can change the ordernumber by entering a new number and press "SET". It does not change ordernumbers already generated.
</p>
<p>
This tool is tested on OpenCart 1.5.2.1 using MySQL.<br>
Delete this tool from your website after usage. It has no protection whatsoever!!!!
</p>

<?php
echo '<form name="EQ" action="magic.php" method="post">';
echo "<input name='magic' type='text' value='". $magic . "'/><br>";
echo "<input type='submit' value='SET'/></form>";
echo "</body></html>";

?>

New member

Posts

Joined
Fri Jan 08, 2010 10:42 pm

Post by sniffertje » Sat Oct 05, 2013 11:20 pm

I have to update the AUTO_INCREMENT in information_schema.tables

Only I don't have permission to update the field. Hope somebody can help further?

New member

Posts

Joined
Fri Jan 08, 2010 10:42 pm

User avatar
Active Member

Posts

Joined
Mon Mar 19, 2012 1:39 am
Location - Europe, Czech republic; Hradec Králové, Brno
Who is online

Users browsing this forum: No registered users and 34 guests