dialup admin coding - help required

Owen DeLong owen at delong.com
Fri Dec 22 04:56:00 CET 2006


>
I don't have an environment to test this, and, I'm no PHP expert,  
but, I've got
some similar stuff working, and, I suspect that the changes below
might work for you...

You can't include PHP variables in HTML text outside of the <? ?> tags
and expect them to be interpolated.  Generally, it's just easier to  
use PHP
echo statements for things that require variables to be interpolated.

Below is an example of your code with this resolved.

No guarantees, but, hopefully it points you in the right direction.

In case you don't know, pretty good documentation with examples for
PHP can be found at www.php.net.

Owen

> <?php
> require('../conf/config.php3');
> ?>
> <html>
> <?php
>
> if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
> 	include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
> else{
> 	echo <<<EOM
> <title>Failed logins</title>
> <link rel="stylesheet" href="style.css">
> </head>
> <body bgcolor="#80a040" background="images/greenlines1.gif"  
> link="black"
> alink="black">
> <center>
> <b>Could not include SQL library functions. Aborting</b>
> </body>
> </html>
> EOM;
> 	exit();
> }
>
> $now = time();
> $start = $now - ($last*60);
> $now_str = date($config[sql_full_date_format],$now);
> $prev_str = date($config[sql_full_date_format],$start);
>
>
>
> ?>
>
> <head>
> <title>Failed Logins</title>
> <link rel="stylesheet" href="style.css">
> </head>
> <body bgcolor="#80a040" background="images/greenlines1.gif"  
> link="black"
> alink="black">
> <center>
> <table border=0 width=550 cellpadding=0 cellspacing=0>
> <tr valign=top>
> <td align=center><img src="images/title2.gif"></td>
> </tr>
> </table>
> <table border=0 width=400 cellpadding=0 cellspacing=2>
> </table>
> <br>
> <table border=0 width=840 cellpadding=1 cellspacing=1>
> <tr valign=top>
> <td width=65%></td>
> <td bgcolor="black" width=35%>
> 	<table border=0 width=100% cellpadding=2 cellspacing=0>
> 	<tr bgcolor="#907030" align=right valign=top><th>
> 	<font color="white">Failed Logins</font> 
> 	</th></tr>
> 	</table>
> </td></tr>
> <tr bgcolor="black" valign=top><td colspan=2>
> 	<table border=0 width=100% cellpadding=12 cellspacing=0
> bgcolor="#ffffd0" valign=top>
> 	<tr><td>
> <?php
> echo <<<EOM
>
> EOM;
> ?>
>
> <p>
> 	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000
> width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
> 	<tr bgcolor="#d0ddb0">
> 	<th>#</th><th>login</th><th>Password</th><th>Time</th><th>Terminate
> cause</th><th>Caller ID</th>
> 	</tr>
>
> <?php
>
>
>
> $link = @da_sql_pconnect($config);
>
> 	$search = @da_sql_query($link,$config,
> 	"SELECT id, user,pass,reply,date,callingid
> 	FROM radpostauth
> 	ORDER BY date;");
> 	$num = 0;
> 		
> *// Here is where my array collects the records - This is working *//
>
> 		while( $row = @da_sql_fetch_array($search,$config) ){
> 			
> 			$num++;
> 			$acct_login = $row[user];
> 			$acct_password = $row[pass];
> 			$acct_terminate_cause = $row[reply];
> 			$acct_time = $row[date];
> 			$acct_callingid = $row[callingid];
>
<!-- Delete the next few lines
> 			
> 			
> 	}
>
> ?>
>
  (to here) -->
> 			
>
> *// Here is my screen output, obviously I need to loop through the  
> array and
> output the lines but just can't figure it out. *//

<!-- Change these lines as follows -->
>
> 	echo "<tr align=center bgcolor="white">\n"
> 				
> 	echo "			<td>$num</td>\n"
> 	echo "			<td>$acct_login</td>
> 	echo "			<td>$acct_password</td>
> 	echo "			<td>$acct_time</td>
> 	echo "			<td>$acct_terminate_cause</td>
> 	echo "			<td>$acct_callingid</td>
> 	echo "		</tr>
> 	
>
<!-- Add these lines -->

	}
  ?>

> 	
>
> 	</table>
>
> </td></tr><tr><td>
>
> </td></tr>
> </table></td></tr></form>
> </table>
> </tr>
> </table>
> </body>
> </html>
>
>
>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/ 
> users.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2094 bytes
Desc: not available
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20061221/445bd658/attachment.bin>


More information about the Freeradius-Users mailing list