-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathinstall.php
7 lines (7 loc) · 10.2 KB
/
install.php
1
2
3
4
5
6
7
<?php
/*=================
IDA FAUCET SCRIPT
https://idatoken.org
version 0.2
=================*/
error_reporting(0);$version=0.2;$t='';if(function_exists('session_start'))session_start();if($_SERVER['QUERY_STRING']=='check'){unset($_SESSION['test']);if(function_exists('session_destroy'))session_destroy();header('location: install.php');exit();}$t.='<html><head><title>IDA Faucet Installation</title><meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" type="text/css" href="style.css"></head><body><div id="main"><h1><a href="./install.php">IDA Faucet Installation</a></h1>';if(empty($_SERVER['QUERY_STRING'])||$_SERVER['QUERY_STRING']=='install'){$error=false;if(!defined('PHP_VERSION')||substr(PHP_VERSION,0,3)<5.6){$error=true;$t.='<b style="color:red;">PHP version is '.PHP_VERSION.'. PHP 5.6 or more needed.</b><br>';}else{$t.='<span style="color:green;">PHP version is '.PHP_VERSION.'.</span><br>';}if(!function_exists('curl_version')||!function_exists('curl_init')){$error=true;$t.='<b style="color:red;">Curl are required and seems disabled.</b><br>';}else{$t.='<span style="color:green;">Curl version is '.curl_version()['version'].'.</span><br>';}if(!function_exists('session_start')){$error=true;$t.='<b style="color:red;">Sessions are required and seems disabled.</b><br>';}else{if(!isset($_SESSION['test'])&&empty($_SERVER['QUERY_STRING'])){$_SESSION['test']='ida';header('location: install.php?install');exit();}if(!isset($_SESSION['test'])||$_SESSION['test']!='ida'){$error=true;$t.='<b style="color:red;">Sessions are required and seems disabled.</b><br>';}else{$t.='<span style="color:green;">Sessions is working OK.</span><br>';}}if(!function_exists('shell_exec')||!class_exists('mysqli')){$t.='<b>MYSQL needed - be sure you have access to one database and MySQLi class available.</b><br>';}else{preg_match('@[0-9]+\.[0-9]+\.[0-9]+@',shell_exec('mysql -V'),$mysqlv);if(!isset($mysqlv[0])){$t.='<b>MYSQL needed - be sure you have access to one database.</b><br>';}else{$t.='<span style="color:green;">MySQL version is '.$mysqlv[0].'.</span><br>';}}if(!function_exists('file')||!function_exists('file_put_contents')||!function_exists('fopen')){$t.='<span>fopen() seems disabled... Not required but active it if you can.</span><br>';}else{if(!is_writable('./style.css')){$t.='<b>File: style.css protected, chmod is '.substr(sprintf('%o',fileperms('./style.css')),-4).'... Try to set : 0666.</b><br>';}else{$t.='<span style="color:green;">File: style.css chmod is '.substr(sprintf('%o',fileperms('./style.css')),-4).'.</span><br>';}}if($error===false){$t.='<br>READY TO INSTALL <button type="button" onclick="location.href=\'?step1\'">INSTALL</button>';}else{$t.='<br>PLEASE FIX ERROR BEFORE CONTINUE <button type="button" onclick="location.href=\'?check\'">CHECK AGAIN</button>';}echo $t;}elseif(!empty($_SERVER['QUERY_STRING'])&&$_SERVER['QUERY_STRING']=='step1'){echo $t.'<form action="?step2" method="POST">*Faucet Name:<br><input type="text" name="name" placeholder="My IDA FAUCET" required><br>*Admin password:<br><input type="text" name="admin" placeholder="Password" required><br>*Claim Reward (in IDA TOKEN):<br><input type="number" name="reward" step="0.0001" value="0.0500" max="1" min="0.0001" required><br>*Referal reward (in %):<br><input type="number" name="ref" step="1" value="0" max="100" min="0"><br>*Delay between claims (in minute):<br><input type="number" name="delay" step="1" value="10" max="1440" min="1" required><br>*Max claims per user (per day):<br><input type="number" name="maxclaims" step="1" value="25" max="1000" min="1" required><br><br>*<a href="https://idatoken.org/api.php" target="blank">IDA API</a> Private Key:<br><input type="text" name="idakey" placeholder="Your API Private Key" required><br>*<a href="https://www.google.com/recaptcha/admin/create" target="blank" rel="nofollow">Google Recaptcha</a> Public Key:<br><input type="text" name="grkey" placeholder="Your API Public Key required"><br>*Google Recaptcha Private Key:<br><input type="text" name="grpkey" placeholder="Your API Private Key" required><br><a href="https://iphub.info/register" target="blank" rel="nofollow">IPHUB</a> Key(optional):<br><input type="text" name="iphubkey" placeholder="Your API Private Key"><br><br>*Database Server:<br><input type="text" name="dbserver" value="localhost" required><br>*Database Name:<br><input type="text" name="dbname" placeholder="MySQL dbName" required><br>*Database Login:<br><input type="text" name="dbuser" placeholder="MySQL Login" required><br>*Database Password:<br><input type="text" name="dbpass" placeholder="MySQL Password" required><br><br><button type="button" onclick="location.href=\'?\'">Cancel</button> <input type="submit" value="Start my IDA faucet"><br><small>Fields with a * should not be empty!</small></form>';}elseif(!empty($_SERVER['QUERY_STRING'])&&$_SERVER['QUERY_STRING']=='step2'){$terror='';if(empty($_POST['name'])||empty($_POST['admin'])||empty($_POST['reward'])||empty($_POST['delay'])||empty($_POST['maxclaims'])||empty($_POST['idakey'])||empty($_POST['grkey'])||empty($_POST['grpkey'])||empty($_POST['dbserver'])||empty($_POST['dbname'])||empty($_POST['dbuser'])||empty($_POST['dbpass']))$terror.='<b style="color:red">Some fields with a * was empty !!<br>Your Faucet could not work as expected with this configuration.<br>We advise you to <a href="./install.php">restart the installation</a>.</b><br><br><br>';if(empty($_POST['ref'])||!ctype_digit($_POST['ref']))$_POST['ref']=0;$error=false;foreach($_POST as $key=>$value){if(strlen(str_replace('"','',$value))!=strlen($value))$error=true;}if($error!==false)$terror.='<b style="color:red">Some fields contain a <em>"</em> character.<br>It could mess your configuration file.<br>We advise you to <a href="./install.php">restart the installation</a>.</b><br><br><br>';$error=false;$db=new mysqli($_POST['dbserver'],$_POST['dbuser'],$_POST['dbpass'],$_POST['dbname']);if($db->connect_error)$error=mysqli_connect_error();if($error!==false){$terror.='<b style="color:red">Unable to connect to MySQL.<br>Error : '.$error.'<br>We advise you to <a href="./install.php">restart the installation</a> and check your credentials.</b><br><br><br>';}else{if(!$db->multi_query("DROP TABLE IF EXISTS `idafaucet_stats`;CREATE TABLE `idafaucet_stats` (`day` date NOT NULL,`claims` int(10) unsigned NOT NULL DEFAULT '0',`users` int(10) unsigned NOT NULL DEFAULT '0',`ida_balance` float(20,6) NOT NULL DEFAULT '0.000000',`ida_api_limit` tinyint(3) unsigned NOT NULL DEFAULT '100',`ida_api_serverlimit` tinyint(3) unsigned NOT NULL DEFAULT '100',`ida_api_paycredits` smallint(5) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`day`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;DROP TABLE IF EXISTS `idafaucet_users`;CREATE TABLE `idafaucet_users` (`ip` varchar(128) NOT NULL,`claims` smallint(5) unsigned NOT NULL DEFAULT '0',`lastclaim` int(10) unsigned NOT NULL DEFAULT '0',`address` varchar(34) NOT NULL,`token` varchar(20) DEFAULT NULL,`shortener` varchar(80) DEFAULT NULL,`ref` varchar(34) DEFAULT NULL,`banned` int(10) unsigned NOT NULL DEFAULT '0',PRIMARY KEY (`ip`,`address`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"))$terror.='<b style="color:red">Unable to create your MySQL tables.<br>Error : '.$db->error.'<br>We advise you to <a href="./install.php">restart the installation</a>.</b><br><br><br>';}echo $t;if($terror=='')echo '<h4>1) Remove the <em>install.php</em> file from your hosting</h4><h4>2) Update your <em>settings.php</em> file with this</h4><textarea style="width:80%;height:400px">'.htmlspecialchars(str_ireplace('<br>',"\r\n",'<?php<br>// SETTINGS FILE<br>$ida_name="'.$_POST['name'].'";<br>$ida_pass="'.sha1($_POST['admin']).'";<br>$ida_url="'.(isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS']==='on'?'https':'http').'://'.$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,strrpos($_SERVER['PHP_SELF'],'/')).'/";<br>$ida_reward='.$_POST['reward'].';<br>$ida_ref='.$_POST['ref'].';<br>$ida_delay='.$_POST['delay'].';<br>$ida_maxclaims='.$_POST['maxclaims'].';<br><br>$api_ida="'.$_POST['idakey'].'";<br>$api_gr="'.$_POST['grkey'].'";<br>$api_grp="'.$_POST['grpkey'].'";<br>$api_iphub="'.$_POST['iphubkey'].'";<br><br>$db_server="'.$_POST['dbserver'].'";<br>$db_name="'.$_POST['dbname'].'";<br>$db_user="'.$_POST['dbuser'].'";<br>$db_pass="'.$_POST['dbpass'].'";<br><br>$header_banners=\'\';<br>$footer_banners=\'\';<br>$popunder=\'\';<br>//ban users if they claim from different addresses<br>$ban_delay=3600; //delay in s. between 2claims to allow diff address<br>$ban_time=846000; //time in s. for a ban<br><br>// SHORTENERS<br>?>')).'</textarea><h4>3) (optional) Add some banners or popunder</h4>You can add banners or popunder codes with thoses variables :<br><em>$header_banners</em>, <em>$footer_banners</em>, <em>$popunder</em><br>You can get some codes from adnetwork like : <a href="https://bit-ad.com"target="_blank">bit-ad.com</a><br>Using different ad-network is good but do not add too much ads on your faucet.<h4>4) (optional) Add shorteners in your <em>settings.php</em> file</h4><p id="noshorteners"><a href="#shorteners"onclick="document.getElementById(\'noshorteners\').style.display=\'none\';document.getElementById(\'shorteners\').style.display=\'block\';">Click here to know how add shorteners</a></p><p id="shorteners"style="display:none">If you want your faucet more lucrative, use shorteners service (like <a href="https://shortit.pw/"target="_blank">shortit.pw</a>)<br>After the line <b>// SHORTENERS</b> add your shorteners like this way :<br><textarea style="width:100%;max-width:700px;height:50px">'.htmlentities(str_ireplace('<br>',"\r\n",'$shorteners[]="";<br>$shorteners[]="https://shortit.pw/api.php?api=ReplaceThis&url=";<br>$shorteners[]="https://shortit.pw/api.php?api=ReplaceThis&url=";')).'</textarea><br>With this example no shortener will be shown on first claim then the shortit.pw shortener will be displayed on 2nd & 3th claims.<br>You can get your API key on shortit.pw website.<br>Add more lines if you allow more than 2 claims a day.</p><h4>5) Test your Faucet</h4><a href="./"target="_blank">Go to your faucet now</a> ';else echo $terror;}else{header('location: install.php');exit();}echo '<br><br><hr>Version '.$version.' ‐ <small>Hash : '.md5(md5_file('./install.php').md5_file('./index.php').md5_file('./api-class.php')).'</small><br><a href="https://idatoken.org">Free script from <b>IDA TOKEN</b></a>'; ?>