-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 49e11c9
Showing
65 changed files
with
14,634 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
function hide_key($decriptedKey){ | ||
$length = strlen($decriptedKey); | ||
$exes = str_repeat("X", $length-4); | ||
$lastFour = substr($decriptedKey,-4); | ||
return $exes.$lastFour; | ||
} | ||
|
||
|
||
function update_settings_query($settings){ | ||
$sql = ""; | ||
try{ | ||
foreach ($settings as $key => $value) { | ||
if($key!="password"||$key!="xapo_app_id"||$key!="xapo_secret_key"){ | ||
$sql .= "update settings set value='$value' where name='$key';"; | ||
} | ||
} | ||
return $sql; | ||
} | ||
catch(Exception $e){ | ||
|
||
} | ||
} | ||
|
||
|
||
function update_password_query(){ | ||
return "update settings set value=? where name='password'"; | ||
} | ||
|
||
function update_keys_query(){ | ||
return "update settings set value=? where name='xapo_app_id';update settings set value=? where name='xapo_secret_key';"; | ||
} | ||
|
||
function query_last_week(){ | ||
return "select COALESCE(sum(amount),0) as value from data where date > DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND result=1"; | ||
} | ||
|
||
function query_last_week_referals(){ | ||
return "select COALESCE(sum(amount),0) as value from data_referals where date > DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND result=1"; | ||
} | ||
|
||
function query_since_beginning(){ | ||
return "select COALESCE(sum(amount),0) as value from data where result=1"; | ||
} | ||
|
||
function query_since_beginning_referals(){ | ||
return "select COALESCE(sum(amount),0) as value from data_referals where result=1"; | ||
} | ||
|
||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
<?php | ||
session_start(); | ||
|
||
require '../config.php'; | ||
require 'functions.php'; | ||
require '../functions.php'; | ||
|
||
try { | ||
$sql = new PDO($dbdsn, $mysqlUsername, $mysqlPassword, array(PDO::ATTR_PERSISTENT => true, | ||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); | ||
} catch(PDOException $e) { | ||
die($e->getMessage()); | ||
} | ||
|
||
if(isset($_POST["action"])){ | ||
if($_POST["action"]=='logout'){ | ||
unset($_SESSION['admin']); | ||
unset($_COOKIE['admin']); | ||
} | ||
} | ||
|
||
if(isset($_POST["password"])){ | ||
$pass = $_POST["password"]; | ||
$pass = encryption($myHashKey,$pass); | ||
$query = "select * from settings where name='password' and value=?"; | ||
$q = $sql->prepare($query); | ||
$q->execute(array($pass)); | ||
$res = $q->fetch(); | ||
if($res){ | ||
$_SESSION['admin']=true; | ||
if(isset($_POST["remember"])&&$_POST["remember"]=="on"){ | ||
setcookie("admin"); | ||
} | ||
else{ | ||
unset($_COOKIE['admin']); | ||
} | ||
} | ||
else{ | ||
$view["admin_message_html"]='<div class="alert alert-danger" role="alert"> | ||
Incorrect password. | ||
</div>'; | ||
$_SESSION['admin']=false; | ||
} | ||
} | ||
|
||
if(isset($_COOKIE['remember'])){ | ||
$_SESSION['admin']=true; | ||
} | ||
|
||
//check if user is logged in, if not take to login page | ||
if(!$_SESSION['admin']){ | ||
require 'template/login.php'; | ||
die; | ||
} | ||
|
||
|
||
if(isset($_POST["title"])){ | ||
//update new settings values | ||
if($_SESSION['admin']){ | ||
$settings = $_POST; | ||
$insertQuery = update_settings_query($settings); | ||
$resultSettings = $sql->query($insertQuery); | ||
$resultSettings->closeCursor(); | ||
//Clear settings array, will be reloaded later | ||
$settings = Array(); | ||
$view["admin_message_html"]='<div class="alert alert-success" role="alert">Changes made successfully.</div>'; | ||
} | ||
} | ||
else{ | ||
if(isset($_POST["new_password"])){ | ||
if($_SESSION['admin']){ | ||
if($_POST["new_password"]==$_POST["password_confirmation"]){ | ||
$updatePassword = update_password_query(); | ||
$q = $sql->prepare($updatePassword); | ||
$new_password = encryption($myHashKey,$_POST["new_password"]); | ||
$q->execute(array($new_password)); | ||
unset($_COOKIE['admin']); | ||
unset($_SESSION['admin']); | ||
$view["admin_message_html"]='<div class="alert alert-success" role="alert">Password changed successfully.</div>'; | ||
require 'template/login.php'; | ||
die; | ||
} | ||
else{ | ||
$view["admin_message_html"]='<div class="alert alert-danger" role="alert">Password does not match confirmation.</div>'; | ||
|
||
} | ||
} | ||
} | ||
else if(isset($_POST["new_xapo_app_id"])){ | ||
if($_SESSION['admin']){ | ||
if($_POST["new_xapo_app_id"]!="" && $_POST["new_xapo_secret_key"]!=""){ | ||
|
||
$updateKeys = update_keys_query(); | ||
$q = $sql->prepare($updateKeys); | ||
|
||
$xapo_key = encryption($myHashKey,$_POST["new_xapo_app_id"]); | ||
$xapo_secret = encryption($myHashKey,$_POST["new_xapo_secret_key"]); | ||
|
||
$q->execute(array($xapo_key,$xapo_secret)); | ||
$q->closeCursor(); | ||
$view["admin_message_html"]='<div class="alert alert-success" role="alert">Keys changed successfully.</div>'; | ||
} | ||
else{ | ||
$view["admin_message_html"]='<div class="alert alert-danger" role="alert">Keys can\'t be empty.</div>'; | ||
} | ||
} | ||
} | ||
} | ||
|
||
$queryGeneralSettings = "select * from settings where name<>'password'"; | ||
$resultSettings = $sql->query($queryGeneralSettings); | ||
|
||
if ($resultSettings) { | ||
while ($row = $resultSettings->fetch()) { | ||
if($row['name']=="xapo_app_id"||$row['name']=="xapo_secret_key"){ | ||
$decriptedKey = trim(decryption($myHashKey,$row['value'])); | ||
$hiddenKey = hide_key($decriptedKey); | ||
$settings[$row['name']] = $hiddenKey; | ||
} | ||
else{ | ||
$settings[$row['name']] = $row['value']; | ||
} | ||
} | ||
} | ||
|
||
require 'template/index.php'; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
<script> | ||
function colorCheck() { | ||
if (document.getElementById('clrCheck').checked) { | ||
document.getElementById('ifColor').style.display = 'block'; | ||
document.getElementById('ifImage').style.display = 'none'; | ||
document.getElementById('imgBackground').style.display = 'none'; | ||
} | ||
else { | ||
document.getElementById('ifColor').style.display = 'none'; | ||
document.getElementById('ifImage').style.display = 'block'; | ||
document.getElementById('imgBackground').style.display = 'block'; | ||
} | ||
} | ||
|
||
function imgChanged(){ | ||
document.getElementById("imgBackground").src= document.getElementById("imgSource").value; | ||
} | ||
|
||
function buttonBackground(color){ | ||
document.getElementById("saveButton").className = "btn btn-"+color; | ||
} | ||
|
||
$(function() { | ||
$('#form').submit(function() { | ||
if (document.getElementById('clrCheck').checked) { | ||
document.getElementById('background_image_selected').value="false"; | ||
}else{ | ||
document.getElementById('background_image_selected').value="true"; | ||
} | ||
return true; // return false to cancel form action | ||
}); | ||
}); | ||
|
||
|
||
</script> | ||
|
||
<script> | ||
colorCheck(); | ||
</script> | ||
<h3 id="lbl-design-faucet" class="text-center">Design your Faucet:</h3> | ||
<table class="table table-hover"> | ||
<tbody> | ||
<tr> | ||
<td id="lbl-background">Background</td> | ||
<input type="hidden" id="background_image_selected" name="background_image_selected"> | ||
<td> | ||
<label id="lbl-select-color">Color</label> <input type="radio" onclick="javascript:colorCheck();" name="background" id="clrCheck" | ||
<?php if($settings["background_image_selected"]=="false") { | ||
echo " checked"; | ||
} ?>> | ||
<div id="ifColor" > | ||
<input type="color" id="colorSource" name="background_color" <?php if($settings["background_color"]!="") { | ||
echo "value=".$settings["background_color"]; | ||
} ?>> | ||
</div> | ||
<label id="lbl-select-image">Image</label> <input type="radio" onclick="javascript:colorCheck();" name="background" id="imgCheck" <?php if($settings["background_image_selected"]=="true") { | ||
echo " checked"; | ||
} ?>><br> | ||
<div id="ifImage" style="display:none"> | ||
<input id="imgSource" size="35" placeholder="Insert the url of your image here" type="text" name="background_image" onchange="imgChanged()" | ||
<?php if($settings["background_image"]!="") { | ||
echo "value=".$settings["background_image"]; | ||
} ?>> | ||
</div> | ||
<br> | ||
<img alt="Could not find the image in the url" id="imgBackground" style="display:none" height="100px" width="100px" | ||
<?php if($settings["background_image"]!="") { | ||
echo "src=".$settings["background_image"]; | ||
} ?>> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td id="lbl-title-color">Title</td> | ||
<td><input type="color" name="title_color" value=<?php echo $settings["title_color"]?>></td> | ||
</tr> | ||
<tr> | ||
<td id="lbl-subtitle-color">Subtitle</td> | ||
<td><input type="color" name="subtitle_color" value=<?php echo $settings["subtitle_color"]?>></td> | ||
</tr> | ||
<tr> | ||
<td id="btn-save-changes-color">Submit button</td> | ||
<td> | ||
<div class="btn-group prev-box picker-chooser"> | ||
|
||
<strong><span id="lbl-default-color" style="color:black">Default</span></strong> <input <?php if($settings["button_background"]=="default") echo "checked"; ?> type="radio" onclick="javascript:buttonBackground('default');" name="button_background" id="default" value="default"> | ||
<strong><span id="lbl-blue-color" style="color:#337ab7">Blue</span></strong> <input <?php if($settings["button_background"]=="primary") echo "checked"; ?> type="radio" onclick="javascript:buttonBackground('primary');" name="button_background" id="primary" value="primary"> | ||
<strong><span id="lbl-green-color" style="color:#5cb85c">Green</span></strong> <input <?php if($settings["button_background"]=="success") echo "checked"; ?> type="radio" onclick="javascript:buttonBackground('success');" name="button_background" id="success" value="success"> | ||
<strong><span id="lbl-skyblue-color" style="color:#5bc0de">Skyblue</span></strong> <input <?php if($settings["button_background"]=="info") echo "checked"; ?> type="radio" onclick="javascript:buttonBackground('info');" name="button_background" id="info" value="info"> | ||
<strong><span id="lbl-orange-color" style="color:#f0ad4e">Orange</span></strong> <input <?php if($settings["button_background"]=="warning") echo "checked"; ?> type="radio" onclick="javascript:buttonBackground('warning');" name="button_background" id="warning" value="warning"> | ||
<strong><span id="lbl-red-color" style="color:#d9534f">Red</span></strong> <input <?php if($settings["button_background"]=="danger") echo "checked"; ?> type="radio" onclick="javascript:buttonBackground('danger');" name="button_background" id="danger" value="danger"> | ||
|
||
</div> | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td id="btn-save-changes-text">Submit button text</td> | ||
<td><input type="text" name="submit_button_text" value="<?php echo $settings["submit_button_text"];?>"></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<div class="form-group"> | ||
<label id="lbl-top-horizontal-ad" for="top_horizontal_ad">Top horizontal Ad script:</label> | ||
<textarea class="form-control" rows="3" id="top_horizontal_ad" name="top_horizontal_ad"><?php echo $settings["top_horizontal_ad"];?></textarea> | ||
<span id="lbl-top-horizontal-recomended" class="help-block with-errors">Recommended size 728x90</span> | ||
</div> | ||
<div class="form-group"> | ||
<label id="lbl-left-vertical-ad"for="left_vertical_ad">Left vertical Ad script:</label> | ||
<textarea class="form-control" rows="3" id="left_vertical_ad" name="left_vertical_ad"><?php echo $settings["left_vertical_ad"];?></textarea> | ||
</div> | ||
<div class="form-group"> | ||
<label id="lbl-right-vertical-ad" for="right_vertical_ad">Right vertical Ad script:</label> | ||
<textarea class="form-control" rows="3" id="right_vertical_ad" name="right_vertical_ad"><?php echo $settings["right_vertical_ad"];?></textarea> | ||
</div> | ||
<div class="form-group"> | ||
<label id="lbl-middle-horizontal-ad" for="middle_horizontal_ad">Middle horizontal Ad script:</label> | ||
<textarea class="form-control" rows="3" id="middle_horizontal_ad" name="middle_horizontal_ad"><?php echo $settings["middle_horizontal_ad"];?></textarea> | ||
<span id="lbl-middle-horizontal-recomended" class="help-block with-errors">Recommended size 320x100</span> | ||
</div> | ||
<div class="form-group"> | ||
<label id="lbl-bottom-horizontal-ad" for="bottom_horizontal_ad">Bottom horizontal Ad script:</label> | ||
<textarea class="form-control" rows="3" id="bottom_horizontal_ad" name="bottom_horizontal_ad"><?php echo $settings["bottom_horizontal_ad"];?></textarea> | ||
<span id="lbl-bottom-horizontal-recomended" class="help-block with-errors">Recommended size 300x250</span> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<h3 id="lbl-general-settings" class="text-center">General Settings:</h3> | ||
<div class="form-group text-left"> | ||
<div class="form-group"> | ||
<label id="lbl-title" for="name">Faucet Name:</label> | ||
<input type="text" value="<?php echo $settings["title"]?>" class="form-control" id="title" name="title" data-error="Required field" required> | ||
</div> | ||
<div class="form-group"> | ||
<label id="lbl-subtitle" for="subtitle">Faucet Subtitle:</label> | ||
<input type="text" value="<?php echo $settings["subtitle"]?>" class="form-control" id="subtitle" name="subtitle"> | ||
</div> | ||
<div class="form-group"> | ||
<label id="lbl-main-content" for="main-content">Faucet Main Content:</label> | ||
<textarea class="form-control" rows="3" id="main_content" name="main_content"><?php echo $settings["main_content"]?></textarea> | ||
</div> | ||
<div class="form-group"> | ||
<label id="lbl-rewards" for="rewards">Rewards:</label> | ||
<input type="text" value="<?php echo $settings["rewards"]?>" class="form-control" id="rewards" name="rewards" data-error="Required field" required> | ||
<span id="lbl-rewards-comment" class="help-block with-errors">Input the rewards and the weight of each possible prize using the format <i>reward</i>*<i>weight</i> sepparated by commas. Units are in Satoshis.<br>For example: 100*2, 200*1 means that the chances of a user winning 100 satoshis are double than winning 200 Satoshis.</span> | ||
</div> | ||
<div class="form-group"> | ||
<label id="lbl-referral-percentage" for="ref_perc">Referral Percentage:</label> | ||
<input type="number" min="0" value="<?php echo $settings["referral_percentage"]?>" class="form-control" id="referral_percentage" name="referral_percentage" data-error="Insert a valid number" numeric> | ||
<span id="lbl-referral-percentage-comment" class="help-block with-errors">The percentage of the claim that users take by promoting your Faucet</span> | ||
</div> | ||
<div class="form-group"> | ||
<label id="lbl-timer" for="timer">Timer:</label> | ||
<input type="number" min="0" value="<?php echo $settings["timer"]?>" class="form-control" id="timer" name="timer" data-error="Insert a valid number" numeric> | ||
<span id="lbl-timer-comment" class="help-block with-errors">The time interval for your users to redeem</span> | ||
</div> | ||
<div class="form-group"> | ||
<label id="lbl-c-key" for="c_key">Solvemedia Challenge Key:</label> | ||
<input type="text" value="<?php echo $settings["solvemedia_challenge_key"]?>" class="form-control" id="solvemedia-challenge-key" name="solvemedia_challenge_key"> | ||
</div> | ||
<div class="form-group"> | ||
<label id="lbl-v-key" for="v_key">Solvemedia Verification Key:</label> | ||
<input type="text" value="<?php echo $settings["solvemedia_verification_key"]?>" class="form-control" id="solvemedia-verification-key" name="solvemedia_verification_key"> | ||
</div> | ||
<div class="form-group"> | ||
<label id="lbl-xapo-app" for="xapo_app">Last 4 Xapo App characters:</label> | ||
<input type="text" value="<?php echo $settings["xapo_app_id"]?>" class="form-control" id="xapo_app_id" name="xapo_app_id" disabled> | ||
</div> | ||
<div class="form-group"> | ||
<label id="lbl-secret-key" for="secret_key">Last 4 Xapo Secret Key characters:</label> | ||
<input type="text" value="<?php echo $settings["xapo_secret_key"]?>" class="form-control" id="xapo_secret_key" name="xapo_secret_key" disabled> | ||
</div> | ||
</div> |
Oops, something went wrong.