Jump to content

ElectricWizard

Members
  • Posts

    18
  • Joined

  • Last visited

ElectricWizard's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. So I got the problem fixed! I got my hosting company to switch the php version manually to 5.4 and it works now! I replaced all of my ill thought edits with the original code, and it was a success
  2. Both of those didn't give any errors, but the non clearing of the balance problem is still there. There are about four or five edits I did to this code which might potentially cause problems. They are: Line 27... $lastClaim = strtotime(current($lastClaimQ->fetch_assoc())); ...used to be: $lastClaim = strtotime($lastClaimQ->fetch_row()[0]); Line 54... $referral = $referralQ->fetch_assoc(); ...used to be: $referral = $referralQ->fetch_row()[0]; Lines 87 - 89... $row = $balanceQ->fetch_assoc(); if($row['balance'] >= 0){ $url = "https://inputs.io/api?action=send&key=$apiKey&pin=$apiPin&note=" . urlencode($cashoutMessage . " | MyFaucet Powered") . "&address=" . urlencode($email) . "&amount=" . ($row['balance'] / 100000000); ...used to be: if($balanceQ->fetch_row()[0] >= 0){ $url = "https://inputs.io/api?action=send&key=$apiKey&pin=$apiPin&note=" . urlencode($cashoutMessage . " | MyFaucet Powered") . "&address=" . urlencode($email) . "&amount=" . ($balance / 100000000); I am not sure if those tell you anything else that might be helpful.
  3. I went and replied to my other topic. Seems to be an issue with using the incorrect php version.
  4. When I check the version of php, I get "5.3.27". Weird, though, since I changed it so that it would use 5.5 but that clearly didn't work. Yes I changed that line before. It was an error I was getting on most instances of that line and similar. It was first "Parse error: syntax error, unexpected '[' in /home/*************/public_html/config.php on line 21". The line was: $rewards = [1000, 1500, 2000, 2500, 3000, 3500, 4000, 5000]; The guy who helped me with it said to change that line to this: $rewards = array(1000, 1500, 2000, 2500, 3000, 3500, 4000, 5000); That fixed that error, but any other line that used what I understand to be the new format of php gave me a similar error, including line 77 of faucet.php. Line 77 used to be: $balance = $balanceQ->fetch_row()[0]; But it gave the "unexpected [" error as well. So I went through and changed all of those lines so that it would not give me errors anymore. Line 77 became: $balance = $balanceQ->fetch_assoc(); Obviously that was not the correct solution, though. But it definitely seems it's a problem with the php version. My hosting control panel has a way of changing the version of php used, but changing it to 5.5 did not work.
  5. I believe it is something related to a problem I had before, and the script isn't quite jiving properly. The code I downloaded has been altered since I got it, and you can see the thread about it here, (linking it seems like a better idea than typing everything out again). When someone cashes out, it is supposed to use the inputs.io API in order to automatically send the Bitcoins to someone else's inputs.io account. The problem I am seeing is that there are two transactions appearing in my inputs.io account. After checking with my test account, I am determined that it does not clear the balance, allowing someone to cash out an unlimited amount of times. I have a feeling it might have something to do with the edits to my script, which were done to solve the problem in the thread I linked above. I really hope I can get this fixed quickly, since this could cost me money. I am going to have to monitor cashouts and reset people's balances manually if they try and cash out. I thank anyone for any assistance they can give.
  6. I tested it using one of my other email addresses, and it looks like it worked, thanks!!
  7. That's what I should replace line 88 with? If so, it gave me "Parse error: syntax error, unexpected '[' in ******* on line 88"
  8. The result was: array(1) { ["balance"]=> string(5) "14300" } 14300 is the balance of my test email address
  9. Okay, since I'm still not entirely clear exactly what var_dump means, I will include the part of faucet.php that addresses $balance. I added it to the beginning of the code I pasted into the OP; the new part is line 73 - 83, and the added part establishes the parameters which $balance is measured against. if(isset($_POST['cashout'])){ // ok, cash out $balanceQ = $mysqli->query("SELECT balance FROM balances WHERE email='$email'"); if($balanceQ->num_rows){ $balance = $balanceQ->fetch_assoc(); if($balance < 10000){ echo "CONFIG ERROR: Amount is too small"; exit; } if($balance >= $cashout){ $mysqli->query("UPDATE balances SET balance=balance-$balance WHERE email='$email'"); $balanceQ = $mysqli->query("SELECT balance FROM balances WHERE email='$email'"); //we check again to prevent race attacks $row = $balanceQ->fetch_assoc(); if($row['balance'] >= 0){ $url = "https://inputs.io/api?action=send&key=$apiKey&pin=$apiPin&note=" . urlencode($cashoutMessage . " | MyFaucet Powered") . "&address=" . urlencode($email) . "&amount=" . ($balance / 100000000); $response = file_get_contents($url); if($response[0] == "["){ //success echo "<div class='alert alert-success'>Successful cashout to $email - enjoy!</div>"; } else { echo "<div class='alert alert-error'>An error has occured - $response</div>"; if($response == "NO_BALANCE"){ echo "<div class='alert alert-error'>The site does not have enough coins to pay out!</div>"; $mysqli->query("UPDATE balances SET balance=balance+$balance WHERE email='$email'"); } If this is not what you wanted, I am sorry.
  10. Then I am not sure exactly what you mean. I am rather noobish.
  11. The idea of this script is, to cashout, it checks someone's balance against what is in the database associated with their inputs.io email address, and if it meets a certain threshold, it gives them a payout. The threshold is 10,000, so if their balance is that or higher, it will use my inputs.io account to pay them (using the inputs.io API). When a successful cashout occurs, it gives a confirmation message. The person who brought this error to my attention was trying to cash out when he discovered it, and I know he has a high enough balance to cash out.
  12. Both of these give me "Unsupported operand types in blahblah on line 89". I am replacing line 87 with this, right? (just making sure I am doing the editing correctly). Replacing line 87 pushes the original line 88 to 89, so it's basically the same error for some reason. I forgot to mention this error occurs when someone tries to cash out. The top half of the page loads properly when the cashout button is hit, but then that error is in the centre of the page.
  13. It kept giving me errors about that, and changing it was the only way it would stop giving errors. I have no idea why
  14. This gave me: unexpected T_VARIABLE in /home/*****/public_html/********/faucet.php on line 88 This one gave me: syntax error, unexpected '[' in /home/**********/public_html/*******************/faucet.php on line 87
  15. I have a Bitcoin faucet site, all is working well now. Except, I want to use Solvemedia instead of Re-Captcha. I can't figure out how to do this (being a noob). I will copy paste the instructions from the Solvemedia site. If you want to read the rest, the link is: https://portal.solvemedia.com/portal/help/pub/php/ The relevant files for this are config.php and faucet.php. Faucet.php is the page shown after someone submits their email address, and is the page the captcha is actually displayed on. Therefore, this is the only relevant page (there's another one but it only needs one file name changed, and I can do that). I also have uploaded the solvemedialib file already. Here is config.php: <?php // Database Config // You will need to import the SQL file first and create a MySQL database and user $sqlHost = "*********************"; //Unless your MySQL server is on another server, leave it at 127.0.0.1 $sqlUser = "*********************"; //Your MySQL username with permissions to modify the new database you created $sqlPassword = "*********************"; //Your MySQL password $sqlDatabase = "*********************"; //The MySQL database you created and imported $mysqli = new mysqli($sqlHost, $sqlUser, $sqlPassword, $sqlDatabase); if($mysqli->connect_errno){ echo "SQL error: " . $mysqli->connect_error; exit; } // Site Config $siteName = "*********************"; // Array of 8 rewards in satoshis. 100,000,000 satoshis = 1 BTC // 1 mBTC = 100,000 Satoshis // 1 µBTC (microbitcoin) = 100 Satoshis $rewards = array(100, 150, 200, 250, 300, 350, 400, 500); $minReward = min($rewards); $maxReward = max($rewards); $dispenseTime = 21600; // how long per dispense (in seconds) $dispenseTimeText = relative_time(time() + $dispenseTime); $cashout = 10000; //min cashout. must be at least 10,000 satoshi (0.1 mBTC for Inputs) $cashoutMessage = "Cashout from ********************* - thanks for using!"; // note sent with cash out // Inputs.io Account // You need to make a NEW inputs.io account and generate an API key in the security tab $apiKey = "*********************"; $apiPin = "*********************"; // Your PIN // Make sure you have added balance to it! $referPercent = 10; //referral percentage // Recaptcha API keys // You need GET YOUR OWN. Here https://www.google.com/recaptcha/admin/create $recaptchaPub = "*********************"; $recaptchaPrv = "*********************"; $links = "<a href='http://devfaucet.com/?id=53386' target='_blank'>Dev Faucet</a><br/><a href='http://www.domesticpineapple.com/?id=37799' target='_blank'>Domestic Pineapple</a><br/><a href='http://www.bitcoininformation.info/?ref=17ZoiL16X6BkpnensHE8vbvdDVtvY8NG36' target='_blank'>BitcoinInformation</a><br/><a href='http://faucet.xparadox.co.uk/?id=32656' target='_blank'>xparadox</a><br/><a href='http://energybtc.com/?id=28264' target='_blank'>EnergyBTC</a><br/><a href='http://energy24h.org/?id=4365' target='_blank'>Energy24h</a><br/><a href='http://sharefaucet.tk/?id=21372' target='_blank'>Share Faucet</a><br/><a href='http://bitcoinfaucet.tk/?ref=17ZoiL16X6BkpnensHE8vbvdDVtvY8NG36' target='_blank'>BitcoinFaucet.tk</a><br/><a href='http://*OMITTED*sake.org/?id=17771' target='_blank'>*OMITTED*sSake</a><br/><a href='http://cur.lv/3u0cr' target='_blank'>BitHits</a><br/><a href='http://cur.lv/3u0ah' target='_blank'>BitVisitor</a><br/><a href='http://cur.lv/1wn61' target='_blank'>CoinAd</a><br/><a href='https://coinurl.com/index.php?ref=d1ab44c078261829919b8206fce9056d' target='_blank'>CoinURL Link Shortener</a><br/><a href='http://www.landofbitcoin.com/?r=OxI2EYeI35KE441F' target='_blank'>Land of Bitcoin</a><br/><a href='http://energyfaucet.org/?id=62932' target='_blank'>EnergyFaucet.org</a><br/><a href='https://strikesapphire.com/?afc=neoIbZu4nS' target='_blank'>Strike Sapphire Bitcoin Casino</a><br/><a href='http://dailybitcoins.org/index.php?aff=25a62da8c1744ac545d7d7f4fb4ae570' target='_blank'>Daily Bitcoins</a><br/>"; // Advertisement Codes I just omitted the advertisement codes because they aren't relevant. Also redacted sensitive information with asterisks. Here is faucet.php: <?php require_once('core.php'); echoHeader("Faucet"); if(isset($_POST['email']) && strlen($_POST['email']) > 0 || $_SESSION['email']){ if(isset($_SESSION['email']) || filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)){ if(isset($_POST['email'])) $_SESSION['email'] = $mysqli->real_escape_string($_POST['email']); echo "<h2>Welcome</h2>"; echo "<p>Your email is: " . htmlentities($_SESSION['email']) . "</p>"; } else { echo "<div class='alert alert-error'>Not a valid email address!</div>"; echo "<a href='javascript:history.back()' class='btn btn-success'>Go back</a>"; } $email = (isset($_SESSION['email']) ? $_SESSION['email'] : $mysqli->real_escape_string($_POST['email'])); $userIP = $_SERVER['REMOTE_ADDR']; $lastClaimQ = $mysqli->query("SELECT dispensed FROM dispenses WHERE email='$email' OR ip='$userIP' ORDER BY id DESC LIMIT 1"); $canClaim = true; $nextClaim; $recaptcha = recaptcha_get_html($recaptchaPub); echo $mysqli->error; if($lastClaimQ->num_rows){ $lastClaim = strtotime(current($lastClaimQ->fetch_assoc())); if($lastClaim + $dispenseTime > time()){ $canClaim = false; $nextClaim = $lastClaim + $dispenseTime; } } if($canClaim){ if(isset($_POST['claim'])){ $resp = recaptcha_check_answer ($recaptchaPrv, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if(!$resp->is_valid){ echo "<div class='alert alert-error'>CAPTCHA incorrect. Please try again.</div>"; } else { $referral = (isset($_SESSION['referer']) ? $_SESSION['referer'] : 0); $getAmount = (hash("SHA256", $email) == "******************************************" ? $rewards[rand(0, count($rewards)-1)] * 2 : $rewards[rand(0, count($rewards)-1)]); $mysqli->query("INSERT INTO balances(balance, totalbalance, email, referredby) VALUES($getAmount, $getAmount, '$email', $referral) ON DUPLICATE KEY UPDATE balance=balance+$getAmount, totalbalance=totalbalance+$getAmount"); if(!$mysqli->insert_id){ // existing user, check referral $referralQ = $mysqli->query("SELECT referredby FROM balances WHERE email='$email'"); $referral = $referralQ->fetch_assoc(); } $ua = $mysqli->real_escape_string($_SERVER['HTTP_USER_AGENT']); $mysqli->query("INSERT INTO dispenses(amount, dispensed, email, ip, useragent) VALUES('$getAmount', NOW(), '$email', '$userIP', '$ua')"); if($referral != 0){ $referredAmount = $getAmount * ($referPercent / 100); $mysqli->query("UPDATE balances SET balance=balance+$referredAmount, totalbalance=totalbalance+$referredAmount WHERE id='$referral'"); } echo "<div class='alert alert-success'>Congrats! You have claimed <strong>" . number_format($getAmount) . "</strong> satoshis.</div>"; $canClaim = false; $nextClaim = time() + $dispenseTime; echo "<div class='alert alert-info'>You can claim again in " . relative_time($nextClaim) . "<br /></div>"; } } } if(isset($_POST['cashout'])){ // ok, cash out $balanceQ = $mysqli->query("SELECT balance FROM balances WHERE email='$email'"); if($balanceQ->num_rows){ $balance = $balanceQ->fetch_assoc(); if($balance < 10000){ echo "CONFIG ERROR: Amount is too small"; exit; } if($balance >= $cashout){ $mysqli->query("UPDATE balances SET balance=balance-$balance WHERE email='$email'"); $balanceQ = $mysqli->query("SELECT balance FROM balances WHERE email='$email'"); //we check again to prevent race attacks if($balanceQ->fetch_assoc() >= 0){ $url = "https://inputs.io/api?action=send&key=$apiKey&pin=$apiPin&note=" . urlencode($cashoutMessage . " | MyFaucet Powered") . "&address=" . urlencode($email) . "&amount=" . ($balance / 100000000); $response = file_get_contents($url); if($response[0] == "["){ //success echo "<div class='alert alert-success'>Successful cashout to $email - enjoy!</div>"; } else { echo "<div class='alert alert-error'>An error has occured - $response</div>"; if($response == "NO_BALANCE"){ echo "<div class='alert alert-error'>The site does not have enough coins to pay out!</div>"; $mysqli->query("UPDATE balances SET balance=balance+$balance WHERE email='$email'"); } } } } } } echo "<div class='well'>Your balance: "; $userQ = $mysqli->query("SELECT * FROM balances WHERE email='$email'"); if($userQ->num_rows){ $userR = $userQ->fetch_assoc(); $balance = $userR['balance']; echo "Current: <strong>" . number_format($userR['balance']) . "</strong> satoshi | All time: <strong>" . number_format($userR['totalbalance']) . "</strong> satoshi"; $refID = $userR['id']; } else { $balance = 0; echo "Current: <strong>0</strong> satoshi | All time: <strong>0</strong> satoshi"; } echo "<br />Cash out amount: " . number_format($cashout) . " satoshis<br />"; if($balance >= $cashout){ echo "<form method='post'><input type='hidden' name='cashout' value='true'><input type='submit' class='btn btn-success' value='Cash out all'></form>"; } else { echo "<button type='button' disabled='disabled' class='btn btn-success'>Cash out all</button>"; } echo "</div><div class='well'>"; echo getAd($bannerAds); echo "</div><div class='well'> <strong>Get a Dispense: </strong>"; if($canClaim){ echo "<form method='post'><div style='margin: 0 auto; width: 318px'>"; echo $recaptcha; echo "</div><input type='hidden' name='claim' value='true'><input type='submit' value='Claim' class='btn btn-success btn-large'> </form>"; } else { echo "You can claim again in " . relative_time($nextClaim) . ".<br /><strong>Try these sites:</strong> $links"; } echo "</div>"; echo getAd($textAds); if(isset($refID)){ echo "<div class='well'> <p><strong>Refer and get $referPercent% of every dispense!</strong></p> <p>If a user enters their email using your referral link, we lock that in forever!</p> <p>Your link: <strong>http://" . $_SERVER['SERVER_NAME'] . "/?id=$refID</strong></p> </div>"; } } else { echo "<div class='alert alert-error'>You have not entered your email address!</div>"; echo "<a href='javascript:history.back()' class='btn btn-success'>Go back</a>"; } echoFooter(); ?> So, somehow the instructions in the link (which I am too noobish to understand) should be as easy as dropping the SolveMedia code into the above files. My problem is that I don't know where. Can anyone here figure it out? I assume the first small part of the code does into the config.php file, and replaces the Recaptcha section. The faucet.php, however, I can't figure out on my own. Thanks in advance!
×
×
  • 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.