Welcome, Guest. Please login or register.
Did you miss your activation email?
+  pfSense Forum
|-+  pfSense English Support» Captive Portal» Is it possible for me to display a users IP address on the login page??
Username:
Password:
 
 

Pages: [1]   Go Down
  Print  
Author Topic: Is it possible for me to display a users IP address on the login page??  (Read 17380 times)
0 Members and 1 Guest are viewing this topic.
Tram
Jr. Member
**
Offline Offline

Posts: 54


View Profile
« on: May 21, 2007, 12:25:32 pm »

Is it possible for me to display a users IP address assigned to them by the pfsense DHCP server on the login page?? i want to do this so that when the view bandwidthd which is a link on the page they know which IP is theres and view there statistics.

I know the login page is a basic html page but it says something in the captive portal file manager about using php but i don't know how to do it.

Thanks
Logged
JorgeAldoBR
Jr. Member
**
Offline Offline

Posts: 64


View Profile
« Reply #1 on: May 21, 2007, 02:35:50 pm »

put this where you want the ip to appear :

<?php echo getenv('REMOTE_ADDR'); ?>


Logged
jeroen234
Sr. Member
****
Offline Offline

Posts: 506


View Profile
« Reply #2 on: May 22, 2007, 12:37:46 am »

upload this page as youre pfsense portal page

Code:
HTML>
<HEAD>
<META HTTP-EQUIV="REFRESH" CONTENT="1";URL="$PORTAL_ACTION$p.php?portal_action=$PORTAL_ACTION$&portal_redirurl=$PORTAL_REDIRURL$">
</HEAD>

<BODY>
</BODY>
</HTML>

now it will send you to p.php afther 1 sec

p.php

Code:
<?
echo "<br><br><br>";
echo "Welkom youre ipadress = ";
echo getenv('REMOTE_ADDR');
echo "<br><br>";
?>
<table>
<form method="post" action="<?php echo $_GET["portal_action"]; ?>">
<tr><td><h3>usernaam</h3></td><td><input name="auth_user" type="text"></td></tr>
<tr><td><h3>wachtwoord </h3></td><td><input name="auth_pass" type="password"></td></tr>
   <input name="redirurl" type="hidden" value="<?php echo $_GET["portal_redirurl"]; ?>">
   <tr><td><input name="accept" type="submit" value="Continue"></td><td></td></tr>
</form>
</table>


« Last Edit: May 22, 2007, 01:10:03 am by jeroen234 » Logged
JorgeAldoBR
Jr. Member
**
Offline Offline

Posts: 64


View Profile
« Reply #3 on: May 22, 2007, 11:01:40 pm »

Why my code doesnt work ? (I did not try it, but i presume now that it doesnt work)
Logged
jeroen234
Sr. Member
****
Offline Offline

Posts: 506


View Profile
« Reply #4 on: May 24, 2007, 01:26:25 pm »

ehmm i don't see code from you ??
Logged
Cry Havok
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2772


Backup: n. What you should have done yesterday.


View Profile
« Reply #5 on: May 24, 2007, 01:35:57 pm »

ehmm i don't see code from you ??

Second post in this thread:

put this where you want the ip to appear :

<?php echo getenv('REMOTE_ADDR'); ?>

It wasn't inside a code block though, so not obvious Smiley
Logged

If you're planning on PMing me to ask me to look at a thread, or for individual support, don't.
jeroen234
Sr. Member
****
Offline Offline

Posts: 506


View Profile
« Reply #6 on: May 24, 2007, 01:45:39 pm »

if you put that in a php page then it will work
in the example php portal page (3 post in topic) i have include it
Logged
JorgeAldoBR
Jr. Member
**
Offline Offline

Posts: 64


View Profile
« Reply #7 on: May 25, 2007, 03:29:05 pm »

Thank you.
Logged
alexander007
Newbie
*
Offline Offline

Posts: 14


View Profile
« Reply #8 on: August 08, 2007, 11:01:43 am »

that dont work for me...it keeps reloading...

index.html
Code:
<HTML>
<HEAD>
<META HTTP-EQUIV="REFRESH" CONTENT="1";URL="$PORTAL_ACTION$captiveportal-portal.php?portal_action=$PORTAL_ACTION$&portal_redirurl=$PORTAL_REDIRURL$">
</HEAD>
<BODY>
Loading...
</BODY>
</HTML>

captiveportal-portal.php
Code:
<form method="post" action="<?php echo $_GET["portal_action"]; ?>">
              <div align="left">
                <table width="200" border="0">
                  <tr>
                    <td><div align="right"><strong>Usuario:</strong></div></td>
                      <td><label>
                        <input name="auth_user" type="text" size="20" />
                      </label></td>
                      <td><strong>@uprrp.edu</strong></td>
                    </tr>
                  <tr>
                    <td><div align="right"><strong>Contraseña:</strong></div></td>
                      <td><label>
                        <input name="auth_pass" type="password" size="20" />
                      </label></td>
                      <td>&nbsp;</td>
                    </tr>
                  <tr>
                    <td>&nbsp;</td>
                      <td><label>
                        <div align="center">
                          <input name="redirurl" value="<?php echo $_GET["portal_redirurl"]; ?>" type="hidden">
                          <input type="submit" name="button" id="button" value="Conectar" />
                        </div>
                      </label></td>
                      <td>&nbsp;</td>
                    </tr>
                  </table>
                </div>
            </form>

whats wrong?
Logged
alexander007
Newbie
*
Offline Offline

Posts: 14


View Profile
« Reply #9 on: August 09, 2007, 07:28:53 pm »

I found the problem Grin
Logged
Gertjan
Full Member
***
Offline Offline

Posts: 273



View Profile
« Reply #10 on: August 10, 2007, 04:13:49 am »

I found the problem Grin
What was it  ? Cheesy

Do we have to supose that somethings is wrong with your posts ?
Logged
docwho76
Jr. Member
**
Offline Offline

Posts: 30


View Profile
« Reply #11 on: August 24, 2008, 02:23:03 pm »

Since no one seems to bother with documenting this, and I just finished banging my head against this issue where the redirect just keeps reloading itself and not going to the page specified. To fix it you MUST do the quotation marks in the META HTTP-EQUIV line correctly:

Bad
Code:
<META HTTP-EQUIV="REFRESH" CONTENT="1";URL="/captiveportal-portal.php">

Good
Code:
<META HTTP-EQUIV="REFRESH" CONTENT="1;URL=/captiveportal-lclogin.php">

Hope this saves other people torment anguish and wasted time Googling.

I found the problem Grin
What was it  ? Cheesy

Do we have to supose that somethings is wrong with your posts ?
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

 

Page created in 0.031 seconds with 20 queries.