Всем здравствуйте ребята, у меня есть сайт, по открытию кейсов в cs:go и есть пролбема
В общем при авторизации чрез стим, если ник в стиме будет допустим dosik',`money`='5000 то баланс на сайте накручивается, соответственно будет 5000!
Прошу людей кто с этим сталкивался помочь решить проблему, вот код авторизации
<?php
ob_start();
session_start();
ini_set('error_reporting', E_ALL|E_STRICT);
ini_set('display_errors', 1);
require ('openid.php');
function logoutbutton() {
//echo "<form action=\"steamauth/logout.php\" method=\"post\"><input value=\"Logout\" type=\"submit\" /></form>"; //logout button
echo "<a href=\"steamauth/logout.php\" class=\"button7\">Logout</a>";
}
function steamlogin()
{
try {
require("settings.php");
$openid = new LightOpenID($steamauth['domainname']);
$button['small'] = "small";
$button['large_no'] = "large_noborder";
$button['large'] = "large_border";
$button = $button[$steamauth['buttonstyle']];
if(!$openid->mode) {
if(isset($_GET['login'])) {
$openid->identity = 'https://steamcommunity.com/openid';
header('Location: ' . $openid->authUrl());
}
//echo "<form action=\"?login\" method=\"post\" style=\"display: inline;\"> <input style=\"display: inline;\" type=\"image\" src=\"https://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_".$button.".png\"></form>";
//echo "<a href=\"?login\" class=\"login-link\"></a>";?>
<?php
}
elseif($openid->mode == 'cancel') {
echo 'User has canceled authentication!';
} else {
if($openid->validate()) {
$id = $openid->identity;
$ptn = "/^https:\/\/steamcommunity\.com\/openid\/id\/(7[0-9]{15,25}+)$/";
preg_match($ptn, $id, $matches);
var_dump($steamauth['loginpage']);
//session_start();
$_SESSION['steamid'] = $matches[1];
include_once("set.php");
$query = mysql_query("SELECT * FROM users WHERE steamid='".$_SESSION['steamid']."'");
if (mysql_num_rows($query) == 0) {
if(isset($_SESSION['ref'])) {
mysql_query("INSERT INTO users (steamid, referal, money) VALUES ('".$_SESSION['steamid']."',".$_SESSION['ref'].", 10)") or die("MySQL ERROR: ".mysql_error());
} else {
mysql_query("INSERT INTO users (steamid) VALUES ('".$_SESSION['steamid']."')") or die("MySQL ERROR: ".mysql_error());
}
$query2 = mysql_query("SELECT * FROM users");
$id = mysql_num_rows($query2);
if($id % 100 == 0) {
mysql_query("UPDATE users SET bonus=(bonus+1) WHERE steamid='".$_SESSION["steamid"]."'");
mysql_query("UPDATE users SET money=(money+50) WHERE steamid='".$_SESSION["steamid"]."'");
}
}
include_once("userInfo.php");
$s = array("'","\"");
$r = array("","");
$d = $steamprofile['personaname'];
$d = htmlspecialchars($d);
$d = stripslashes($d);
$d = trim($d);
$d = str_replace($s, $r, $d);
$d = mysql_escape_string($d);
mysql_query("UPDATE users SET nickname='".$d."', avatar='".$steamprofile['avatarfull']."' WHERE steamid='".$_SESSION["steamid"]."'");
$user = mysql_fetch_array($query, MYSQL_ASSOC);
$query = mysql_query("SELECT * FROM users WHERE steamid='".$_SESSION['steamid']."'");
$user = mysql_fetch_array($query, MYSQL_ASSOC);
if(isset($_SESSION['ref']) && $user['referal'] == "" && (int)$user['id'] != (int)$_SESSION['ref']) {
$result = mysql_query("SELECT * FROM users WHERE id=".(int)$_SESSION['ref']);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
mysql_query("UPDATE users SET referal='".$row['steamid']."' WHERE steamid='".$_SESSION['steamid']."'");
mysql_query("UPDATE users SET money=(money+10) WHERE steamid='".$_SESSION['steamid']."'");
}
if (isset($steamauth['loginpage'])) {
header('Location: '.$steamauth['loginpage']);
}
} else {
echo "User is not logged in.\n";
}
}
} catch(ErrorException $e) {
echo $e->getMessage();
}
}
?>