Sep
21
2009
0

PHP array example

Hello all. It’s been a few weeks since I posted… I’ve been teaching myself PHP to create a web interface for a Asterisk based project I’m working on. My goal is to create a LAMP(Linux, Apache, MySQL, PHP) web managment tool for creating calling cards for use with Asterisk. The project is called ACCWA(pronounced aqua), the Asterisk Calling Card Web Administration tool. As I put this altogether I will keep my loyal readers updated about what I’ve learned about PHP.

Today I will cover Arrays. PHP handles arrays in manner similar to PERL. Each value can have an optional indice. In my example below, we simply have a list with no idiceses.

example:

<?php

$myarray[]=”hi” ;
$myarray[]=”how” ;
$myarray[]=”are” ;
$myarray[]=”you?” ;

// Now we will ‘echo’ each value in the array
foreach ($myarray as $i) {
echo “$i ” ; }

?>

output of myarray.php:

Above we did two simple task. First we defined a list of words in our array, then we echo’ed each one individually with the ‘foreach’ function. Very similar to BASH.  Your PHP page should display:

hi how are you?

Sep
09
2009
0

Adjust date & time (NTP) on Fedora Linux

Correct time is crucial for many Network services.  Time stamps are required for accurate logs, email, and in the case of Asterisk – voicemail.  A customer sent me a request for instructions on adjusting date & time for their Asterisk PBX.  Most Fedora based systems come with a tool just for this purpose.  From the Desktop open a console window and type:

(more…)

Sep
06
2009
0

Disable automatic offline mode in Firefox

If you use wireless with Fedora or Ubuntu then you problably encountered the annoying, “OFFLINE mode – Firefox is currently in offline mode and can’t browse the Web” page.  You start your web browser after selecting the access point you want and that obnoxious message appears.  So I’m writing this post to remind myself how to fix it without twenty minutes of googling.  Basically Firefox by default checks to see if you have a network connection via the Linux Network Manager applet.  This works fine under normal cicumstances, but I prefer init scripts to start my ethernet interfaces.  Even though you may be connected to the LAN, Firefox doesnt know.

(more…)

Written by mattb in: Linux | Tags: , , , , ,