landysaccount Posted June 21, 2009 Share Posted June 21, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/163136-how-to-force-a-pop-page/ Share on other sites More sharing options...
RussellReal Posted June 21, 2009 Share Posted June 21, 2009 I'm not quite sure how you'd do this in perl.. but.. echo some javascript which will open up the pop up window Quote Link to comment https://forums.phpfreaks.com/topic/163136-how-to-force-a-pop-page/#findComment-860736 Share on other sites More sharing options...
landysaccount Posted June 21, 2009 Author Share Posted June 21, 2009 Can I send javascript before the header() function? Since after the user clicks the enter button it gets redirected to a certain page with the header(). Quote Link to comment https://forums.phpfreaks.com/topic/163136-how-to-force-a-pop-page/#findComment-860739 Share on other sites More sharing options...
RussellReal Posted June 21, 2009 Share Posted June 21, 2009 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.. } Quote Link to comment https://forums.phpfreaks.com/topic/163136-how-to-force-a-pop-page/#findComment-860750 Share on other sites More sharing options...
landysaccount Posted June 21, 2009 Author Share Posted June 21, 2009 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.. Quote Link to comment https://forums.phpfreaks.com/topic/163136-how-to-force-a-pop-page/#findComment-860760 Share on other sites More sharing options...
landysaccount Posted June 22, 2009 Author Share Posted June 22, 2009 I still can't figure this out. Please help. Quote Link to comment https://forums.phpfreaks.com/topic/163136-how-to-force-a-pop-page/#findComment-861226 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.