Jump to content

c4n10

Members
  • Posts

    17
  • Joined

  • Last visited

c4n10's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You are absolutely correct, turns out the backend code we are using hasn't been writing to the db so there has been no info to retrieve so it is returning an empty array, thank you for the help!
  2. Hello all, I am working on a site which is returning "Warning: Invalid argument supplied for foreach()" The function that is returning the warning is: function currentworkers() { $currentworkers = 0; if (!($currentworkers = getCache("pool_workers"))) { $uwa = $this->workerhashrates(); foreach ($uwa as $key => $value) { if ($value > 0) $currentworkers += 1; $ } setCache("pool_workers", $currentworkers, 1800); } return $currentworkers; } Any help is greatly appreciated, thanks!!!
  3. K, fixed that issue... working on a couple others...
  4. ok, so error reporting returns: Fatal error: Cannot redeclare connectToDb() (previously declared in /var/www/includes/requiredFunctions.php:88) in /var/www/includes/requiredFunctions.php on line 93
  5. I'm still in the new to moderate level area of php, most of my experience comes from editing open-source code, I will probably be ridiculed for this, but I don't know how to properly use echo statements, where in my code should I be putting the echo statement and where should I be putting the error reporting statements...? Sorry for any inconvenience...
  6. In case it is useful, here are the contents of the cookie being created in my browser by the site: Name: minelitecoin.com Content: 710-4fc03a51e6fc32927f011ecb7c25efa1fd498d9902c2efe73f63a3e28fb584e8 Domain: .minelitecoin.com Path: /var/www Send for: Any kind of connection Accessible to script: Yes Created: Thursday, March 21, 2013 7:25:19 AM Expires: Thursday, March 28, 2013 7:25:19 AM
  7. Oh, I see, whoops... Ok, I now have this: if(isset($_COOKIE[$cookieName])){ Still not working, but one step in the right direction, thanks!
  8. Hi, thanks for the quick response! So then: if(isSet!=isset($_COOKIE[$cookieName])){ or if(!=isSet($_COOKIE[$cookieName])){ How should this line be written...?
  9. Sorry about that, thanks for the tip! Here is login.php: <?php /* Copyright (C) 41a240b48fb7c10c68ae4820ac54c0f32a214056bfcfe1c2e7ab4d3fb53187a0 Name Year (sha256) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Website Reference:http://www.gnu.org/licenses/gpl-2.0.html Note From Author: Keep the original donate address in the source files when transferring or redistrubuting this code. Please donate at the following address: 1Fc2ScswXAHPUgj3qzmbRmwWJSLL2yv8Q */ //This page will attempt to take informtion from the user and create an ecrypted session inside of a cookie //Include site functions include("includes/requiredFunctions.php"); //Filter input results before querying them into database $user = mysql_real_escape_string($_POST["username"]); $pass = mysql_real_escape_string($_POST["password"]); //Check the supplied username & password with the saved username & password $checkPassQ = mysql_query("SELECT id, secret, pass, accountLocked, accountFailedAttempts FROM webUsers WHERE username = '".$user."' LIMIT 0,1"); $checkPass = mysql_fetch_object($checkPassQ); $userExists = $checkPass->id; if($checkPass->accountFailedAttempts >= 5){ echo "Account has been banned"; die(); } //Check if user exists before checking login data if($userExists > 0){ //Check to see if this user has an `accountLocked` if($checkPass->accountLocked < time()){ //Check to see if this user has attempted to login more then the maximum allowed failed attempts if($checkPass->accountFailedAttempts < 5){ $dbHash = $checkPass->pass; $inputHash = hash("sha256", $pass.$salt); //Do Check if($dbHash == $inputHash){ //Give out the secrect SHHH!! be quite too! //Get ip address so we can hash with the cookie so no one can steal the password $ip = $_SERVER['REMOTE_ADDR']; $timeoutStamp = time()+60*60*24*7; //1 week session //Update logged in ip address so no one can steal this cookie hash unless mysql_query("UPDATE `webUsers` SET `sessionTimeoutStamp` = ".$timeoutStamp.", `loggedIp` = '".$ip."' WHERE `id` = ".$userExists); //Set cookie in browser for session $hash = $checkPass->secret.$dbHash.$ip.$timeoutStamp; $cookieHash = hash("sha256", $hash.$salt); setcookie($cookieName, $checkPass->id."-".$cookieHash, $timeoutStamp, $cookiePath, $cookieDomain); $cookieValid = true; //Display output message $outputMessage = "Welcome back, we'll be returning to the main page shortly"; mysql_query("UPDATE webUsers SET accountFailedAttempts = 0 WHERE id = $userExists"); }else{ $outputMessage = "Wrong username or password."; $lock = $checkPass->accountFailedAttempts + 1; mysql_query("UPDATE webUsers SET accountFailedAttempts = $lock WHERE id = $userExists"); } } } }else{ $outputMessage = "User name dosent exist!"; } ?> <html> <head> <title><?php echo antiXss(outputPageTitle());?> </title> <link rel="stylesheet" href="/css/mainstyle.css" type="text/css" /> <meta http-equiv="refresh" content="2;url=/"> </head> <body> <div id="pagecontent"> <h1><?php echo antiXss($outputMessage); ?><br/> <a href="/">Click here if you continue to see this message</a></h1> </div> </body> </html> And here is the universalChecklogin.php: <?php /* // Copyright (C) 2011 Mike Allison <[email protected]> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // LTC Donations: LZBZoH4uEEv82p2BpxRgw6fvgEvCFXXN4x */ $donatePercent = 0; //Check if the cookie is set, if so check if the cookie is valid if(isSet($_COOKIE[$cookieName])){ $cookieValid = false; $ip = $_SERVER['REMOTE_ADDR']; //Get Ip address for cookie validation $validateCookie = new checkLogin(); $cookieValid = $validateCookie->checkCookie(mysql_real_escape_string($_COOKIE[$cookieName]), $ip); $userId = $validateCookie->returnUserId($_COOKIE[$cookieName]); //ensure userId is numeric to prevent sql injection attack if (!is_numeric($userId)) { $userId = 0; exit; } //Get user information $userInfoQ = mysql_query("SELECT id, username, email, pin, pass, admin, api_key, IFNULL(donate_percent, '0') as donate_percent, ltc_lock FROM webUsers WHERE id = $userId LIMIT 0,1"); if ($userInfo = mysql_fetch_object($userInfoQ)) { $authPin = $userInfo->pin; $hashedPass = $userInfo->pass; $isAdmin = $userInfo->admin; $currentUserHashrate = $stats->userhashrate($userInfo->username); $userApiKey = $userInfo->api_key; $donatePercent = $userInfo->donate_percent; $userEmail = $userInfo->email; $userLtcLock = $userInfo->ltc_lock; $totalUserShares = $stats->usersharecount($userId); //Get current round share information, estimated total earnings $totalOverallShares = $stats->currentshares(); //Calculate Estimate $userRoundEstimate = 0; if($totalUserShares > 0 && $totalOverallShares > 0) { //Get site percentage $sitePercent = 0; if (is_numeric($settings->getsetting("sitepercent"))) $sitePercent = $settings->getsetting("sitepercent")/100; if ($totalOverallShares > $litecoinDifficulty) $estimatedTotalEarnings = $totalUserShares/$totalOverallShares; else $estimatedTotalEarnings = $totalUserShares/$litecoinDifficulty; $estimatedTotalEarnings *= $bonusCoins*(1-$sitePercent); //The expected LTC to be givin out $userRoundEstimate = round($estimatedTotalEarnings, ; } //Get Current balance $currentBalanceQ = mysql_query("SELECT balance, IFNULL(sendAddress,'') as sendAddress, threshold FROM accountBalance WHERE userId = '$userId' LIMIT 0,1"); if ($currentBalanceObj = mysql_fetch_object($currentBalanceQ)) { $currentBalance = $currentBalanceObj->balance; //Get payment address that is associated wit this user $paymentAddress = $currentBalanceObj->sendAddress; $payoutThreshold = $currentBalanceObj->threshold; } else { $currentBalance = 0; $paymentAddress = ""; $payoutThreshold = 0; } } } ?> Again, thanks in advance to anyone who can help me out!
  10. Hello, I am designing the site at http://minelitecoin.com I am having an issue with login. I am able sto successfully create new accounts, the mysql database is appropriately updated then I proceed to login. The login.php script seems to execute flawlessly and I am told the login is successful but then something goes wrong after the login re-direct and I am returned to the homepage without being logged in. I suspect an error in a script called universalChecklogin.php which is called by every page for cookie validation. Here is the contents of my "login.php": http://pastebin.com/DYC9E0xw And here are the contents of the universalChecklogin.php: http://pastebin.com/qtN2dZkD One more time, here is the link of the code working live: http://minelitecoin.com If you need any other information please feel free to ask, any help is great;y appreciated... Thanks!!!
  11. Wow... Come to a php help forum to ask for help with a page called "index.php" and catch attitude, disrespect and hostility from an apparent moderator... WTF just happened...?
  12. Well, I don't insist on using java, I just don't know how I would change it, as I said I didn't write the code myself, I'm not the world's greatest web developer, especially when modifying someone else's half-rate code, lol... If you can suggest how I can modify the code so I can completely disable java and maintain operability of the functions being called from the second page of code I would be more than happy to change it =) Also, if you can point out why the drop-down boxes allow me to select Bitcoin, Litecoin, PPCoin and RuCoin but won't allow me to select any of the others that would be awesome too as I can't find any difference between the ones that ARE working and the ones that AREN'T and it's driving me crazy, lol...
  13. So strange because the first code came from "index.php" and the second code came from "exchanger.js" I can still call those functions in the second code without the need for the onclick='javascript:rolldown' and other onclick='javascript:*' functions...? How would I go about editing out the java calls while still maintaining operability of the functions being called...?
  14. So I can just comment out or remove the java and it should still work as html...? Sorry, I didn't write this code, lol.... I've been digging through it trying to put together a site modifying someone else's open source code (intersango) and have most of it working, but for some reason just can not get these drop-down boxes to work...
  15. The entire backend code that makes the page work is php...? EDIT: Ah, I see I am mistaken, the page has a php extension but is written in html and java, my mistake... Why is java not a good choice for simple drop-down boxes...? I will be filtering the input fields on this page, just want working code first...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.