News: This forum is now permanently frozen.
Pages: [1]
Topic: PHP files in filemanager  (Read 11832 times)
« on: June 12, 2007, 21:15:13 »
mcodo *
Posts: 4

I have made a fully integrated hotspot with captive portal on mac auth.
This system goes via PayPal for prepaid account and paypal updates the radius-server after payment is success.
This works fine in PfSense,, BUT not in m0n0wall because i cant get php-files to run under filemanager.

The case:
I have made a redir from the CP-page to a new script called index2.php uploaded with filemanager.
The reason for this other php-page is to determine the MAC-address of the client to send via a order-form to PayPal.
Attached is the PHP-file i try to run.
This index2.php just appear as code in the browser.

Is it any way i can get this to run like it does in PfSense?


Regards
Paal Solvberg
Norway

* index2.php.txt (1.59 KB - downloaded 345 times.)
« Last Edit: June 12, 2007, 21:38:29 by mcodo »
« Reply #1 on: June 12, 2007, 23:06:11 »
mwiget *
Posts: 38

My initial guess is, the uploaded file index2.php doesn't have the execution bit set. Try

chmod a+rx /usr/local/captiveportal/index2.php

using the command exec function at http://<ip>/exec.php

Obviously your file won't survive a reboot.
« Reply #2 on: June 13, 2007, 00:07:22 »
mcodo *
Posts: 4

Hi,, Thanks for the quick reply.

I have tried the command you posted, but still no luck.
The code is still showing.
Btw, the path to the files placed by filemanager is /var/db/cpelements/
So i used the command: chmod a+rx /var/db/cpelements/index2.php

When i take an ls -l /var/db/cpelements i get this showing the right attributes:
$ ls -l /var/db/cpelements
total 78
-rw-r--r--   1 root  wheel    314 Jun 12 19:32 WIFI_BG.gif
-rw-r--r--   1 root  wheel   1409 Jun 12 19:32 WIFI_Logo.gif
-rw-r--r--   1 root  wheel  11977 Jun 12 19:32 bottom.gif
-rwxr-xr-x  1 root  wheel   3109 Jun 12 19:32 index2.php
-rw-r--r--   1 root  wheel     54 Jun 12 19:32 logo-right.gif
-rw-r--r--   1 root  wheel   5128 Jun 12 19:32 logo2.gif
-rw-r--r--   1 root  wheel   2687 Jun 12 19:32 site.css
-rw-r--r--   1 root  wheel   4673 Jun 12 19:32 style.css
-rw-r--r--   1 root  wheel   3178 Jun 12 19:32 wifi_header2.gif
-rw-r--r--   1 root  wheel    114 Jun 12 19:32 test.php


Regards
Paal Soelvberg
« Reply #3 on: June 13, 2007, 11:56:39 »
mcodo *
Posts: 4

One other solution would be to edit the index.php file inside captive portal.

What i need to know is where in this file is the user redirected to the custom captiveportal fileuploaded in setup.
If i can remove this redirection and replace it with the code i need it should do the trick.
That is if the client is NOT authenticated of course.
index.php file is attached.

Anyone?


Regards
Paal Soelvberg
Norway

* index.php.txt (15.91 KB - downloaded 384 times.)
« Reply #4 on: June 14, 2007, 00:13:20 »
mcodo *
Posts: 4

Finally I got it..   Grin
I manage with this mod to post the clients MAC-address to an external webserver doing the PayPal and Radius processing.

Here is the solution:

In /usr/local/captiveportal/index.php goto line number 174 and look for:
portal_reply_page($redirurl, "login");

Comment out this line and put in your own redir-command with client MAC-address:

    /* display captive portal page */
    /* portal_reply_page($redirurl, "login"); */
    /* PUT IN YOUR OWN CODE FOR REDIRIECTION TO AN EXTERNAL PAGE */
      echo <<<EOD
         <html>
         <head>
         <title>Wireless from GateLink | Hotspot</title>
         </head>
         
         <body onLoad="document.gatelink_form.submit();">
            <form method="post" action="http://your.domein.name/paypal-order.asp" name="gatelink_form">
               <input name="mac" value="$clientmac" type="hidden">
               <input name="redirurl" value="$orig_request" type="hidden">
            
               <center>Processing Information . . . </center>
            </form>
         </body>
         </html>
         
         
      EOD;
    /* END CUSTOM REDIR */





Happy Hotspotting
Paal Soelvberg
« Reply #5 on: June 14, 2007, 21:06:15 »
mwiget *
Posts: 38

glad you found a way. The reason why php files aren't executed on redirection is related to a dedicated mini_httpd daemon running on port 8000 that doesn't recognize php files.

A ps -axw (only httpd process shown here):
/usr/local/sbin/mini_httpd -c **.php|**.cgi -u root -maxproc 16 -i /var/run/mini_httpd.pid
/usr/local/sbin/mini_httpd -a -M 0 -u root -maxproc 16 -maxperip 4 -p 8000 -i /var/run/mini_httpd.cp.pid

The first shown is for the GUI, the second for the captive portal.



« Reply #6 on: April 07, 2009, 19:03:42 »
frank *
Posts: 28

I changed the index.php as proposed  but i get  http 500 error  Huh

Anyone?

Regards Frank
« Reply #7 on: April 09, 2009, 16:00:28 »
frank *
Posts: 28

I got it , after i did it with workon.sh after hard rebooting the mono it works fine.
thx
 
Pages: [1]
 
 
Powered by SMF 1.1.20 | SMF © 2013, Simple Machines