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
Faucet Installer
Hi
Thank you for using this installer to begin a your new faucet with
http://epay.info" target="_blank">ePay.info
We aim to improve the quality of this script over time, so remember to check the repository
https://github.com/epayinfo/simple_faucet" target="_blank">here on regular basis to get the last updates.
Begin installing by clicking on the next step.
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 = <<
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{
?>
Faucet Installer - Database
}
}elseif($_GET['step']==3){
@unlink('install.php');
@unlink('install.sql');
?>
Faucet Installer - Finish
Your installation has just been completed.
This is your administartion passphare:
Make sure install.php and install.sql are deleted from you host.
Admin passpharse will not be shown again even if you refresh this page. Save it somewhere safe.