• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[Release] Script for Add item in the ItemMall

Newbie Spellweaver
Joined
May 27, 2011
Messages
17
Reaction score
0
Little script for add item in the itemmall, edit SQL code for you and use.

Code:
<?php
$conn = mysql_connect ("localhost", "root", "")
or die ("Соединение не установлено!/Not to connect to MySQL!");
print ("Соединение установлено!/Connect to MySQL!");
$v = mysql_select_db("allods_online_billing_trunk_rc2")
or die ("Не существует базы!/Base not found!");
print ("База выбрана успешно/Connect to Base!");
$select = mysql_query('CREATE TABLE IF NOT EXISTS item (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  res_id int(11) NOT NULL,
  stack_count int(11) NOT NULL,
  category_id bigint(20) NOT NULL,
  price int(11) NOT NULL,
  position int(11) NOT NULL,
  PRIMARY KEY (id),
  UNIQUE KEY IDX_ITEM_POSITION (category_id,position)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=183');


mysql_query ('INSERT INTO item (id, res_id, stack_count, category_id, price, position) VALUES
(190, 129619968, 1, 29, 1000, 15)'); /// This edit and upload on the host of wamp and refresh this page. 
mysql_close($conn);

?>

Maybe later complete this script.

Don't foget restart ItemMall Server and Relogin in the game.
 
Last edited:
Newbie Spellweaver
Joined
Apr 30, 2012
Messages
7
Reaction score
0
Re: Script for Add item in the ItemMall

I got really bored. :mellow:

PHP:
<?php

$info = array();

function sql_insert($res_id, $stack_count, $category_id, $price, $position) {
	global $info;
	$sql_host = "localhost";		// ex: 89.110.47.13
    $sql_user = "root";				// mysql username
    $sql_pass = "YOUR_PASS";			// mysql pass
	
    $sql_connect = mysql_connect ($sql_host, $sql_user, $sql_pass) or die ("Couldn't connect to MySQL server: " . mysql_error()); 
    
    if($sql_connect) { 
		$info[] = '<font style="color: green;">INFO - Connection to MySQL established!</font>'; // ugly?
		
        $sql_db = mysql_select_db("allods_online_billing_trunk_rc2") or die ("Database could not be found: " . mysql_error()); 
        if($sql_db) {
            mysql_query('CREATE TABLE IF NOT EXISTS item (
            id bigint(20) NOT NULL AUTO_INCREMENT,
            res_id int(11) NOT NULL,
            stack_count int(11) NOT NULL, 
            category_id bigint(20) NOT NULL, 
            price int(11) NOT NULL, 
            position int(11) NOT NULL, 
            PRIMARY KEY (id), UNIQUE KEY IDX_ITEM_POSITION (category_id,position) 
            ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=183'); 
			
			//why isn't id here? Because it will be created by mysql and increase when you add more rows.
            $answer = mysql_query('INSERT INTO item (res_id, stack_count, category_id, price, position) VALUES(' .$res_id. ',' .$stack_count. ',' .$category_id. ',' .$price. ',' .$position. ')'); 
			
			// custom error messages
			$info[] = '<font style="color: green;">INFO - Successfully selected database!</font>';
			
			if($answer) {
				$info[] = '<font style="color: green;">INFO - Successfully added data to table item!</font>';
			} else {
				$info[] = '<font style="color: red;">ERROR - Failed to insert data into table item! <font style="color: orange; font-style: italic;">MySQL says: ' .mysql_error(). '</font></font>';
			}
        }
        mysql_close($sql_connect); 
    }
}

// this is being called when user press submit button
if(isset($_POST['loginButton'])) {

	// this checks if our boxes are NOT empty and DO contain numbers.
	if(!empty($_POST['res_id'])		&& is_numeric($_POST['res_id'])
	&& !empty($_POST['stack_count'])&& is_numeric($_POST['stack_count']) 
	&& !empty($_POST['category_id'])&& is_numeric($_POST['category_id']) 
	&& !empty($_POST['price']) 		&& is_numeric($_POST['price']) 
	&& !empty($_POST['position'])	&& is_numeric($_POST['position'])) 
	{
		sql_insert($_POST['res_id'], $_POST['stack_count'], $_POST['category_id'], $_POST['price'], $_POST['position']);
	} else {
		$info[] = '<font style="color: orange;">INFO - Check your data input, there were problems adding it.</font>';
	}
}

date_default_timezone_set('UTC');
error_reporting(E_ALL);
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
<title>Custom insert</title>
</head>

<body>
<h4>This file should not be avaliable for public!</h4>
	<form method="post" action="">
		<table width="0" border="0" cellpadding="3" cellspacing="1">
		<tr>
			<td align="right"><font>Res_is: </font></td>
			<td><input name="res_id" type="text" value="2"></td>
		</tr>
		<tr>
			<td align="right"><font>Stack_count: </font></td>
			<td><input name="stack_count" type="text" value="1"></td>
		</tr>
		<tr>
			<td align="right"><font>Category_id: </font></td>
			<td><input name="category_id" type="text" value="2"></td>
		</tr>
		<tr>
			<td align="right"><font>Price: </font></td>
			<td><input name="price" type="text" value="1"></td>
		</tr>
		<tr>
			<td align="right"><font>Position: </font></td>
			<td><input name="position" type="text" value="1"></td>
		</tr>
		<tr>
			<td></td>
			<td align="right"><input type="submit" name="loginButton" value="Submit"></td>
		</tr>
		</table>
	</form>
	
	<div id="error_report">
	<?php 
	// error & info reporting
	if(!empty($info)) {
		foreach($info as $item) {
			echo $item . '<br/>';
		}
	}
	?>
	</div>
</html>
</body>
 
Last edited:
Newbie Spellweaver
Joined
Jan 6, 2013
Messages
5
Reaction score
0
I'm sorry.. can anyone help me...
Where i can take res_id.
Thanks. Sorry for my english

==============================================

Перевод

Извиняюсь, кто нибудь может мне помочь?
Где извлечь увидеть res_id элементов лавки... С категориями более менее... Но тоже интересно как присваивается этио значение и где его брать...
В переводе конечно добавил )))
 
Last edited:
Back
Top