Jump to content

How to force a pop page?


landysaccount

Recommended Posts

Hello everyone.

 

I currently have a small wisp with NoCatSplash on the router. When a client tries to access a page they get a splash page where they have to press a button to authenticate and pass to the internet. Is an open/public splash page, no real user authentication with username and password. This happens every six hours. Once the client presses the button they get redirected to the page it requested. Here, I record the ip address, time they "logged in". Now, what I need is to be able to have a pop up page along with the requested page to those clients that haven't make their payment on time.

 

I tried doing this on the actual splash page but, is written in perl and I can't embed php into a perl script. Any idea on how I can add that little feature to the splash page or a way on how to just force a pop up page every certain time during the client's browsing to remind client of the payment?

 

Thanks in advanced for your help.

Link to comment
Share on other sites

you can echo a true or false value.. to javascript..

 

like this

 

echo "<script type='text/javascript'> awaitingPayment = {$awaitingPayment}; </script>";

 

and in the enter button put

 

onClick="checkForPayment()"

 

 

and then..

 

function checkForPayment() {

if (awaitingPayment) {

// open window here

}

// do whatever your old onClick function did..

}

Link to comment
Share on other sites

This is what splash.php looks like:

 

<form method="POST" action="$action">

        <input type="hidden" name="redirect" value="http://192.168.2.1/splash/check_status.php?requestedPage=$redirect">

        <input type="hidden" name="requestedPage" value="$redirect">

        <input type="hidden" name="accept_terms" value="yes">

        <input type="hidden" name="mode_login">

        <input type="submit" class="button" value="Entrar a la Red...">

    </form>

 

 

The action script is a perl script that is ran by NoCat to allow access to the user. What I do here is that I force that script to check_status.php.

 

Here's what the check_status.php looks like:

    if ( $_SERVER["HTTP_CLIENT_IP"] )            $ip = $_SERVER["HTTP_CLIENT_IP"];

    else if( $_SERVER["HTTP_X_FORWARDED_FOR"] )  $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];

    else if( $_SERVER["REMOTE_ADDR"] )            $ip = $_SERVER["REMOTE_ADDR"];

    else                                          $ip = "UNKNOWN";

       

    $mac = `sudo arp -i eth1 $ip | grep : | awk '{print $3}'`;

 

    //record visit

    $query = "insert into network_access ( ip, mac, timevisit ) values ( '$ip', '$mac', " . time() . " )";

 

    $result = dba_connect( $query, 1 ) or

              die( "Query: '$query', failed with error message: -- " . mysql_error() . " --" );

    // end visit record

   

    // check if is a company address

    $query = "select * from private_ip where priv_ip_address='$ip'";

    $result = dba_connect( $query, 1 ) or

                      die( "Query: '$query', failed with error message: -- " . mysql_error() . " --" );

    // immediately send private ip's to the requested page

    if( mysql_num_rows( $result ) >= 1 ){

      $location = "Location: " . $_REQUEST['requestedPage'];

      header("$location");

      exit;

    }

   

    $query = "select dhcp_cust_id as id from dhcp where dhcp_ip='$ip'";

    $result = dba_connect( $query, 1 ) or

                      die( "Query: '$query', failed with error message: -- " . mysql_error() . " --" );

   

    // if there isn't any match here then the user is not registered.

      if( mysql_num_rows( $result ) == 0 ){

      $location = "Location: ./notregistered_mesg.php";

      header("$location");

      exit;

    }

    $row = mysql_fetch_array( $result );

   

    $query = "select customer_status as status from customer where customer_id=" . $row["id"];

    $result = dba_connect( $query, 1 ) or

                      die( "Query: '$query', failed with error message: -- " . mysql_error() . " --" );

   

    $row = mysql_fetch_array( $result );

   

    if( $row["status"] == "SUSPENDIDO" ){

      header("Location: ./suspended_message.php");

      exit;

    }

    else

    {

      $location = "Location: " . $_REQUEST['requestedPage'];

      header("$location");

    }

 

==============================

 

So, what I would like to do is run another script before the header that would check if the user has a pending balance to remind them with a pop up window and still let them continue with their requested page..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.