e1ioan / rokuphp

32 stars 9 forks source link

Web interface replaced with php script #12

Closed blackcomb-dev closed 4 years ago

blackcomb-dev commented 4 years ago

I followed the guide as provided in README.md, with the php5 script clean installing with no errors and my Pi's IP address inputted into the relevant setting option on the Roku app. However, once I navigated to my Pi's IP in the web browser (both in Chrome 76 and IE 11), I was met with the following block of code instead of the web interface (see below). I tried the php7 script instead, which clean installed with no issues, and this time the browser returned an Error 500 code when I attempted to navigate to my Pi's IP address. Tested with both a Pi 1 Model B+ and a Pi 3 Model B, both running Raspbian.

` <?php require_once("rpcl/rpcl.inc.php"); require_once("dm.php"); require_once("dmauth.php"); //Includes use_unit("jquerymobile/forms.inc.php"); use_unit("extctrls.inc.php"); use_unit("stdctrls.inc.php"); use_unit("jquerymobile/jmobile.inc.php");

//Class definition class PageLogin extends MPage { public $EditLoginUser = null; public $ButtonLogin = null; public $EditLoginPassword = null; public $LabelLLogin = null; public $LabelLPassword = null; public $MsgCreate = null; public $LabelCPasswor = null; public $LabelCRPassword = null; public $LabelCLogin = null; public $EditRePassword = null; public $EditPassword = null; public $EditLogin = null; public $ButtonCreateUser = null; public $LabelCTitle = null; function ShowHideCreateUser($val) { $this->MsgCreate->Visible = $val; $this->LabelCTitle->Visible = $val; $this->LabelCLogin->Visible = $val; $this->EditLogin->Visible = $val; $this->LabelCPasswor->Visible = $val; $this->EditPassword->Visible = $val; $this->LabelCRPassword->Visible = $val; $this->EditRePassword->Visible = $val; $this->ButtonCreateUser->Visible = $val; } function ShowHideLogin($val) { $this->LabelLLogin->Visible = $val; $this->EditLoginUser->Visible = $val; $this->LabelLPassword->Visible = $val; $this->EditLoginPassword->Visible = $val; $this->ButtonLogin->Visible = $val; } function ButtonCreateUserClick($sender, $params) { global $dm; $path = $dm->GetDataPath(); if($this->EditLogin->Text == "") { $this->MsgCreate->Caption = "Login is required"; return; } if($this->EditPassword->Text == "") { $this->MsgCreate->Caption = "Password is required"; return; } if($this->EditPassword->Text != $this->EditRePassword->Text) { $this->MsgCreate->Caption = "Password does not match."; return; } $hash = md5($this->EditLogin->Text . ":rokuphp:" . $this->EditPassword->Text); if($fh = fopen($path . "validuser.txt", 'w')) { $stringData = $this->EditLogin->Text . ":rokuphp:" . $hash; fwrite($fh, $stringData, 1024); fclose($fh); } global $dmauth; $dmauth->ZAuth->UserName = $this->EditLoginUser->Text; $dmauth->ZAuth->UserPassword = $this->EditLoginPassword->Text; mobileRedirect("menu.php"); } function PageLoginShow($sender, $params) { global $dm; $path = $dm->GetDataPath(); $val = file_exists($path . "validuser.txt"); $this->ShowHideCreateUser(!$val); $this->ShowHideLogin($val); } function ButtonLoginClick($sender, $params) { global $dmauth; $dmauth->ZAuth->UserName = $this->EditLoginUser->Text; $dmauth->ZAuth->UserPassword = $this->EditLoginPassword->Text; mobileRedirect("menu.php"); } }

global $application;

global $PageLogin;

//Creates the form $PageLogin = new PageLogin($application);

//Read from resource file $PageLogin->loadResource(FILE);

//Shows the form $PageLogin->show();

?> `

blackcomb-dev commented 4 years ago

Did I misconfigure something or miss something in the installation process?

e1ioan commented 4 years ago

Try installing the the other script, install.sh which is for php7

On Sun, Aug 18, 2019, 1:03 AM Blackcomb notifications@github.com wrote:

I followed the guide as provided in README.md, with the php5 script clean installing with no errors and my Pi's IP address inputted into the relevant setting option on the Roku app. However, once I navigated to my Pi's IP in the web browser (both in Chrome 76 and IE 11), I was met with the following block of code instead of the web interface (see below). I tried the php7 script instead, which clean installed with no issues, and this time the browser returned an Error 500 code when I attempted to navigate to my Pi's IP address. Tested with both a Pi 1 Model B+ and a Pi 3 Model B, both running Raspbian.

` MsgCreate->Visible = $val; $this->LabelCTitle->Visible = $val; $this->LabelCLogin->Visible = $val; $this->EditLogin->Visible = $val; $this->LabelCPasswor->Visible = $val; $this->EditPassword->Visible = $val; $this->LabelCRPassword->Visible = $val; $this->EditRePassword->Visible = $val; $this->ButtonCreateUser->Visible = $val; } function ShowHideLogin($val) { $this->LabelLLogin->Visible = $val; $this->EditLoginUser->Visible = $val; $this->LabelLPassword->Visible = $val; $this->EditLoginPassword->Visible = $val; $this->ButtonLogin->Visible = $val; } function ButtonCreateUserClick($sender, $params) { global $dm; $path = $dm->GetDataPath(); if($this->EditLogin->Text == "") { $this->MsgCreate->Caption = "Login is required"; return; } if($this->EditPassword->Text == "") { $this->MsgCreate->Caption = "Password is required"; return; } if($this->EditPassword->Text != $this->EditRePassword->Text) { $this->MsgCreate->Caption = "Password does not match."; return; } $hash = md5($this->EditLogin->Text . ":rokuphp:" . $this->EditPassword->Text); if($fh = fopen($path . "validuser.txt", 'w')) { $stringData = $this->EditLogin->Text . ":rokuphp:" . $hash; fwrite($fh, $stringData, 1024); fclose($fh); } global $dmauth; $dmauth->ZAuth->UserName = $this->EditLoginUser->Text; $dmauth->ZAuth->UserPassword = $this->EditLoginPassword->Text; mobileRedirect("menu.php"); } function PageLoginShow($sender, $params) { global $dm; $path = $dm->GetDataPath(); $val = file_exists($path . "validuser.txt"); $this->ShowHideCreateUser(!$val); $this->ShowHideLogin($val); } function ButtonLoginClick($sender, $params) { global $dmauth; $dmauth->ZAuth->UserName = $this->EditLoginUser->Text; $dmauth->ZAuth->UserPassword = $this->EditLoginPassword->Text; mobileRedirect("menu.php"); } } global $application; global $PageLogin; //Creates the form $PageLogin = new PageLogin($application); //Read from resource file $PageLogin->loadResource(FILE); //Shows the form $PageLogin->show(); ?>

`

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/e1ioan/rokuphp/issues/12?email_source=notifications&email_token=AAGZCFXOKTYCRTTDD5XGZHDQFBYUPA5CNFSM4IMQQ2H2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFZVPZQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGZCFXSPLSXHTZRC5PL6ZDQFBYUPANCNFSM4IMQQ2HQ .

blackcomb-dev commented 4 years ago

@e1ioan I just tried it: the script completed with no errors, but when I attempted to navigate to my Pi's IP address in a web browser it returned 'HTTP ERROR 500' image

drvrtigo commented 4 years ago

After a bit of searching, it seems to be an issue with PHP versions > 7.2 (https://www.php.net/manual/en/reserved.other-reserved-words.php)

Fatal error: Cannot use 'Object' as class name as it is reserved in /var/www/html/rpcl/system.inc.php on line 77

blackcomb-dev commented 4 years ago

@drvrtigo @e1ioan I can confirm that on my end the issue with the php7 script was resolved once I modified the script to install php7.1 and its derived tools rather than php v7.3

e1ioan commented 4 years ago

Thanks @blackcomb-dev Modified the script to install php7.1