Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Captive Portal and jquery

    Scheduled Pinned Locked Moved Captive Portal
    3 Posts 2 Posters 2.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      snowman2344
      last edited by

      I am trying to capture user info when they log into the captive portal. I do not know where i went wrong??? On the following code the jquery runs a file captiveportal-x.php witch runs a INSERT to a mysql DB. When i run a test be clicking "View current page" on the captive portal page it seems to work correctly. But under normal use with a fresh browser window nothing (it does log in to the captive portal)? I have added the ip of the mysql server to the "allowed ip address" by-pass. Can anyone help???????
      Thanks

      
       session_start( );
       $mysessid = session_id();
       ?>
      
      #PORTAL_MESSAGE#
      
      <form action="$PORTAL_ACTION$" method="post" id="testform" onsubmit="return mycall();">
      	User: 
      
          Email: 
      
          Pass: 
      
          Voucher: 
      
        	Accept
      
      </form>
      
      print "Session number: ";
      
      print $mysessid;
      
      ?>
      
      
      
      foreach($_POST as $key=>$val){
      if(isset($val)){ ${$key} = $val;}
      }
       $db = mysql_connect("IPXXXXX", "USERNAME", "PASSWORD") or die ("cant find that database");
      mysql_select_db("XXXXXX",$db) or die ("cant connect to that database");
      $result = mysql_query("
      INSERT INTO testtable 
      (salutation, fname, lname, email, voucher, authorize, privacy, session) 
      VALUES ('$salutation', '$auth_user', '$lname', '$email', '$auth_voucher', '$authorize', '$privacy', '$session')
       ON DUPLICATE KEY UPDATE 
       salutation='$salutation',
        fname='$fname',
         lname='$lname',
          email='$email',
      	 voucher='$voucher',
      	  authorize='$authorize',
      	   privacy='$privacy';") or die(mysql_error());
      ?>
      
      
      1 Reply Last reply Reply Quote 0
      • S
        snowman2344
        last edited by

        All I want to do is post user info to a MYSQL DB before login. Is there a simple way to do this???? Someone out there must know

        1 Reply Last reply Reply Quote 0
        • M
          michel2013
          last edited by

          I'm not sure what the relation is between both code dumps? Can you give us some more information?

          Can you see that the actual post request is done```
          ($.post('captiveportal-x.php', $("#testform").serialize());)

          To see this you need to change the return of function 'mycall' instead of 'false'
          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.