function process_projects($projects) { foreach ($projects as $k => $v) { $result = get_funding_aggregate($v['title'], $v['owner_email']); $rewards = get_rewards($v['title'], $v['owner_email']); $v['rewards'] = $rewards; $v['num_backers'] = $result[0]['num_backers']; $v['amount_pledged'] = $result[0]['amount_pledged']; $v['hours_left'] = hours_left($v['end_date']); $v['percent_funded'] = percent_funded($v['amount_pledged'], $v['target_funds']); $projects[$k] = $v; } return $projects; }
<tr> <th width="25%" height="34">Prize</th> <th width="17%">Chance</th> <th width="58%"> </th> </tr> <tbody> <?php $prizes = array(); $db->query("select * from tbl_prize "); if ($db->rownum() > 0) { while ($res = $db->fetchArray()) { array_push($prizes, $res['prize'] . '*' . $res['chance']); } $chancer = get_rewards(implode(',', $prizes)); } $db->query("select * from tbl_prize order by chance desc"); while ($res = $db->fetchArray()) { ?> <tr> <td width="25%"><?php echo $res['prize']; ?> Satoshi</td> <td width="17%"><?php echo $chancer[$res['prize']]; ?> </td> <td width="58%">
$rewards[$i]['title'] = htmlspecialchars_decode(stripslashes($row['title'])); $rewards[$i]['padded_invoice'] = pad($row['invoice'], 11, '0'); $rewards[$i]['total_reward'] = number_format($row['total_reward'], 2, '.', ', '); $rewards[$i]['paid_reward'] = number_format($row['paid_reward'], 2, '.', ', '); } $response = array('rewards' => array('reward' => $rewards)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'get_paid_rewards') { $order_by = 'invoices.paid_on DESC'; if (isset($_POST['order_by'])) { $order_by = $_POST['order_by']; } $rewards = get_rewards(true, $order_by); if (count($rewards) <= 0 || is_null($rewards)) { echo '0'; exit; } if (!$rewards) { echo 'ko'; exit; } foreach ($rewards as $i => $row) { $rewards[$i]['member'] = htmlspecialchars_decode(stripslashes($row['member'])); $rewards[$i]['employer'] = htmlspecialchars_decode(stripslashes($row['employer'])); $rewards[$i]['title'] = htmlspecialchars_decode(stripslashes($row['title'])); $rewards[$i]['padded_invoice'] = pad($row['invoice'], 11, '0'); $rewards[$i]['total_reward'] = number_format($row['total_reward'], 2, '.', ', '); $rewards[$i]['paid_reward'] = number_format($row['paid_reward'], 2, '.', ', ');
if ($_POST["new_password"] == $_POST["password_confirmation"]) { $q = $sql->prepare($change_password); $encrypted_pass = encryption($myHashKey, $_POST["new_password"]); $q->execute(array($encrypted_pass, "1")); $q->closeCursor(); $settings["password_set"] = '1'; } } } if ($settings["password_set"] == '0') { require 'first_time.php'; die; } $GLOBALS["settings"] = $settings; $GLOBALS["hashKey"] = $myHashKey; $rewards = get_rewards(); if ($_SERVER['REQUEST_METHOD'] === 'POST' && !isset($_POST["new_password"])) { $view['main']['result_html'] = ''; $view['main']['waiting_time'] = 0; $success = "false"; $ip = get_ip(); //Checks that the username is not empty if (!isset($_POST['username']) || $_POST['username'] == "") { $view['main']['result_html'] = '<div class="row text-center"><div class="col-sm-6 col-md-offset-3 bg-danger"><p>Missing email address!</p></div></div>'; $message = "Missing email address"; goto error; } $username = $_POST['username']; //Checks if the user has written something in the captcha box $captchaChallange = $_POST['adcopy_challenge']; $captchaResponse = $_POST['adcopy_response'];
} } else { $img_url = $prev_project[0]['img_url']; } $project_edited = update_project($prev_title, $title, $description, $category, $target_funds, $start_date, $end_date, $img_url); if ($project_edited) { $success = "Successfully updated your project!"; } else { $error = "Error updating project. Please try again!"; } } else { if (isset($req_params['edit']) || isset($req_params['delete'])) { $project_title = htmlspecialchars($req_params['title']); $project_owner = htmlspecialchars($req_params['owner']); $project = get_project($project_title, $project_owner); $rewards = get_rewards($project_title, $project_owner); $title = $project[0]['title']; $description = $project[0]['description']; $category = $project[0]['category']; $target_funds = $project[0]['target_funds']; $start_date = $project[0]['start_date']; $end_date = $project[0]['end_date']; $img_url = $project[0]['img_url']; } else { if (isset($req_params['publish'])) { $project_title = htmlspecialchars($req_params['title']); $project_owner = htmlspecialchars($req_params['owner']); publish_project($project_title, $project_owner); } else { if (isset($_POST['submit']) && $_POST['submit'] == "Delete") { $prev_title = $_POST['prev_title'];
function shortcode_handler() { global $wpdb; $settings = array(); $time = time(); $myHashKey = "8c278cfb4784588efd29effc613e5983"; $settings = get_option('wedevs_basics'); $GLOBALS["settings"] = $settings; $GLOBALS['hashKey'] = $myHashKey; $rewards = get_rewards(); if (isset($_POST['xapoform']) && $_POST['xapoform'] == "posted") { $view['main']['result_html'] = ''; $view['main']['waiting_time'] = 0; $success = "false"; $ip = get_ip(); //Checks that the username is not empty if (!isset($_POST['username']) || $_POST['username'] == "") { $view['main']['result_html'] = '<div class="row text-center"><div class="col-sm-6 col-md-offset-3 bg-danger"><p>Missing email address!</p></div></div>'; $message = "Missing email address"; goto b; } $username = $_POST['username']; //Checks if the user has written something in the captcha box $captchaChallange = $_POST['adcopy_challenge']; $captchaResponse = $_POST['adcopy_response']; if (empty($captchaChallange) || empty($captchaResponse)) { $view['main']['result_html'] = '<div class="row text-center"><div class="col-sm-6 col-md-offset-3 bg-danger"><p>Missing captcha, try again!</p></div></div>'; $message = "Missing captcha"; goto b; } $response = @file('http://verify.solvemedia.com/papi/verify?privatekey=' . $settings['solvemedia_verification_key'] . '&challenge=' . rawurlencode($captchaChallange) . '&response=' . rawurlencode($captchaResponse) . '&remoteip=' . $ip); if (!isset($response[0]) || trim($response[0]) === 'false') { $view['main']['result_html'] = '<div class="row text-center"><div class="col-sm-6 col-md-offset-3 bg-danger"><p>Wrong captcha!</p></div></div>'; $message = "Wrong captcha"; goto b; } /* $q = $sql->prepare("select * from wp_xf_users where LOWER(username) = LOWER(?) or ip = ? order by claimed_at desc"); $q->execute(array($username,$ip)); $row = $q->fetch();*/ // wordpress version starts $row = $wpdb->query($wpdb->prepare("\n\t\tselect * from wp_xf_users where LOWER(username) = LOWER(%s) or ip = %s order by claimed_at desc\n\t", array($username, $ip))); // wordpress version ends //timer check if ($row === null || $row['claimed_at'] <= $time - $settings['timer'] * 60) { $amount = intval($rewards['random_reward']); $response = pay($username, $amount, "Earnings from XXX, payed through Xapo!"); echo "<pre>"; echo $username; echo $amount; print_r($response); echo "</pre>"; try { $message = $response->message; if (!$response->success) { $success = 0; } else { $success = 1; } /* $q = $sql->prepare("INSERT into wp_xf_data (user, amount, date, result, message) values (?, ?, CURRENT_TIMESTAMP, ?, ?)"); $q->execute(array($username,$amount,$success,$message)); */ // Wordpress Version Starts $wpdb->query($wpdb->prepare("\nINSERT into wp_xf_data (user, amount, date, result, message) values (%s, %d, CURRENT_TIMESTAMP, %s, %s)\t", array($username, $amount, $success, $message))); // Wordpress Version Ends } catch (Exception $e) { goto b; } if ($response->success) { $view['main']['result_html'] = '<div class="row text-center"><div class="col-sm-6 col-md-offset-3 bg-success"><p>Congratulations you have won ' . $amount . ' Satoshis !!!</p></div></div>'; $url = get_main_url() . "?r=" . $username; $view['main']['ref_link'] = '<div class="row text-center"><div class="col-sm-6 col-md-offset-3 bg-success"><p>Share your referal link and earn a ' . $settings["referral_percentage"] . '% lifetime bonus. Your referal link is ' . $url . '</p></div></div>'; /* $q = $sql->prepare("INSERT into wp_xf_users (username, ip, claimed_at) values (?,?,?) on duplicate key update ip = values(ip), claimed_at = values(claimed_at)"); $q->execute(array($username, $ip, $time));*/ // Wordpress Version Starts $wpdb->query($wpdb->prepare("\nINSERT into wp_xf_users (username, ip, claimed_at) values (%s,%s,%s) on duplicate key update ip = values(ip), claimed_at = values(claimed_at)", array($username, $ip, $time))); // Wordpress Version Ends /* $q = $sql->prepare("Select * from wp_xf_referals where username=?"); $q->execute(array($username)); $row = $q->fetch();*/ // Wordpress Version Starts $row = $wpdb->get_results("\nSelect * from wp_xf_referals where username='******'"); // Wordpress Version Ends $ref = null; if (!$row) { //new user $ref = $_GET["r"]; /* $q = $sql->prepare("INSERT into wp_xf_referals(username,reffered_by) Values(?,?)"); $q->execute(array($username,$ref)); */ // Wordpress Version Starts $wpdb->query($wpdb->prepare("\nINSERT into wp_xf_referals(username,reffered_by) Values(%s,%s)\n", array($username, $ref))); // Wordpress Version Ends } else { $ref = $row[0]->reffered_by; } if (!is_null($ref)) { $refAmount = $amount * ($settings["referral_percentage"] / 100); $response = pay($ref, $refAmount, "Referral earnings from XXX, payed through Xapo!"); if (!$response->success) { $success = 0; } else { $success = 1; } /* $q = $sql->prepare("INSERT into wp_xf_data_referals (user, referrer, amount, date, result, message) values (?,?,?,now(),?,?)"); $q->execute(array($ref, $username, $refAmount, $success, $response->message)); */ // Wordpress Version Starts $wpdb->query($wpdb->prepare("\nINSERT into wp_xf_data_referals (user, referrer, amount, date, result, message) values (%s,%s,%d,now(),%s,%s)", array($ref, $username, $refAmount, $success, $response->message))); // Wordpress Version Ends } } else { $view['main']['result_html'] = '<div class="row text-center"><div class="col-sm-6 col-md-offset-3 bg-danger"><p>' . $response->message . '</p></div></div>'; $message = $response->message; goto b; } } else { $waitingTime = $row['claimed_at'] + $settings['timer'] * 60 - $time; if ($waitingTime > 0) { $waitingTime = format_timer($waitingTime); } $view['main']['result_html'] = '<div class="row text-center"><div class="col-sm-6 col-md-offset-3 bg-danger"><p>You can get a reward again in ' . htmlspecialchars($waitingTime) . '.</p></div></div>'; $message = "Time!!"; goto b; } } //Form on front end Starts b: ?> <div><strong><p class="alert alert-info">Your possible rewards <?php echo $rewards["reward_list_html"]; ?> </p></strong></div> <div> <strong><p>Earning bitcoins is simple:</p></strong> </div> <?php echo $view['main']['result_html']; ?> <?php echo $view['main']['ref_link']; ?> <form method="Post"> <input type="hidden" name="xapoform" value="posted" /> <div > <div><label>Insert your email or BTC address:</label> <input name="username" id="username" class="form-control text-center" type="text" placeholder="Enter your email or BTC address"></div> </div><br> <div> <div class="form-group"><label>Solve the captcha:</label> <center class="captcha"><script type="text/javascript" src="http://api.solvemedia.com/papi/challenge.script?k=<?php echo $settings['solvemedia_challenge_key']; ?> "></script></center></div> </div> <div> <div> <button class="btn btn-success" type="submit">Claim Prize</button> </div> </div> </form> <?php //Form on front end Ends }