Bitcoin Forum
May 08, 2024, 03:46:54 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Warning: One or more bitcointalk.org users have reported that they strongly believe that the creator of this topic is a scammer. (Login to see the detailed trust ratings.) While the bitcointalk.org administration does not verify such claims, you should proceed with extreme caution.
Pages: [1]
  Print  
Author Topic: creating a new faucet -- help  (Read 264 times)
savioroshan (OP)
Hero Member
*****
Offline Offline

Activity: 770
Merit: 500



View Profile
October 11, 2016, 10:33:54 AM
 #1

Can anybody help me in creating a new epay faucet. i am not a programmer. i downloaded the script in the hosting website after creating mysql database. when i open the browser i am getting error. its showing Unable to connect to database. please somebody can help me?
This is the script . please ttell me if i have to do any other changes to this install.php file. thanks in advance

<?php
session_start();
ob_start();
?>
<!DOCTYPE html>
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta name="viewport" content="width=device-width">
   <title>Faucet Installer</title>
   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
   <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
   <link href="//cdn.epay.info/css/flipclock.css" rel="stylesheet">
   <link rel="stylesheet" type="text/css" href="templates/style/css/style.css">
   <script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
</head>
<body>
<div class="container" style="padding-top:50px;">



<?php if(!isset($_GET['step'])){ ?>
<div class="panel panel-primary">
  <div class="panel-heading">Faucet Installer</div>
  <div class="panel-body">
   Hi<br>
Thank you for using this installer to begin a your new faucet with <a href="http://epay.info" target="_blank">ePay.info</a> <br>
We aim to improve the quality of this script over time, so remember to check the repository <a href="https://github.com/epayinfo/simple_faucet" target="_blank">here</a> on regular basis to get the last updates.<br>
Begin installing by clicking on the next step.
</div>
<div class="panel-footer">
<a href="?step=2" class="btn btn-success pull-right">Next</a>
<div class="clearfix"></div>
</div>
</div>
<?php }elseif($_GET['step']==2){
if(isset($_POST['dbname'])){

class SystemComponent{
   private $settings;
   function getSetting(){
      $settings['dbhost']=$_POST['dbhost'];
      $settings['dbusername']=$_POST['uname'];
      $settings['dbpassword']=$_POST['pwd'];
      $settings['dbname']=$_POST['dbname'];
      return $settings;
   }
}
require_once "includes/dbconnector.class.php";

$db=new DbConnector;
if($db->check_connection()){
   $dbhost=$_POST['dbhost'];
   $dbusername=$_POST['uname'];
   $dbpassword=$_POST['pwd'];
   $dbname=$_POST['dbname'];
   function generateRandomString($length = 25) {
      $characters = 'abcdefghijklmnopqrstuvwxyz123456789';
      $charactersLength = strlen($characters);
      $randomString = '';
      for ($i = 0; $i < $length; $i++) {
         $randomString .= $characters[rand(0, $charactersLength - 1)];
      }
      return $randomString;
   }
   $_SESSION['info']['admin']=generateRandomString();
   $adminpass=hash('SHA256',$_SESSION['info']['admin']);   
$content = <<<END
<?php
class SystemComponent{
   private \$settings;
   function getSetting(){
      \$settings['dbhost']='$dbhost';
      \$settings['dbusername']='$dbusername';
      \$settings['dbpassword']='$dbpassword';
      \$settings['dbname']='$dbname';
      \$settings['adminpass']='$adminpass';
      return \$settings;
   }
}
END;
   chmod( 'templates_c', 0777 );
   chmod( 'configs/dbinfo.php', 0666 );
   $fp = fopen('configs/dbinfo.php',"w");
   fwrite($fp,$content);
   fclose($fp);
   $sql=fopen('install.sql','r');
   $schema=fread($sql,filesize("install.sql"));
   $queries = explode( ';', $schema );
   $queries = array_filter( $queries );
   array_pop($queries);
   foreach($queries as $q)
      $db->query($q);
     
   fclose($sql);
   header('Location: install.php?step=3');
   die();
}else{
   $_SESSION['error']['db']=true;
   header('Location: install.php?step=2');
   die();
}
}else{
?>

<div class="panel panel-primary">
   <div class="panel-heading">Faucet Installer - Database</div>
<form action="" method="post"> 
 
  <div class="panel-body">
   
   Below you should enter your database connection details. If you’re not sure about these, contact your host.
   
   
   
   
<?php if(isset($_SESSION['error']['db'])){ ?>

<div class="alert alert-danger">
Unable to connect to database.

</div>
<?php unset($_SESSION['error']); } ?>   
   
   
   
   <div class="form-group">
       <label for="dbname">Database Name</label>
       <input class="form-control" name="dbname" type="text" size="25" value="u996812304_qwert." />
       <small>u996812304_qwert</small>
   </div>
   
   
   <div class="form-group">
       <label for="uname">Database Username</label>
       <input class="form-control" name="uname" type="text" size="25" placeholder="u996812304_asdfg." />
       <small>u996812304_asdfg</small>
   </div>
   
   
   
   <div class="form-group">
       <label for="pwd">Database Password</label>
       <input class="form-control" name="pwd" type="text" size="25" placeholder="1234567" />
       <small>1234567</small>
   </div>
   
   
   <div class="form-group">
       <label for="dbhost">Database Host</label>
       <input class="form-control" name="dbhost" type="text" size="25" value="mysql.1freehosting.com." />
       <small>You should be able to get this info from your web host, if <code>mysql.1freehosting.com</code> does not work.</small>
   </div>
   
     
   
   
</div>
<div class="panel-footer">
<button type="submit" class="btn btn-success pull-right">Next</button>
<div class="clearfix"></div>
</div>

</form>

</div>
<?php
}
}elseif($_GET['step']==3){ 

@unlink('install.php');
@unlink('install.sql');

?>


<div class="panel panel-primary">


  <div class="panel-heading">Faucet Installer - Finish</div>
  <div class="panel-body">
   
   Your installation has just been completed.
   
   <br>
   
<center>

  This is your administartion passphare:<br><br>

  <strong><code style="font-size:24px"><?php echo $_SESSION['info']['admin'];?></code></strong>
  <br><br>

  <div class="col-md-4 col-md-push-4">
  <a href="adm/" class="btn btn-success btn-block">Go to Administartion</a>

 
  </div>
 
 
 
 
 
</center>
   <br>

   <div class="clearfix"></div>
 
<strong>Make sure install.php and install.sql are deleted from you host.<br>
Admin passpharse will not be shown again even if you refresh this page. Save it somewhere safe. 
</strong> 
 
     
</div>
</div>



<?php session_destroy(); } ?>



</div>
</body>
</html>
1715140014
Hero Member
*
Offline Offline

Posts: 1715140014

View Profile Personal Message (Offline)

Ignore
1715140014
Reply with quote  #2

1715140014
Report to moderator
1715140014
Hero Member
*
Offline Offline

Posts: 1715140014

View Profile Personal Message (Offline)

Ignore
1715140014
Reply with quote  #2

1715140014
Report to moderator
Unlike traditional banking where clients have only a few account numbers, with Bitcoin people can create an unlimited number of accounts (addresses). This can be used to easily track payments, and it improves anonymity.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715140014
Hero Member
*
Offline Offline

Posts: 1715140014

View Profile Personal Message (Offline)

Ignore
1715140014
Reply with quote  #2

1715140014
Report to moderator
1715140014
Hero Member
*
Offline Offline

Posts: 1715140014

View Profile Personal Message (Offline)

Ignore
1715140014
Reply with quote  #2

1715140014
Report to moderator
1715140014
Hero Member
*
Offline Offline

Posts: 1715140014

View Profile Personal Message (Offline)

Ignore
1715140014
Reply with quote  #2

1715140014
Report to moderator
ModGirl
Sr. Member
****
Offline Offline

Activity: 602
Merit: 250


View Profile
October 11, 2016, 10:50:12 AM
 #2

I don't have experience with this script but in other scripts when I need to connect the database thenI fill the database data in the files having data like below:

class SystemComponent{
   private $settings;
   function getSetting(){
      $settings['dbhost']=$_POST['dbhost'];
      $settings['dbusername']=$_POST['uname'];
      $settings['dbpassword']=$_POST['pwd'];
      $settings['dbname']=$_POST['dbname'];
      return $settings;
   }



Fill the database name,
database username.
database password and hostname (which is mostly "localhost" if not having special one)
vino.gcs
Member
**
Offline Offline

Activity: 95
Merit: 10


View Profile
October 11, 2016, 10:57:26 AM
 #3

Elaborate your error.

Usually these kind of errors occur when you don't have the said database created. Check for spells. And also check for the port number of the database server.  Usually for mysql it is 3306. Some servers change that.
altcoinhosting
Hero Member
*****
Offline Offline

Activity: 896
Merit: 1006


View Profile
October 11, 2016, 10:59:16 AM
Last edit: October 11, 2016, 11:14:39 AM by altcoinhosting
 #4

I don't have experience with this script but in other scripts when I need to connect the database thenI fill the database data in the files having data like below:

class SystemComponent{
   private $settings;
   function getSetting(){
      $settings['dbhost']=$_POST['dbhost'];
      $settings['dbusername']=$_POST['uname'];
      $settings['dbpassword']=$_POST['pwd'];
      $settings['dbname']=$_POST['dbname'];
      return $settings;
   }



Fill the database name,
database username.
database password and hostname (which is mostly "localhost" if not having special one)

It seems like the script expects you to post this data to the script... My guess would be the settings should have been entered in an online form that was packed with this php file... This form should have posted the data to the script in question.

Edit: I've just actually took the time to look at the script a bit closer (i haven't taken the time to look at every line tough, so i only have a rough idear of what it's supposed to do), apparently, the form should have been printed when you executed the script without posted data...

Because you either did not use the form (in other words, skipped an installation step), or entered the wrong data, you received this error (at least, that's my best guess...)...

I don't have experience with this script, but usually there's a howto or readme file included that stipulates how to install the script... Your best bet would be to look for all mysql details (host, port, tablename, username, password) en then follow the readme that should be included.

If you don't succeed, you can always pay somebody to install the script for you Wink

prabowo96
Full Member
***
Offline Offline

Activity: 238
Merit: 100

it's showtime


View Profile
October 11, 2016, 12:08:35 PM
 #5

Faucets nowadays aren't profitable.

My sugest for you: Use the faucetinabox script from faucetbox, you just need to change the dbname and password in the config.php also you can find a lot of tutorials, 5 minutes and your faucet will be working.

If you have no knowledge about faucets, try to learn more before, because bots will dry your faucet Wink

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!