• 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!

Shop Sytem -premium points

powerpig

Hoster
Joined
Jan 19, 2010
Messages
80
Reaction score
0
Location
Sweden
Hey!

When i installed shopsytem to my modern AAC i tested to buy stuff
It worked great but, i could just update the success site and get more of the same items, even when im out of points.
I had 0 premium points and i could still update the site and get the item. Heres an example after i updated after 0.

Transaction Succesfull

You have bought Test and gave to Admin Kevin.
Go Back to Gift Shop

You have: -1 premium points.

How do i fix this? So they cant update the success site and have minus premiumpoints and can still buy
 
It is the same, but everything works fine, i mean u can buy points, buy items and it sents to ur character. But at the website the transaciton is succesfull you can just refresh site and get the same item even if your out of points.
 
no man, it's not.
i tested it yesterday when i saw a post like yours.
when you refresh you get another item, but when you don't have points it gives you an error.
 
Lets say i got 1 point, and i buy a sword for 1 point, Chooses my cahracter and click buy. Then it says transaction success and i receives the item, But if i refresh the website again. The website with success it gives me 1 more sword and i goes from 0 to -1 point. It doesnt says, error you dont got enought points for this item. Like it does when u got 0 points and goes into gift shop and tries to buy something.
 
Maybe your sql querys are bad, everytime you buy an item a query should be executed to set the points to 0 so you cant get more check that.
 
Functions.php

<?php

class shop {
function connect() {
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
return $ots->getDBHandle();
}

function isInstalled() {
require('config.php');
$con = mysql_connect($config['database']['host'], $config['database']['login'], $config['database']['password']);
mysql_select_db($config['database']['database'],$con);
if(mysql_query("SELECT * FROM shop_offer,shop_history"))
return true;
else
return false;
}

function points($account) {
$SQL = $this->connect();
$points = $SQL->query('SELECT premium_points FROM accounts WHERE name = "'.$account.'"')->fetch();
return $points['premium_points'];
}

function getPlayerAccount($name) {
$SQL = $this->connect();
$player = $SQL->query('SELECT account_id FROM players WHERE name = "'.$name.'"')->fetch();
return $SQL->query('SELECT * from accounts WHERE id = '.$player['account_id'].'');
}

function AddPremium($name,$days) {
$SQL = $this->connect();
$account = $this->getPlayerAccount($name)->fetch();
return $SQL->query('UPDATE accounts SET premdays = (premdays + '.$days.') WHERE name = "'.$account['name'].'"');
}

function CharacterList($account) {
$SQL = $this->connect();
$id = $SQL->query('SELECT id FROM accounts WHERE name = "'.$account.'"')->fetch();
return $SQL->query('SELECT * FROM players WHERE account_id = '.$id['id'].'');
}

function isOnline($name) {
$SQL = $this->connect();
$player = $SQL->query('SELECT online FROM players WHERE name = "'.$name.'"')->fetch();
return $player['online'];
}


function isBanned($name) {
$SQL = $this->connect();
$ID = $this->getPlayerAccount($name)->fetch();
return $SQL->query('SELECT * FROM bans WHERE value = '.$ID['id'].'');
}

function UnBan($name) {
$SQL = $this->connect();
$ID = $this->getPlayerAccount($name)->fetch();
return $SQL->query('DELETE FROM bans WHERE value = '.$ID['id'].'');
}

function execute_file($file) {
if (!file_exists($file)) {
$this->last_error = "The file $file does not exist.";
return false;
}
$str = file_get_contents($file);
if (!$str) {
$this->last_error = "Unable to read the contents of $file.";
return false;
}

// split all the queries into an array
$quote = '';
$line = '';
$sql = array();
$ignoreNextChar = '';
for ($i = 0; $i < strlen($str); $i++) {
if ( !$ignoreNextChar ) {
$char = substr($str, $i, 1);
$line .= $char;
if ($char == ';' && $quote == '') {
$sql[] = $line;
$line = '';
} else if ( $char == '\\' ) {
// Escape char; ignore the next char in the string
$ignoreNextChar = TRUE;
} else if ($char == '"' || $char == "'" || $char == '`') {
if ( $quote == '' ) // Start of a new quoted string; ends with same quote char
$quote = $char;
else if ( $char == $quote ) // Current char matches quote char; quoted string ends
$quote = '';
}
}
else
$ignoreNextChar = FALSE;
}

if ($quote != '') return false;

foreach ($sql as $query) {
if (!empty($query)) {
$r = mysql_query($query);

if (!$r) {
$this->last_error = mysql_error();
return false;
}
}
}
return true;

}

function install() {
$SQL = $this->connect();
if ($this->isInstalled())
return false;
else
return $this->execute_file("gifts/config/Shop.sql");
}
}
?>

or what file should i share?
 
Back
Top