CSGOWinBig icon indicating copy to clipboard operation
CSGOWinBig copied to clipboard

Website just says loading.

Open JonathanDelconte opened this issue 8 years ago • 24 comments

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!

JonathanDelconte avatar Mar 18 '16 16:03 JonathanDelconte

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

JonathanDelconte avatar Mar 18 '16 16:03 JonathanDelconte

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

JonathanDelconte avatar Mar 18 '16 17:03 JonathanDelconte

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

scottrot1 avatar Mar 18 '16 21:03 scottrot1

So rather than $apiKey = $arr['steamAPIKey']; it would be $apiKey = $arr['xxxxxxxxxxxxxxxxxxxxxxxx']; ?

Or more like $apiKey = xxxxxxxxxxxxx ?

JonathanDelconte avatar Mar 18 '16 22:03 JonathanDelconte

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]; ``` } ?>

JonathanDelconte avatar Mar 18 '16 22:03 JonathanDelconte

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']); }

JonathanDelconte avatar Mar 18 '16 22:03 JonathanDelconte

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 :)

TarantelTM avatar Mar 18 '16 23:03 TarantelTM

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

TarantelTM avatar Mar 18 '16 23:03 TarantelTM

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); ?>

JonathanDelconte avatar Mar 19 '16 00:03 JonathanDelconte

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();

JonathanDelconte avatar Mar 19 '16 00:03 JonathanDelconte

Any way I could add you on steam? :) Faster

JonathanDelconte avatar Mar 19 '16 00:03 JonathanDelconte

you have setup the db in mysql ?

TarantelTM avatar Mar 19 '16 00:03 TarantelTM

yes it's set up via my host, I just don't know if it's recognizing it. It should be recognizing it though

JonathanDelconte avatar Mar 19 '16 00:03 JonathanDelconte

hmm ok you have create a chat msg in the db ?

TarantelTM avatar Mar 19 '16 00:03 TarantelTM

No I tried and it wasn't showing up at all, I'm not sure what I did wrong :(

JonathanDelconte avatar Mar 19 '16 00:03 JonathanDelconte

screen

JonathanDelconte avatar Mar 19 '16 00:03 JonathanDelconte

show

That is the format

TarantelTM avatar Mar 19 '16 00:03 TarantelTM

image

I did that but it doesn't appear to have done anything.

JonathanDelconte avatar Mar 19 '16 00:03 JonathanDelconte

hmm i think its better to rent a own server for all

So you have all rights for all things

TarantelTM avatar Mar 19 '16 00:03 TarantelTM

If you can help I'll gladly pay you on paypal c:

JonathanDelconte avatar Mar 19 '16 00:03 JonathanDelconte

Cause I have paid hosting already, it's cpanel accelerated

JonathanDelconte avatar Mar 19 '16 01:03 JonathanDelconte

i cant hardcore the site for you because i code my own site atm and my brain is full with my site xD

TarantelTM avatar Mar 19 '16 01:03 TarantelTM

:c well if you ever have any free time please do let me know :) ANy help is greatly appreciated.

JonathanDelconte avatar Mar 19 '16 01:03 JonathanDelconte

$dbHost = 'localhost'; ?

signedbydc avatar Mar 23 '16 08:03 signedbydc