CSGOWinBig
CSGOWinBig copied to clipboard
Website just says loading.
I have no idea why. I've been trying for days to fix the steam login but instead of the login button it just says loading.. The link is www.csgo-crazy.com ANY suggestions would be greatly appreciated!
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/local/apache/htdocs/../passwords.txt) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /home/a7862206/public_html/php/SteamAuthentication/steamauth/settings.php on line 3
Free Web Hosting no file found
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/local/apache/htdocs/../passwords.txt) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /home/a7862206/public_html/php/default.php on line 11
your free host does not allow access outside of the root directory. Either change host or hardcode the password and steam api in instead of using the passwords.txt
So rather than $apiKey = $arr['steamAPIKey']; it would be $apiKey = $arr['xxxxxxxxxxxxxxxxxxxxxxxx']; ?
Or more like $apiKey = xxxxxxxxxxxxx ?
and i already hardcoded in the dbpassword I think. Here's my default.php
1, 'data' => $data)); } function jsonErr($errMsg) { return json_encode(array('success' => 0, 'errMsg' => $errMsg)); } function getSteamAPIKey() { $fileLoc = $_SERVER['DOCUMENT_ROOT'] . '/../passwords.txt'; if (file_exists($fileLoc)) { $fh = fopen($fileLoc, 'r'); $jsonStr = fgets($fh); $arr = json_decode($jsonStr, true); $key = $arr['steamAPIKey']; fclose($fh); return $key; } else { die('no file found'); } } function postVar($varName) { $var = isset($_POST[$varName]) ? $_POST[$varName] : null; ``` if (is_null($var) || strlen($var) === 0) { return null; } else { return $var; } ``` } function getVar($varName) { $var = isset($_GET[$varName]) ? $_GET[$varName] : null; ``` if (is_null($var) || strlen($var) === 0) { return null; } else { return $var; } ``` } # Thanks to TheAnthonyNL on Github for this function function steamid32ToSteamid64($steamid32) { $iServer = "0"; $iAuthID = "0"; ``` $szTmp = strtok($steamid32, ":"); while(($szTmp = strtok(":")) !== false) { $szTmp2 = strtok(":"); if($szTmp2 !== false) { $iServer = $szTmp; $iAuthID = $szTmp2; } } if($iAuthID == "0") return "0"; $steamId64 = bcmul($iAuthID, "2"); $steamId64 = bcadd($steamId64, bcadd("76561197960265728", $iServer)); $part = explode('.',$steamId64); return $part[0]; ``` } ?>
Now it says Fatal error: Call to a member function query() on a non-object in /home/a7862206/public_html/php/login-status.php on line 36
My code for this is
$stmt = $db->query('SELECT * FROM history'); $allGames = $stmt->fetchAll();
$totalGamesPlayed = count($allGames);
$totalMoneyWon = 0; foreach ($allGames as $game) { $totalMoneyWon += intval($game['potPrice']); }
function getDB() {
$dbHost = 'localhost';
$db = 'csgocraz_mysql';
$dbUser = 'csgocraz_jonny';
$dbPass = 'johnnyd123';
// Get database password from outside of web root
// $fileLoc = $_SERVER['DOCUMENT_ROOT'] . '/../passwords.txt';
// if (file_exists($fileLoc)) {
// $fh = fopen($fileLoc, 'r');
// $jsonStr = fgets($fh);
// $arr = json_decode($jsonStr, true);
// $dbPass = jonnyd123;
// fclose($fh);
// } else {
// die('no file found');
// }
$db = new PDO("mysql:host=$dbHost;dbname=$db;charset=utf8mb4", $dbUser, $dbPass);
return $db;
}
I think that is a begin for this :)
But you can also rent a cheap Vserver so you can create a passwords.xtx outside of the www folder. Here you can rent cheap Vservers https://goo.gl/BXolNt
Well I fixed my default.php but now my issue is the error Fatal error: Call to a member function query() on a non-object in /home/a7862206/public_html/php/login-status.php on line 36
My login-status.php is as follows:
prepare('SELECT * FROM users WHERE steamId64 = :id'); $stmt->bindValue(':id', $steam64Id); $stmt->execute(); # First, check the count if ($stmt->rowCount() === 0) { $tradeToken = null; } else { $userInfo = $stmt->fetch(); $tradeToken = $userInfo['tradeToken']; } ``` } else { # This is only for when they are not logged in, so the trade token wouldn't matter $tradeToken = null; } # Home page stuff: Minimum bet ($0.20), total games played, total money won, biggest pot ever $stmt = $db->query('SELECT \* FROM history'); $allGames = $stmt->fetchAll(); $totalGamesPlayed = count($allGames); $totalMoneyWon = 0; foreach ($allGames as $game) { $totalMoneyWon += intval($game['potPrice']); } # Get all games from the past 24 hours for home page info shit /\* $stmt = $db->query('SELECT \* FROM history WHERE date > DATE_SUB(NOW(), INTERVAL 24 HOUR) AND date rowCount(); $allFromPastDay = $stmt->fetchAll(); $moneyWonToday = 0; $biggestPotToday = 0; foreach ($allFromPastDay as $pot) { $potPrice = $pot['potPrice']; ``` $moneyWonToday += $potPrice; if ($potPrice > $biggestPotToday) { $biggestPotToday = $potPrice; } ``` } */ # Get the max pot price ever $stmt = $db->query('SELECT MAX(potPrice) FROM history'); $row = $stmt->fetch(); $biggestPotEver = $row['MAX(potPrice)']; $infoArr = array( 'totalGamesPlayed' => $totalGamesPlayed, 'totalMoneyWon' => $totalMoneyWon, 'biggestPotEver' => $biggestPotEver ); $data = array( 'loginStatus' => $loginStatus, 'userInfo' => $loginStatus === 1 ? $steamprofile : null, 'tradeToken' => $tradeToken, 'info' => $infoArr ); echo jsonSuccess($data); ?>
my line 36 is
Home page stuff: Minimum bet ($0.20), total games played, total money won, biggest pot ever
$stmt = $db->query('SELECT * FROM history'); $allGames = $stmt->fetchAll();
Any way I could add you on steam? :) Faster
you have setup the db in mysql ?
yes it's set up via my host, I just don't know if it's recognizing it. It should be recognizing it though
hmm ok you have create a chat msg in the db ?
No I tried and it wasn't showing up at all, I'm not sure what I did wrong :(
That is the format
I did that but it doesn't appear to have done anything.
hmm i think its better to rent a own server for all
So you have all rights for all things
If you can help I'll gladly pay you on paypal c:
Cause I have paid hosting already, it's cpanel accelerated
i cant hardcore the site for you because i code my own site atm and my brain is full with my site xD
:c well if you ever have any free time please do let me know :) ANy help is greatly appreciated.
$dbHost = 'localhost'; ?