Pages:
Author

Topic: webserver connecting to a VPS - page 2. (Read 2863 times)

hero member
Activity: 1008
Merit: 502
February 04, 2015, 08:52:29 PM
#29
I've had so many problems with connecting externally, never could get it to do it. I just gave up and installed the wallet and the website on the same vps and that worked. its also much safer because you can close and ban outside attempts to connect, removing the possibility of someone getting into your wallet.


its not working either way LMAO,

 plus we know connection and communication is not the problem the script lisek had me try worked with no problems.

So I am sure it has to be the script somehwere somehow I just have to find it. I really REALLY like this games layout, this is why i wont give up. so,  I really do not want to try and get another one.
legendary
Activity: 4228
Merit: 1313
February 04, 2015, 08:50:51 PM
#28
Re the log, I was thinking in

~/.bitcoin/debug.log

(Or wherever the path is for this coin).

If his code works, then it has to be something with this code being incorrect. In the debug.log, perhaps it will show an error when your web server goes to connect.  Assuming the web sever has created the proper URL.

Regarding the question about the url, you could just echo this to the display (temporarily of course)  or a temp variable depending on the development environment you are using just to ensure that everything is being filled in properly:

'http://'.$_GET['w_user'].':'.$_GET['w_pass'].'@'.$_GET['w_host'].':'.$_GET['w_port'].'/';

E.g. If the w_port is wrong or any of the others that could be an issue.   It should be a quick thing to check that the url is being created properly.
sr. member
Activity: 420
Merit: 250
Ever wanted to run your own casino? PM me for info
February 04, 2015, 08:20:17 PM
#27
I've had so many problems with connecting externally, never could get it to do it. I just gave up and installed the wallet and the website on the same vps and that worked. its also much safer because you can close and ban outside attempts to connect, removing the possibility of someone getting into your wallet.
hero member
Activity: 1008
Merit: 502
February 04, 2015, 08:09:55 PM
#26
I am trying everything,

should this

Code:
function checkWallet() {
            $.ajax({
              'url': './driver_test_call.php?w_user='+$("input#w_user").val()+'&w_pass='+$("input#w_pass").val()+'&w_host='+$("input#w_host").val()+'&w_port='+$("input#w_port").val(),
              'dataType': "json",
              'success': function(data) {
                document.getElementById('mform').submit();
              },
              'error': function() {
                alert('Wallet error! Can\'t connect to wallet! Please check if provided informations are correct and try again.');
              }
            });
          }

actually say this

Code:
function checkWallet() {
            $.ajax({
              'url': './driver_test_call.php?w_user='+$("input#w_user").val()+'&w_pass='+$("input#w_pass").val()+'&w_host='+$("input#w_host").val()+'&w_port='+$("input#w_port").val(),
              'dataType': "json",
              'success': function(data) {
                if (data['error']=='no') document.getElementById('mform').submit();              },
               {
                else alert('Wallet error! Can\'t connect to wallet! Please check if provided informations are correct and try again.');
              }
            });
          }
hero member
Activity: 1008
Merit: 502
February 04, 2015, 07:42:12 PM
#25
I am not sure if order matters but shuld these

Code:

Wallet Info


              Please fill in correct wallet info:
              

              
                
                  
                  
                
                
                  
                  
                
                
                  
                  
                
                
                  
                  
be in the same order as this

Code:
$test=new jsonRPCClient('http://'.$_GET['w_user'].':'.$_GET['w_pass'].'@'.$_GET['w_host'].':'.$_GET['w_port'].'/');

and this

Code:
function checkWallet() {
            $.ajax({
              'url': './driver_test_call.php?w_user='+$("input#w_user").val()+'&w_pass='+$("input#w_pass").val()+'&w_host='+$("input#w_host").val()+'&w_port='+$("input#w_port").val(),
              'dataType': "json",
              'success': function(data) {
                document.getElementById('mform').submit();
              },
              'error': function() {
                alert('Wallet error! Can\'t connect to wallet! Please check if provided informations are correct and try again.');

by order I mean shoud they all follow suite

user then pass then host then port

the first one order does not match the rest
hero member
Activity: 1008
Merit: 502
February 04, 2015, 07:37:31 PM
#24
Show entire file index.php

Code:
/*
 *  © BitcoinDice 


 
*/


if (isset($_GET['checkCons'])) {
  if (@!
mysql_connect($_POST['db_host'],$_POST['db_user'],$_POST['db_pass']) || @!mysql_select_db($_POST['db_name'])) {
    
header('Location: ./?step=3&db');
    exit();
  }

  
$included_=true;
  include 
'db_data.php';
  
  
$db_file=fopen('../inc/db-conf.php','wb');
  
fwrite($db_file,");          
  
fwrite($db_file,'$conf_c=true;'."\n");          
  
fwrite($db_file,'mysql_connect(\''.$_POST['db_host'].'\',\''.$_POST['db_user'].'\',\''.$_POST['db_pass'].'\');'."\n");
  
fwrite($db_file,'mysql_select_db(\''.$_POST['db_name'].'\');'."\n");
  
fwrite($db_file,'mysql_query("SET NAMES utf8");'."\n");
  
fwrite($db_file,"?>
");      ?>  fclose($db_file);

  
$w_file=fopen('../inc/driver-conf.php','wb');
  
fwrite($w_file,");          
  
fwrite($w_file,'$driver_login=\'http://'.$_POST['w_user'].':'.$_POST['w_pass'].'@'.$_POST['w_host'].':'.$_POST['w_port'].'/\';'."\n");
  
fwrite($w_file,"?>
");      ?>  fclose($w_file);

  
header('Location: ./?step=4');
  exit();
}

if (isset(
$_GET['saveB'])) {
  include 
'../inc/db-conf.php';
  
mysql_query("UPDATE `system` SET `title`='$_POST[s_title]',`url`='$_POST[s_url]',`currency`='$_POST[s_cur]',`currency_sign`='$_POST[s_cur_sign]',`description`='$_POST[s_desc]' WHERE `id`=1");
  
header('Location: ./?step=5');
  exit();
}

if (empty(
$_GET['step']) || ($_GET['step']!=&& $_GET['step']!=&& $_GET['step']!=&& $_GET['step']!=&& $_GET['step']!=&& $_GET['step']!=6)) {
  
header('Location: ./?step=1');
  exit();
}
else 
$step=$_GET['step'];

if (
$step==&& (!is_writable('../inc/db-conf.php') || !is_writable('../inc/driver-conf.php'))) {
  
header('Location: ./?step=2');
  exit();
}
?>



 
    BitcoinDice 2.0 - Installation
   
   
   
   
 
 
   

     

       

BitcoinDice 2.0 Installation


     

   

        switch ($step) {
      case 
1:
      
?>

       
       

         

           

Welcome!


            This is an automatic installation script. Please, follow the instructions on the following screens.
         

       

            break;
      case 
2:
      
?>

       
       

         

           

File Permissions


            Please make sure that following files are writable (chmod 777):
           

           
Host:
Login:
Password:
Port:

             
               
               
               
             
             
               
               
               
             
           
inc/db-conf.php  if (is_writable('../inc/db-conf.php')) { echo 'Yes'; } else { echo 'No'; } ?>
inc/driver-conf.php  if (is_writable('../inc/driver-conf.php')) { echo 'Yes'; } else { echo 'No'; } ?>

           

            The above files should be writable, otherwise the installation will not continue!
         

       

            break;
      case 
3:
      
?>

       
       

         

           

             

Database Info


              Please fill in correct database info:
             

             
               
                 
                 
               
               
                 
                 
               
               
                 
                 
               
               
                 
                 
               
             
Host:
Username:
Password:
Database:

             
             

Wallet Info


              Please fill in correct wallet info:
             

             
               
                 
                 
               
               
                 
                 
               
               
                 
                 
               
               
                 
                 
               
             
Host:
Login:
Password:
Port:

           

         

       

            break;
      case 
4:
      
?>

       
       

         

           

Basic Settings


           

           

             
               
                 
                 
               
               
                 
                 
               
               
                 
                 
                 
               
               
                 
                 
               
               
                 
                 
               
             
Site title:
Site description:
URL:(without http://)
Currency:
Currency sign:

           

         

       

            break;
      case 
5:
      
?>

       
       

         

           

CRON setup


            In order to BitcoinDice 2.0 to work properly, you must have the CRON set this way:
           


            Every 1 minute: content/cron/check_deposits.php
           



            Example (Linux):
           


            1) Open CRON table:
           

            $ crontab -e
           


            2) Add the following line:
           

            * * * * * cd /var/www/content/cron; php check_deposits.php;
           


            3) Save CRON table by pressing CTRL+X, than confirm (Y) and press enter.
           


            4) Restart CRON service:
           

            $ service cron restart
           


            That's all.           
             
         

       

            break;
      case 
6:
      
?>

       

         

           

Thank You!


           

            Your installation is done! You can login to administration or try your luck at your own gambling site :-)
           

           

            Admin details:

             Username: admin

             Password: admin
           

           

            Don't forget to change this info after first login!
           

           

            Warning! Please remove the /install directory now, otherwise there is a security risk.
         

       

            break;
    }
    
?>
   
   

     

       

         

Step: echo $step?>


       

       

                    if ($step==6) echo '';
          else echo 
'" style="padding: 5px;"';
          
?>

       

     

   

        if ($step==&& isset($_GET['db'])) echo 'alert("Can\'t connect to database! Please check if provided informations are correct and try again.");';
    
?>

 
hero member
Activity: 1008
Merit: 502
February 04, 2015, 07:31:11 PM
#23
coin wallet  not need be synchronized to my script will work for you

your test showed the getinfo I see when I type netcoind getinfo

coin wallet (netcoind) may be in the directory as compiled or upload it to the root folder

To replace wallet.dat file, you need to stop the coin wallet (netcoind)

I did stop the wallet before maing any changes, but it still did very weird things LOL I even stopped and rebooted VPS and still same problems But like I said it is very OK no problems Smiley I just moved the coins out of the old wallet and threw it away since I have to resync anyways Smiley



In that case, it must also work getbalance, getnewaddress, etc.

Your script should work too.

Yes, That is good news that your script worked for him!

regarding $driver_login that is a variable.  I don't believe there is a file named that.

Can you check the coind logs on the coind server to see if it gives any error message?



I am not sure where to find that, I looked at the db.log and debug.log and there was nothing in them at all. is that what you were talking about??

well At least now I do know its not y communications its something wrong inside the code. I just can not find it, I do know I can force ti to get thru the installation is I tell it to accept all variables as true but once the site loads you can not deposit coins Sad it still is not connecting to the wallet

what i mean is take this code

$this->debug && $this->debug.='***** Server response *****'."\n".$response.'***** End of server response *****'."\n";
$response = json_decode($response,true);
} else {
throw new Exception('Unable to connect to '.$this->url);
}
if ($this->debug) {
echo nl2br($debug);
}
if (!$this->notification) {
if ($response['id'] != $currentId) {
throw new Exception('Incorrect response id (request id: '.$currentId.', response id: '.$response['id'].')');
}

if (!is_null($response['error'])) {
throw new Exception('Request error: '.$response['error']);
}

return $response['result'];
} else {
return true;

and make it say

$this->debug && $this->debug.='***** Server response *****'."\n".$response.'***** End of server response *****'."\n";
$response = json_decode($response,true);
} else {
throw new Exception('Unable to connect to '.$this->url);
}
if ($this->debug) {
echo nl2br($debug);
}
if (!$this->notification) {
if ($response['id'] != $currentId)
return true;
if (!is_null($response['error']))
return true;
return $response['result'];
} else {
return true;

it will get thru the installation but the wallet still wont work Sad

so what that tells me is it is a code that is present both during the installation and used after the installation.

but so far the only one I have seen is the driver_test.php which is the exact same file as the wallet_driver.php in another folder. since you are supposed to delete the install file after installation I decided to look for matching files elesewhere in the directories.
legendary
Activity: 4228
Merit: 1313
February 04, 2015, 06:07:08 PM
#22
coin wallet  not need be synchronized to my script will work for you

your test showed the getinfo I see when I type netcoind getinfo

coin wallet (netcoind) may be in the directory as compiled or upload it to the root folder

To replace wallet.dat file, you need to stop the coin wallet (netcoind)

I did stop the wallet before maing any changes, but it still did very weird things LOL I even stopped and rebooted VPS and still same problems But like I said it is very OK no problems Smiley I just moved the coins out of the old wallet and threw it away since I have to resync anyways Smiley



In that case, it must also work getbalance, getnewaddress, etc.

Your script should work too.

Yes, That is good news that your script worked for him!

regarding $driver_login that is a variable.  I don't believe there is a file named that.

Can you check the coind logs on the coind server to see if it gives any error message?

sr. member
Activity: 344
Merit: 250
February 04, 2015, 06:05:33 PM
#21
I found this in the index.php


fwrite($w_file,'$driver_login=\'http://'.$_POST['w_user'].':'.$_POST['w_pass'].'@'.$_POST['w_host'].':'.$_POST['w_port'].'/\';'."\n");

however I looked in every folder and file and can not find a driver_login file anywhere is this a problem??

Show entire file index.php

Well. This variable  give data to the configuration file.
hero member
Activity: 1008
Merit: 502
February 04, 2015, 05:56:58 PM
#20
I found this in the index.php


fwrite($w_file,'$driver_login=\'http://'.$_POST['w_user'].':'.$_POST['w_pass'].'@'.$_POST['w_host'].':'.$_POST['w_port'].'/\';'."\n");

however I looked in every folder and file and can not find a driver_login file anywhere is this a problem??
hero member
Activity: 1008
Merit: 502
February 04, 2015, 05:44:25 PM
#19
I love programming, what should work never does what shouldnt work sometimes does, and when its broke, and you fix it, you hardly ever know how or why HAHA your just happy it worked HAHA
sr. member
Activity: 344
Merit: 250
February 04, 2015, 05:38:10 PM
#18
coin wallet  not need be synchronized to my script will work for you

your test showed the getinfo I see when I type netcoind getinfo

coin wallet (netcoind) may be in the directory as compiled or upload it to the root folder

To replace wallet.dat file, you need to stop the coin wallet (netcoind)

I did stop the wallet before maing any changes, but it still did very weird things LOL I even stopped and rebooted VPS and still same problems But like I said it is very OK no problems Smiley I just moved the coins out of the old wallet and threw it away since I have to resync anyways Smiley



In that case, it must also work getbalance, getnewaddress, etc.

Your script should work too.
hero member
Activity: 1008
Merit: 502
February 04, 2015, 05:27:55 PM
#17
coin wallet  not need be synchronized to my script will work for you

your test showed the getinfo I see when I type netcoind getinfo

coin wallet (netcoind) may be in the directory as compiled or upload it to the root folder

To replace wallet.dat file, you need to stop the coin wallet (netcoind)

I did stop the wallet before maing any changes, but it still did very weird things LOL I even stopped and rebooted VPS and still same problems But like I said it is very OK no problems Smiley I just moved the coins out of the old wallet and threw it away since I have to resync anyways Smiley
sr. member
Activity: 344
Merit: 250
February 04, 2015, 05:01:24 PM
#16
coin wallet (netcoind) may be in the directory as compiled or upload it to the root folder

coin wallet  not need be synchronized to my script will work for you

To replace wallet.dat file, you need to stop the coin wallet (netcoind)
hero member
Activity: 1008
Merit: 502
February 04, 2015, 04:52:31 PM
#15
Try files from this link:

http://white-bitcoin.com/test.zip

In the index.php file, enter the data from the file conf wallet
Upload files to the webserver.

Wallet conf file on the server vps should look like this:

Code:
rpcuser=username
rpcpassword=password
daemon=1
rpcallowip=*
rpcport=11311
port=11310
addNode=63.246.129.56

Restart the coin wallet

Call the address of the page with the file index.php

If the coin wallet is working correctly you should get information from getinfo

If the coin wallet does not work it should throw an error.

Tell me what you receive.

I will try this but it will be in a day or so,

By trying to  move it from the root directory i deleted it Sad so now it has to syn in again, I also noticed I could not copy the old wallet.dat file I had on backup, no matter how I tried it always reverts back to the new wallet.dat file, But no problems, I kept it on my computer and opened the wallet on my computer and sent those coins to my personal wallet then deleted that wallet.dat file. I just thought it was weird it would not copy or replace the new wallet.dat file. even if I deleted the one that was with the install and uploaded the old wallet.dat file 2 things still happened, the wallet.dat file was green in SSH prompt and it still reverted back to the wallet.dat file that came in the new install.
hero member
Activity: 1008
Merit: 502
February 04, 2015, 04:44:42 PM
#14
Hey,
Have you checked to make sure this line, the red part:

Code:
$test=new jsonRPCClient([font=Verdana][b]'http://'.$_GET['w_user'].':'.$_GET['w_pass'].'@'.$_GET['w_host'].':'.$_GET['w_port'].'/'[/b][/font]);

is generating the expected URL?

Since you can telnet to that port on the coin server from the web server, the port is open and listening.   You'd want to check that you are really generating the right URL with the right user/pw, host/port combo.

Also, if you do a
netcoind getinfo

(or whatever) while on the coind server, does it return information?


If those are correct then...hmmmm...

doing a netcoind getinfo does display results and I have sent coins there and they show in the balance, I thought maybe it was because there were no coins in the wallet so i sent some.

how do I check
Code:
$test=new jsonRPCClient([font=Verdana][b]'http://'.$_GET['w_user'].':'.$_GET['w_pass'].'@'.$_GET['w_host'].':'.$_GET['w_port'].'/'[/b][/font]);

to make sure it is generating the expected URL?
sr. member
Activity: 344
Merit: 250
February 04, 2015, 03:04:38 PM
#13
Try files from this link:

http://white-bitcoin.com/test.zip

In the index.php file, enter the data from the file conf wallet
Upload files to the webserver.

Wallet conf file on the server vps should look like this:

Code:
rpcuser=username
rpcpassword=password
daemon=1
rpcallowip=*
rpcport=11311
port=11310
addNode=63.246.129.56

Restart the coin wallet

Call the address of the page with the file index.php

If the coin wallet is working correctly you should get information from getinfo

If the coin wallet does not work it should throw an error.

Tell me what you receive.
legendary
Activity: 4228
Merit: 1313
February 04, 2015, 02:56:26 PM
#12
Hey,
Have you checked to make sure this line, the red part:

Code:
$test=new jsonRPCClient([font=Verdana][b]'http://'.$_GET['w_user'].':'.$_GET['w_pass'].'@'.$_GET['w_host'].':'.$_GET['w_port'].'/'[/b][/font]);

is generating the expected URL?

Since you can telnet to that port on the coin server from the web server, the port is open and listening.   You'd want to check that you are really generating the right URL with the right user/pw, host/port combo.

Also, if you do a
netcoind getinfo

(or whatever) while on the coind server, does it return information?


If those are correct then...hmmmm...
hero member
Activity: 1008
Merit: 502
February 04, 2015, 02:41:10 PM
#11
The problem is probably in the fact that the coin daemon does not allow a connection to the outside.

Try these settings in the file  wallet conf:
Code:
rpcuser=username
rpcpassword=password
daemon=1
rpcallowip=*
rpcport=11311
port=11310
addNode=63.246.129.56

After the change, restart the coin wallet

When trying with teh script from my webserver I put in my VPS ip Address, when trying on the VPS I use local host

Wallet info( when the script is on the webserver and the wallet is on my VPS)

Host:  Host
Login: Wallet User
Pass: Wallet Password
Port: port

What i have tried

Wallet info

Host:  VPS IP
Login: rpcusername from wallet.conf
Pass: rpcpassword from wallet.conf
Port: rpc port from wallet.conf

in addition I have also tried

Host:  VPS IP
Login: rpcusername from wallet.conf
Pass: rpcpassword from wallet.conf
Port: port from wallet.conf

-------------------------------------------------------------------------

Wallet info( when the script is on the VPS and the wallet is on my VPS)


Host:  Host
Login: Wallet User
Pass: Wallet Password
Port: port

What i have tried

Wallet info

Host:  localhost
Login: rpcusername from wallet.conf
Pass: rpcpassword from wallet.conf
Port: rpc port from wallet.conf

in addition I have also tried

Host:  localhost
Login: rpcusername from wallet.conf
Pass: rpcpassword from wallet.conf
Port: port from wallet.conf

My conf file

rpcuser=myusername
rpcpassword=mypassword
listen=1
daemon=1
server=1
rpcconnect=VPS IP
rpcconnect=Webserver IP
rpcconnect=Webserver secondary IP
rpcallowip=Webserver IP
rpcallowip=Webserver secondary IP
rpcallowip=VPS IP
rpcallowip=127.0.0.1
rpcport=11311
port=11310
addnode=63.246.129.56
sr. member
Activity: 344
Merit: 250
February 04, 2015, 02:27:43 PM
#10
The problem is probably in the fact that the coin daemon does not allow a connection to the outside.

Try these settings in the file  wallet conf:
Code:
rpcuser=username
rpcpassword=password
daemon=1
rpcallowip=*
rpcport=11311
port=11310
addNode=63.246.129.56

After the change, restart the coin wallet
Pages:
Jump to: