• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

...Bank System...

fewdox

New Member
Joined
Jan 9, 2010
Messages
244
Reaction score
2
Location
192.168.1.2 else try 127.0.0.1
Hi All, Anyone have a bank system via database MySql ...
if have please post link or code here tanks ..
:thumbup:

and if someone help me with this method form `buy points`..
i need to put bank system via database mysql in my ot ..
and buy points form with balance of bank ..
type ..

Test have 9000 gp in bank ..

Buy points form is .. if player have 9000 gp in bank .. he can buy 1 point ..

i have this db commands but i have one NPC via website . but i dont know how i make for the when player buyed 1 points .. he lost the balance money ..

example

1-> i deposited 9k in balance
2-> need buy 1 points (1 point price is 9k)
3-> db check if you have 9k
4-> after check ... but have a submit button . and you get 1 point in site
5->after 1 point added db remove the 9k from you account balance

PHP:
$player_data = $SQL->query("SELECT * FROM `players` WHERE `name` = '".$player."';")->fetch(); 
$SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` + '".$points."' WHERE `id` = '".$player_data['account_id']."'");





if($config['site']['shop_system'] == 1)
{
if($logged)
{
  $user_premium_points = $account_logged->getCustomField('balance');
}
else
{
  $user_premium_points = 'Login first';
}

Please help me .. i need this very munch .!!!!
 
Code:
$PlayerQuery=mysql_query('SELECT balance, name FROM players WHERE name = '.$player.'') or die(mysql_error());
$PlayerRows = mysql_fetch_array($PlayerQuery);

if($config['site']['shop_system'] == 1) 
{ 
	if($logged) 
	{ 
		
		if($PlayerRows['balance'] >= ($points*9000))
		{
		
			$newBalance = ($PlayerRows['balance']-($points*9000))
			
			mysql_query('UPDATE accounts SET premium_points = premium_points + '.$points.' WHERE id = '.$player_data['account_id'].'') or die(mysql_error());
			mysql_query('UPDATE players SET balance = '.$newBalance.' WHERE id = '.$player.'') or die(mysql_error());
		}	  
	} 
	else 
	{ 
	  $user_premium_points = 'Login first'; 
	} 
}

if I understood what you needed this might work, sorry if not
 
.. Hmm i got other idea more easy but i dont know how to make queries
PHP:
<?php
	// connection info
	mysql_connect("localhost", "root", "454077");
	mysql_select_db("talisman");
	//end connection config

//actions
			$player = $_POST['player'];
			$points = $_POST['points'];
//end actions

//main boxes
$main_content .="CODE:<input type='text' name='player'/>";
$main_content .="<br>";
$main_content .="PASS:<input type='password' name='points'/>";
$main_content .="<br>";
$main_content .="<input type='submit' name='add_points' value='Check Code'/>";
//end main boxes

//start box actions
mysql_query("SELECT * FROM `players` WHERE `name` = '".$player."';");

//end box actions
?>

i need to add TABLE in db with some codes and pass

type = CODE: 000334455 PASS:00445566

and when any click in one code .. the script check code if valid
add premium points to player .. can someone post here how to me create the table with codes and pass tanks very munch ...please guys i need this to finish website part
 
Last edited:
again, if I understood right:
This code will let your users enter a code and a password and if its valid the player gets premium points and the code/password will be deleted so they can't use it multiple times. Note that you'll have to define what account and the amount of points to be set

PHP:
echo'
<form method="post">
Code<br>
<input name="code"><br>
Password<br>
<input name="password"><br>
<input type="submit" name="submitCode">
</form>
';


if($_POST['submitCode'])
{
	
	$code = mysql_real_escape_string($_POST['code']);
	$password = mysql_real_escape_string($_POST['password']);

	$points = 'define please';
	$account= 'define please';
	
	$codeQuery = mysql_query('SELECT id, code, password FROM codes WHERE code = '.$code.'') or die(mysql_error());
	$codeRows = mysql_fetch_array($codeQuery);

	if($codeRows['password'] == $password)
	{
		mysql_query('UPDATE accounts SET premium_points = '.$points.' WHERE id = '.$account.'') or die(mysql_error());
		mysql_query('DELETE FROM codes WHERE id = '.$codeRows['id'].' LIMIT 1') or die(mysql_error());
	}
}

and this will insert random codes and passwords to a table called codes with a id, code and password option
PHP:
for($i=0; $i <= 10; $i++)
{
	
	$randomCode = rand(0,1000000);
	$randomPassword = rand(0,1000000);
	
	mysql_query("INSERT INTO codes (code, password) VALUES('$randomCode', '$randomPassword') ") or die(mysql_error());  
}


afain, sorry if I missunderstood or if there's bugs in it
 
login to your database, press the SQL thingy link and write:
Code:
CREATE TABLE  `test`.`codes` (
`id` INT NOT NULL AUTO_INCREMENT ,
`code` INT NOT NULL ,
`password` INT NOT NULL ,
PRIMARY KEY (  `id` )
) ENGINE = MYISAM ;

also if you want to has the password use these instead:

PHP:
echo'
<form method="post">
Code<br>
<input name="code"><br>
Password<br>
<input name="password"><br>
<input type="submit" name="submitCode">
</form>
';


if($_POST['submitCode'])
{
	
	$code = mysql_real_escape_string($_POST['code']);
	$password = mysql_real_escape_string($_POST['password']);

	$points = 'define please';
	$account = 'define please';
	
	$codeQuery = mysql_query('SELECT id, code, password FROM codes WHERE code = '.$code.'') or die(mysql_error());
	$codeRows = mysql_fetch_array($codeQuery);
	
	
	if(($codeRows['password']) == sha1($password))
	{
		mysql_query('UPDATE accounts SET premium_points = '.$points.' WHERE id = '.$account.'') or die(mysql_error());
		mysql_query('DELETE FROM codes WHERE id = '.$codeRows['id'].' LIMIT 1') or die(mysql_error());
	}
}

and

PHP:
for($i=0; $i <= 10; $i++)
{
	
	$randomCode = rand(0,1000000);
	$randomPassword = rand(0,1000000);
	$hashedRandomPassword = sha1($randomPassword);
	mysql_query("INSERT INTO codes (code, password) VALUES('$randomCode', '$hashedRandomPassword') ") or die(mysql_error());  
	
	echo $i.': Code = '.$randomCode.' and password = '.$randomPassword;
}

the last code that generates random codes and password.. just make a new file called test.php or something and run it sometimes, but be sure to write down the code and password as the password will be hashed and showed as like 7as89d78as9d7a89sd79a8s7d89as7d
 
Back
Top